Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136352
b: refs/heads/master
c: 18aa8bb
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Thomas Gleixner committed May 26, 2008
1 parent e17dafd commit fee4d4f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b5609fd773e6ac0b1d6d6e1bf68f32cca64e06b
refs/heads/master: 18aa8bb12dcb10adc3d7c9d69714d53667c0ab7f
6 changes: 2 additions & 4 deletions trunk/arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ 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 - and if we are the boot CPU we have
Expand All @@ -156,9 +155,8 @@ void cpu_idle(void)
* invalid canaries already on the stack wont ever
* trigger):
*/
current->stack_canary = get_random_int();
write_pda(stack_canary, current->stack_canary);
#endif
boot_init_stack_canary();

/* endless idle loop with no priority at all */
while (1) {
tick_nohz_stop_sched_tick();
Expand Down
20 changes: 20 additions & 0 deletions trunk/include/asm-x86/stackprotector.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#ifndef _ASM_STACKPROTECTOR_H
#define _ASM_STACKPROTECTOR_H 1

/*
* Initialize the stackprotector canary value.
*
* NOTE: this must only be called from functions that never return,
* and it must always be inlined.
*/
static __always_inline void boot_init_stack_canary(void)
{
/*
* If we're the non-boot CPU, nothing set the PDA stack
* canary up for us - and if we are the boot CPU we have
* a 0 stack canary. This is a good place for updating
* it, as we wont ever return from this function (so the
* invalid canaries already on the stack wont ever
* trigger):
*/
current->stack_canary = get_random_int();
write_pda(stack_canary, current->stack_canary);
}

#endif
4 changes: 4 additions & 0 deletions trunk/include/linux/stackprotector.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#ifdef CONFIG_CC_STACKPROTECTOR
# include <asm/stackprotector.h>
#else
static inline void boot_init_stack_canary(void)
{
}
#endif

#endif

0 comments on commit fee4d4f

Please sign in to comment.