diff options
Diffstat (limited to 'kernel/panic.c')
-rw-r--r-- | kernel/panic.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index 6729e3f4ebcb..28153aec7100 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -347,22 +347,18 @@ static noinline void __stack_chk_test_func(void) | |||
347 | if ((unsigned long)__builtin_return_address(0) == | 347 | if ((unsigned long)__builtin_return_address(0) == |
348 | *(((unsigned long *)&foo)+1)) { | 348 | *(((unsigned long *)&foo)+1)) { |
349 | printk(KERN_ERR "No -fstack-protector-stack-frame!\n"); | 349 | printk(KERN_ERR "No -fstack-protector-stack-frame!\n"); |
350 | return; | ||
351 | } | 350 | } |
352 | #ifdef CONFIG_FRAME_POINTER | 351 | #ifdef CONFIG_FRAME_POINTER |
353 | /* We also don't want to clobber the frame pointer */ | 352 | /* We also don't want to clobber the frame pointer */ |
354 | if ((unsigned long)__builtin_return_address(0) == | 353 | if ((unsigned long)__builtin_return_address(0) == |
355 | *(((unsigned long *)&foo)+2)) { | 354 | *(((unsigned long *)&foo)+2)) { |
356 | printk(KERN_ERR "No -fstack-protector-stack-frame!\n"); | 355 | printk(KERN_ERR "No -fstack-protector-stack-frame!\n"); |
357 | return; | ||
358 | } | 356 | } |
359 | #endif | 357 | #endif |
360 | barrier(); | 358 | if (current->stack_canary != *(((unsigned long *)&foo)+1)) |
361 | if (current->stack_canary == *(((unsigned long *)&foo)+1)) | ||
362 | *(((unsigned long *)&foo)+1) = 0; | ||
363 | else | ||
364 | printk(KERN_ERR "No -fstack-protector canary found\n"); | 359 | printk(KERN_ERR "No -fstack-protector canary found\n"); |
365 | barrier(); | 360 | |
361 | current->stack_canary = ~current->stack_canary; | ||
366 | } | 362 | } |
367 | 363 | ||
368 | static int __stack_chk_test(void) | 364 | static int __stack_chk_test(void) |
@@ -373,7 +369,8 @@ static int __stack_chk_test(void) | |||
373 | if (__stack_check_testing) { | 369 | if (__stack_check_testing) { |
374 | printk(KERN_ERR "-fstack-protector-all test failed\n"); | 370 | printk(KERN_ERR "-fstack-protector-all test failed\n"); |
375 | WARN_ON(1); | 371 | WARN_ON(1); |
376 | } | 372 | }; |
373 | current->stack_canary = ~current->stack_canary; | ||
377 | return 0; | 374 | return 0; |
378 | } | 375 | } |
379 | /* | 376 | /* |