diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2019-03-26 20:31:29 +0300 |
---|---|---|
committer | Minda Chen <minda.chen@starfivetech.com> | 2023-11-06 14:24:53 +0300 |
commit | 6156a09a45d7fbacc22f5380ed2bbc35de718602 (patch) | |
tree | a146701b244181d1a093f86dd0793cd7172d8688 | |
parent | e5786f65d0ad1855d6f53760c5720d9524838e80 (diff) | |
download | linux-6156a09a45d7fbacc22f5380ed2bbc35de718602.tar.xz |
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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/powerpc/include/asm/stackprotector.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h index 1c8460e23583..b1653c160bab 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 + canary = (unsigned long)&canary; +#else canary = get_random_canary(); +#endif canary ^= mftb(); canary ^= LINUX_VERSION_CODE; canary &= CANARY_MASK; |