• Steven Rostedt's avatar
    lockdep, x86: account for irqs enabled in paranoid_exit · 0300e7f1
    Steven Rostedt authored
    I hit the check_flags error of lockdep:
    
     WARNING: at kernel/lockdep.c:2893 check_flags+0x1a7/0x1d0()
     [...]
     hardirqs last  enabled at (12567): [<ffffffff8026206a>] local_bh_enable+0xaa/0x110
     hardirqs last disabled at (12569): [<ffffffff80610c76>] int3+0x16/0x40
     softirqs last  enabled at (12566): [<ffffffff80514d2b>] lock_sock_nested+0xfb/0x110
     softirqs last disabled at (12568): [<ffffffff8058454e>] tcp_prequeue_process+0x2e/0xa0
    
    The check_flags warning of lockdep tells me that lockdep thought interrupts
    were disabled, but they were really enabled.
    
    The numbers in the above parenthesis show the order of events:
    
     12566: softirqs last enabled:  lock_sock_nested
     12567: hardirqs last enabled:  local_bh_enable
     12568: softirqs last disabled: tcp_prequeue_process
     12566: hardirqs last disabled: int3
    
    int3 is a breakpoint!
    
    Examining this further, I have CONFIG_NET_TCPPROBE enabled which adds
    break points into the kernel.
    
    The paranoid_exit of the return of int3 does not account for enabling
    interrupts on return to kernel. This code is a bit tricky since it
    is also used by the nmi handler (when lockdep is off), and we must be
    careful about the swapgs. We can not call kernel code after the swapgs
    has been performed.
    
    [ Impact: fix lockdep check_flags warning + self-turn-off ]
    Acked-by: default avatarPeter Zijlsta <a.p.zijlstra@chello.nl>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    0300e7f1
entry_64.S 38.3 KB