x86/dumpstack: Warn on stack recursion
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 26 Oct 2016 15:41:50 +0000 (10:41 -0500)
committerIngo Molnar <mingo@kernel.org>
Thu, 27 Oct 2016 06:32:38 +0000 (08:32 +0200)
Print a warning if stack recursion is detected.

Use printk_deferred_once() because the unwinder can be called with the
console lock by lockdep via save_stack_trace().

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/def18247aafaab480844484398e793f552b79bda.1477496147.git.jpoimboe@redhat.com
[ Unbroke the lines. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c

index 90cf460d50bd3605a7e80e12f1b435b86d6a1d5c..d7d20999d68cbc17429a08e70229f419b899df0f 100644 (file)
@@ -109,8 +109,10 @@ recursion_check:
         * just break out and report an unknown stack type.
         */
        if (visit_mask) {
-               if (*visit_mask & (1UL << info->type))
+               if (*visit_mask & (1UL << info->type)) {
+                       printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type);
                        goto unknown;
+               }
                *visit_mask |= 1UL << info->type;
        }
 
index 310abf4542dcce10630eb64cd102bcb8ef802d5b..ab0f8b90b51b6d889cc27f77f859514c15923f69 100644 (file)
@@ -128,8 +128,10 @@ recursion_check:
         * just break out and report an unknown stack type.
         */
        if (visit_mask) {
-               if (*visit_mask & (1UL << info->type))
+               if (*visit_mask & (1UL << info->type)) {
+                       printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type);
                        goto unknown;
+               }
                *visit_mask |= 1UL << info->type;
        }