aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2019-03-26 18:31:29 +0100
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2019-07-11 17:28:20 +0200
commit9d47527056604df07d10051f609f5af10aa814ac (patch)
treec653b4dc188565056a0e93fd24dedf862dcfabb4
parent49a6b8cf105772ec268d410121abbbceeaf73b87 (diff)
downloadlinux-rt-devel-9d47527056604df07d10051f609f5af10aa814ac.tar.gz
powerpc/stackprotector: work around stack-guard init from atomic
This is invoked from the secondary CPU in atomic context. On x86 we use tsc instead. On Power we XOR it against mftb() so lets use stack address as the initial value. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-rw-r--r--arch/powerpc/include/asm/stackprotector.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h
index 1c8460e235838c..e764eb4b6c2843 100644
--- a/arch/powerpc/include/asm/stackprotector.h
+++ b/arch/powerpc/include/asm/stackprotector.h
@@ -24,7 +24,11 @@ static __always_inline void boot_init_stack_canary(void)
unsigned long canary;
/* Try to get a semi random initial value. */
+#ifdef CONFIG_PREEMPT_RT_FULL
+ canary = (unsigned long)&canary;
+#else
canary = get_random_canary();
+#endif
canary ^= mftb();
canary ^= LINUX_VERSION_CODE;
canary &= CANARY_MASK;