All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Keith Packard <keithpac@amazon.com>,
	Russell King <linux@armlinux.org.uk>,
	 Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>,
	 Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v4 0/5] ARM: support THREAD_INFO_IN_TASK
Date: Tue, 14 Sep 2021 11:44:25 +0200	[thread overview]
Message-ID: <CAK8P3a2F+=j4bnw+A4k-Ks--Gc3FaB--pWaL5kvbhaxkin6iuw@mail.gmail.com> (raw)
In-Reply-To: <20210913104001.3043132-1-ardb@kernel.org>

On Mon, Sep 13, 2021 at 12:39 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Placing thread_info in the kernel stack leaves it vulnerable to stack
> overflow attacks. This short series addresses that by using the existing
> THREAD_INFO_IN_TASK infrastructure.
>
> This v4 is a follow-up to Keith's v3 [0], which did not address all
> concerns I raised in response to v2. After collaborating with Keith
> off-list, we decided that I should go ahead and post our joint v4.
>
> Changes since v3:
>
> - Leave the CPU field in thread_info, and keep it in sync at context
>   switch time. This is by far the easiest and cleanest way to work
>   around the fact that it is infeasible to implement
>   raw_smp_processor_id() in terms of task_struct::cpu (for reasons of
>   header soup).
>
> - Drop the VFP changes, they are no longer necessary given the previous
>   point.
>
> - Drop the change to pass the CPU number to secondary_start_kernel().
>   Given that we also need to pass the idle task pointer, which carries
>   the CPU number, passing the CPU number directly is redundant.
>
> - Use the TPIDRURO register to carry 'current' while running in the
>   kernel, and keep using TPIDRPRW for the per-CPU offset as before. This
>   way, there is no need to make any changes to the way the per-CPU offsets
>   are programmed. It also avoids the concurrency issues that would
>   result from carrying the 'current' pointer in a per-CPU variable.
>
> - Update the per-task stack protector plugin to pull the stack canary
>   value directly from the task struct.

I haven't looked in detail, but it all looks great to me so far.

On a related note, this reminds me of the CONFIG_IRQSTACK series
that was posted last year[1] and probably attempted before that.
I'd have to get back to understanding all the details of that discussion,
but I have some hope that adding irqstacks would become much
easier after your series. Any thoughts on that?

       Arnd

[1] https://lore.kernel.org/linux-arm-kernel/1602141333-17822-1-git-send-email-maninder1.s@samsung.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-09-14  9:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 10:39 [PATCH v4 0/5] ARM: support THREAD_INFO_IN_TASK Ard Biesheuvel
2021-09-13 10:39 ` [PATCH v4 1/5] gcc-plugins: arm-ssp: Prepare for THREAD_INFO_IN_TASK support Ard Biesheuvel
2021-09-13 15:40   ` Kees Cook
2021-09-14 22:04   ` Linus Walleij
2021-09-15  6:37     ` Ard Biesheuvel
2021-09-15 16:26       ` Kees Cook
2021-09-13 10:39 ` [PATCH v4 2/5] ARM: smp: Pass task to secondary_start_kernel Ard Biesheuvel
2021-09-13 23:25   ` Linus Walleij
2021-09-13 10:39 ` [PATCH v4 3/5] ARM: smp: Free up the TLS register while running in the kernel Ard Biesheuvel
2021-09-13 10:40 ` [PATCH v4 4/5] ARM: smp: Store current pointer in TPIDRURO register if available Ard Biesheuvel
2021-09-13 11:22   ` Russell King (Oracle)
2021-09-13 12:52     ` Ard Biesheuvel
2021-09-13 13:52       ` Russell King (Oracle)
2021-09-13 10:40 ` [PATCH v4 5/5] ARM: smp: Enable THREAD_INFO_IN_TASK Ard Biesheuvel
2021-09-13 11:23 ` [PATCH v4 0/5] ARM: support THREAD_INFO_IN_TASK Russell King (Oracle)
2021-09-13 15:40 ` Kees Cook
2021-09-14  9:44 ` Arnd Bergmann [this message]
2021-09-14  9:50   ` Ard Biesheuvel
2021-09-14 13:07     ` Arnd Bergmann
2021-09-14 17:10       ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a2F+=j4bnw+A4k-Ks--Gc3FaB--pWaL5kvbhaxkin6iuw@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=ardb@kernel.org \
    --cc=keescook@chromium.org \
    --cc=keithpac@amazon.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.