-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stackprotector: add boot_init_stack_canary()
add the boot_init_stack_canary() and make the secondary idle threads use it. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
- Loading branch information
Ingo Molnar
authored and
Thomas Gleixner
committed
May 26, 2008
1 parent
9b5609f
commit 18aa8bb
Showing
3 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters