Skip to content

Commit

Permalink
x86: setup stack canary for the idle threads
Browse files Browse the repository at this point in the history
The idle threads for non-boot CPUs are a bit special in how they
are created; the result is that these don't have the stack canary
set up properly in their PDA. Easiest fix is to just always set
the PDA up correctly when entering the idle thread; this is a NOP
for the boot cpu.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Arjan van de Ven authored and Thomas Gleixner committed May 26, 2008
1 parent e003208 commit ce22bd9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ static inline void play_dead(void)
void cpu_idle(void)
{
current_thread_info()->status |= TS_POLLING;

#ifdef CONFIG_CC_STACKPROTECTOR
/*
* If we're the non-boot CPU, nothing set the PDA stack
* canary up for us. This is as good a place as any for
* doing that.
*/
write_pda(stack_canary, current->stack_canary);
#endif
/* endless idle loop with no priority at all */
while (1) {
tick_nohz_stop_sched_tick();
Expand Down

0 comments on commit ce22bd9

Please sign in to comment.