From 635cb0ec9d6907803b9fbfc29872c38a44afe906 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 21 Dec 2016 18:25:53 +1100 Subject: stack: Don't recurse into __stack_chk_fail Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Stewart Smith (cherry picked from commit d7ffce9096d5a23ee4ff309910983d823e953bd2) Signed-off-by: Stewart Smith --- core/stack.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/stack.c b/core/stack.c index 3b92a14..17a4ca4 100644 --- a/core/stack.c +++ b/core/stack.c @@ -112,9 +112,14 @@ void backtrace(void) __print_backtrace(mfspr(SPR_PIR), bt_buf, ents, NULL, NULL, true); } -void __noreturn __nomcount __stack_chk_fail(void); -void __noreturn __nomcount __stack_chk_fail(void) +void __nomcount __stack_chk_fail(void); +void __nomcount __stack_chk_fail(void) { + static bool failed_once; + + if (failed_once) + return; + failed_once = true; prlog(PR_EMERG, "Stack corruption detected !\n"); abort(); } -- cgit v1.1