All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct
@ 2018-09-19 11:14 Christophe Leroy
  2018-09-19 11:14 ` [PATCH v2 2/2] powerpc/32: add stack protector support Christophe Leroy
  2018-09-19 11:58 ` [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct Peter Zijlstra
  0 siblings, 2 replies; 10+ messages in thread
From: Christophe Leroy @ 2018-09-19 11:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Ingo Molnar, Peter Zijlstra, segher
  Cc: linux-kernel, linuxppc-dev

In order to allow the use of non global stack protector canary,
the stack canary needs to be located at a know offset defined
in Makefile via -mstack-protector-guard-offset.

On powerpc/32, register r2 points to current task_struct at
all time, the stack_canary located inside task_struct can be
used directly if it is located in a known place.

In order to allow that, this patch moves the stack_canary field
out of the randomized area of task_struct.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 include/linux/sched.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 977cb57d7bc9..1d977b8a4bac 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -601,6 +601,10 @@ struct task_struct {
 	/* -1 unrunnable, 0 runnable, >0 stopped: */
 	volatile long			state;
 
+#ifdef CONFIG_STACKPROTECTOR
+	/* Canary value for the -fstack-protector GCC feature: */
+	unsigned long			stack_canary;
+#endif
 	/*
 	 * This begins the randomizable portion of task_struct. Only
 	 * scheduling-critical items should be added above here.
@@ -746,10 +750,6 @@ struct task_struct {
 	pid_t				pid;
 	pid_t				tgid;
 
-#ifdef CONFIG_STACKPROTECTOR
-	/* Canary value for the -fstack-protector GCC feature: */
-	unsigned long			stack_canary;
-#endif
 	/*
 	 * Pointers to the (original) parent process, youngest child, younger sibling,
 	 * older sibling, respectively.  (p->father can be replaced with
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-19 23:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 11:14 [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct Christophe Leroy
2018-09-19 11:14 ` [PATCH v2 2/2] powerpc/32: add stack protector support Christophe Leroy
2018-09-19 13:26   ` Segher Boessenkool
2018-09-19 14:22     ` Christophe LEROY
2018-09-19 14:32       ` Segher Boessenkool
2018-09-19 11:58 ` [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct Peter Zijlstra
2018-09-19 12:25   ` Christophe LEROY
2018-09-19 12:52     ` Peter Zijlstra
2018-09-19 23:54     ` Michael Ellerman
2018-09-19 23:54       ` Michael Ellerman

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.