diff options
| author | Arjan van de Ven <arjan@linux.intel.com> | 2006-09-26 04:52:39 -0400 |
|---|---|---|
| committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:39 -0400 |
| commit | 3162f751d04086a9d006342de63ac8f44fe0f72a (patch) | |
| tree | be702f29e5604621898e394ef387c2617334bb65 /kernel | |
| parent | 0a4254058037eb172758961d0a5b94f4320a1425 (diff) | |
[PATCH] Add the __stack_chk_fail() function
GCC emits a call to a __stack_chk_fail() function when the stack canary is
not matching the expected value.
Since this is a bad security issue; lets panic the kernel rather than limping
along; the kernel really can't be trusted anymore when this happens.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andi Kleen <ak@suse.de>
CC: Andi Kleen <ak@suse.de>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/panic.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index d2db3e2209e0..6ceb664fb52a 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
| @@ -271,3 +271,15 @@ void oops_exit(void) | |||
| 271 | { | 271 | { |
| 272 | do_oops_enter_exit(); | 272 | do_oops_enter_exit(); |
| 273 | } | 273 | } |
| 274 | |||
| 275 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
| 276 | /* | ||
| 277 | * Called when gcc's -fstack-protector feature is used, and | ||
| 278 | * gcc detects corruption of the on-stack canary value | ||
| 279 | */ | ||
| 280 | void __stack_chk_fail(void) | ||
| 281 | { | ||
| 282 | panic("stack-protector: Kernel stack is corrupted"); | ||
| 283 | } | ||
| 284 | EXPORT_SYMBOL(__stack_chk_fail); | ||
| 285 | #endif | ||
