lkml.org 
[lkml]   [2016]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 49/51] x86/dumpstack: warn on stack recursion
    Date
    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>
    ---
    arch/x86/kernel/dumpstack_32.c | 5 ++++-
    arch/x86/kernel/dumpstack_64.c | 5 ++++-
    2 files changed, 8 insertions(+), 2 deletions(-)

    diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
    index 53d939e..cbbef0e 100644
    --- a/arch/x86/kernel/dumpstack_32.c
    +++ b/arch/x86/kernel/dumpstack_32.c
    @@ -101,8 +101,11 @@ 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;
    }

    diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
    index 001a75d..36581f9 100644
    --- a/arch/x86/kernel/dumpstack_64.c
    +++ b/arch/x86/kernel/dumpstack_64.c
    @@ -125,8 +125,11 @@ 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;
    }

    --
    2.7.4
    \
     
     \ /
      Last update: 2016-09-17 09:56    [W:2.855 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site