Re: [PATCH v3] ARM: smp: add support for per-task stack canaries

From
Guenter Roeck <linux@roeck-us.net>
Date
2020-03-09 16:49:35
Also in
lkml
Reply to
Ard Biesheuvel, 2018-12-06
On Thu, Dec 06, 2018 at 09:32:57AM +0100, Ard Biesheuvel wrote:
On ARM, we currently only change the value of the stack canary when
switching tasks if the kernel was built for UP. On SMP kernels, this
is impossible since the stack canary value is obtained via a global
symbol reference, which means
a) all running tasks on all CPUs must use the same value
b) we can only modify the value when no kernel stack frames are live
   on any CPU, which is effectively never.

So instead, use a GCC plugin to add a RTL pass that replaces each
reference to the address of the __stack_chk_guard symbol with an
expression that produces the address of the 'stack_canary' field
that is added to struct thread_info. This way, each task will use
its own randomized value.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Kees Cook <redacted>
Cc: Emese Revfy <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Laura Abbott <redacted>
Cc: <redacted>
Acked-by: Nicolas Pitre <redacted>
Signed-off-by: Ard Biesheuvel <redacted>
Since this patch is in the tree, cc-option no longer works on
the arm architecture if CONFIG_STACKPROTECTOR_PER_TASK is enabled.

Any idea how to fix that ? 

Thanks,
Guenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (12 messages) 12 messages, 6 authors, last reply 2020-03-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help