Skip to content

Commit

Permalink
powerpc/stackprotector: work around stack-guard init from atomic
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Andrzej Siewior committed Sep 13, 2021
1 parent aed2b86 commit 95aacd7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/include/asm/stackprotector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 95aacd7

Please sign in to comment.