Subject: WARNING: ODEBUG bug in __do_softirq

From: syzbot <[email-masked]>
Date: Sat, 17 Feb 2018 00:15:01 -0800

Hello,

syzbot hit the following crash on bpf-next commit
0b6b8a3dd86db78c3f38587d667d77065c75e4f8 (Thu Feb 15 09:22:55 2018 +0000)
Merge branch 'bpf-misc-selftest-improvements'

So far this crash happened 2 times on bpf-next.
Unfortunately, I don't have any reproducer for this crash yet.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: [email-masked]
It will help syzbot understand when the bug is fixed. See footer for  
details.
If you forward the report, please keep this part and the footer.

------------[ cut here ]------------
ODEBUG: free active (active state 0) object type: timer_list hint:  
xprt_init_autodisconnect+0x0/0x230 net/sunrpc/xprt.c:185
WARNING: CPU: 1 PID: 11275 at lib/debugobjects.c:291  
debug_print_object+0x166/0x220 lib/debugobjects.c:288
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 11275 Comm: syz-executor1 Not tainted 4.16.0-rc1+ #14
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  <IRQ>
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  panic+0x1e4/0x41c kernel/panic.c:183
  __warn+0x1dc/0x200 kernel/panic.c:547
  report_bug+0x211/0x2d0 lib/bug.c:184
  fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
  fixup_bug arch/x86/kernel/traps.c:247 [inline]
  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
  invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:988
RIP: 0010:debug_print_object+0x166/0x220 lib/debugobjects.c:288
RSP: 0018:ffff8801db507738 EFLAGS: 00010086
RAX: dffffc0000000008 RBX: 0000000000000003 RCX: ffffffff815aaf3e
RDX: 0000000000000100 RSI: 1ffff1003b6a0e97 RDI: 1ffff1003b6a0e6c
RBP: ffff8801db507778 R08: ffffffff86b39478 R09: 1ffff1003b6a0e3e
R10: ffffed003b6a0f16 R11: ffffffff86b39478 R12: 0000000000000001
R13: ffffffff86b4ace0 R14: ffffffff86007c60 R15: ffffffff815fd9a0
  __debug_check_no_obj_freed lib/debugobjects.c:745 [inline]
  debug_check_no_obj_freed+0x662/0xf1f lib/debugobjects.c:774
  kfree+0xc7/0x260 mm/slab.c:3799
  __rcu_reclaim kernel/rcu/rcu.h:167 [inline]
  rcu_do_batch kernel/rcu/tree.c:2674 [inline]
  invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
  __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
  rcu_process_callbacks+0xe94/0x17f0 kernel/rcu/tree.c:2917
  __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
  invoke_softirq kernel/softirq.c:365 [inline]
  irq_exit+0x1cc/0x200 kernel/softirq.c:405
  exiting_irq arch/x86/include/asm/apic.h:541 [inline]
  smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052
  apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:829
  </IRQ>
RIP: 0010:lock_is_held include/linux/lockdep.h:344 [inline]
RIP: 0010:rcu_preempt_sleep_check include/linux/rcupdate.h:301 [inline]
RIP: 0010:___might_sleep+0x352/0x470 kernel/sched/core.c:6093
RSP: 0018:ffff8801aa91f620 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff12
RAX: 0000000000000001 RBX: 1ffff10035523ec4 RCX: ffffffff819dc122
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffff8801bbc309b4
RBP: ffff8801aa91f6a0 R08: 1ffff10035523e3e R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffffffff85f0db20 R14: 0000000000001205 R15: 00000000000001cb
  clear_huge_page+0xa5/0x730 mm/memory.c:4613
  __do_huge_pmd_anonymous_page mm/huge_memory.c:570 [inline]
  do_huge_pmd_anonymous_page+0x599/0x1b00 mm/huge_memory.c:728
  create_huge_pmd mm/memory.c:3870 [inline]
  __handle_mm_fault+0x1a0c/0x3ce0 mm/memory.c:4074
  handle_mm_fault+0x35c/0x970 mm/memory.c:4140
  __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1426
  do_page_fault+0xee/0x730 arch/x86/mm/fault.c:1501
  page_fault+0x4c/0x60 arch/x86/entry/entry_64.S:1155
RIP: 0033:0x406885
RSP: 002b:00007ffee571dfb0 EFLAGS: 00010246
RAX: 0000000020c1a000 RBX: 000000000071bea0 RCX: 0000000000000002
RDX: f766b619a5191905 RSI: 0000000000000000 RDI: 00000000024b1848
RBP: 0000000000000006 R08: 0000000000000000 R09: 00000000007200d0
R10: 00007ffee571dfb0 R11: 0000000000000246 R12: fffffffffffffffe
R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000001

======================================================
WARNING: possible circular locking dependency detected
4.16.0-rc1+ #14 Not tainted
------------------------------------------------------
syz-executor1/11275 is trying to acquire lock:
  ((console_sem).lock){-.-.}, at: [<000000006e70a183>]  
down_trylock+0x13/0x70 kernel/locking/semaphore.c:136

but task is already holding lock:
  (&obj_hash[i].lock){-.-.}, at: [<000000009e73f5cf>]  
__debug_check_no_obj_freed lib/debugobjects.c:736 [inline]
  (&obj_hash[i].lock){-.-.}, at: [<000000009e73f5cf>]  
debug_check_no_obj_freed+0x1e9/0xf1f lib/debugobjects.c:774

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (&obj_hash[i].lock){-.-.}:
        __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
        _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
        __debug_object_init+0x109/0x1040 lib/debugobjects.c:343
        debug_object_init+0x17/0x20 lib/debugobjects.c:391
        debug_hrtimer_init kernel/time/hrtimer.c:410 [inline]
        debug_init kernel/time/hrtimer.c:458 [inline]
        hrtimer_init+0x8c/0x410 kernel/time/hrtimer.c:1259
        init_dl_task_timer+0x1b/0x50 kernel/sched/deadline.c:1060
        __sched_fork+0x2bb/0xb60 kernel/sched/core.c:2189
        init_idle+0x75/0x820 kernel/sched/core.c:5347
        sched_init+0xb19/0xc43 kernel/sched/core.c:6044
        start_kernel+0x452/0x819 init/main.c:585
        x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:378
        x86_64_start_kernel+0x77/0x7a arch/x86/kernel/head64.c:359
        secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:237

-> #2 (&rq->lock){-.-.}:
        __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
        _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:144
        rq_lock kernel/sched/sched.h:1760 [inline]
        task_fork_fair+0x7a/0x690 kernel/sched/fair.c:9471
        sched_fork+0x450/0xc10 kernel/sched/core.c:2405
        copy_process.part.37+0x1758/0x4b60 kernel/fork.c:1774
        copy_process kernel/fork.c:1617 [inline]
        _do_fork+0x1f7/0xf70 kernel/fork.c:2098
        kernel_thread+0x34/0x40 kernel/fork.c:2157
        rest_init+0x22/0xf0 init/main.c:402
        start_kernel+0x7f1/0x819 init/main.c:716
        x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:378
        x86_64_start_kernel+0x77/0x7a arch/x86/kernel/head64.c:359
        secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:237

-> #1 (&p->pi_lock){-.-.}:
        __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
        _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
        try_to_wake_up+0xbc/0x15f0 kernel/sched/core.c:1989
        wake_up_process+0x10/0x20 kernel/sched/core.c:2152
        __up.isra.0+0x1cc/0x2c0 kernel/locking/semaphore.c:262
        up+0x13b/0x1d0 kernel/locking/semaphore.c:187
        __up_console_sem+0xb2/0x1a0 kernel/printk/printk.c:242
        console_unlock+0x5af/0xfb0 kernel/printk/printk.c:2417
        vprintk_emit+0x5c3/0xb90 kernel/printk/printk.c:1907
        vprintk_default+0x28/0x30 kernel/printk/printk.c:1947
        vprintk_func+0x57/0xc0 kernel/printk/printk_safe.c:379
        printk+0xaa/0xca kernel/printk/printk.c:1980
        kauditd_printk_skb kernel/audit.c:506 [inline]
        kauditd_hold_skb+0x163/0x180 kernel/audit.c:539
        kauditd_send_queue+0xfa/0x140 kernel/audit.c:702
        kauditd_thread+0x660/0x940 kernel/audit.c:828
        kthread+0x33c/0x400 kernel/kthread.c:238
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429

-> #0 ((console_sem).lock){-.-.}:
        lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920
        __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
        _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
        down_trylock+0x13/0x70 kernel/locking/semaphore.c:136
        __down_trylock_console_sem+0xa2/0x1e0 kernel/printk/printk.c:225
        console_trylock+0x15/0x70 kernel/printk/printk.c:2229
        console_trylock_spinning kernel/printk/printk.c:1643 [inline]
        vprintk_emit+0x5b5/0xb90 kernel/printk/printk.c:1906
        vprintk_default+0x28/0x30 kernel/printk/printk.c:1947
        vprintk_func+0x57/0xc0 kernel/printk/printk_safe.c:379
        printk+0xaa/0xca kernel/printk/printk.c:1980
        __warn_printk+0x90/0xf0 kernel/panic.c:599
        debug_print_object+0x166/0x220 lib/debugobjects.c:288
        __debug_check_no_obj_freed lib/debugobjects.c:745 [inline]
        debug_check_no_obj_freed+0x662/0xf1f lib/debugobjects.c:774
        kfree+0xc7/0x260 mm/slab.c:3799
        __rcu_reclaim kernel/rcu/rcu.h:167 [inline]
        rcu_do_batch kernel/rcu/tree.c:2674 [inline]
        invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
        __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
        rcu_process_callbacks+0xe94/0x17f0 kernel/rcu/tree.c:2917
        __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
        invoke_softirq kernel/softirq.c:365 [inline]
        irq_exit+0x1cc/0x200 kernel/softirq.c:405
        exiting_irq arch/x86/include/asm/apic.h:541 [inline]
        smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052
        apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:829
        lock_is_held include/linux/lockdep.h:344 [inline]
        rcu_preempt_sleep_check include/linux/rcupdate.h:301 [inline]
        ___might_sleep+0x352/0x470 kernel/sched/core.c:6093
        clear_huge_page+0xa5/0x730 mm/memory.c:4613
        __do_huge_pmd_anonymous_page mm/huge_memory.c:570 [inline]
        do_huge_pmd_anonymous_page+0x599/0x1b00 mm/huge_memory.c:728
        create_huge_pmd mm/memory.c:3870 [inline]
        __handle_mm_fault+0x1a0c/0x3ce0 mm/memory.c:4074
        handle_mm_fault+0x35c/0x970 mm/memory.c:4140
        __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1426
        do_page_fault+0xee/0x730 arch/x86/mm/fault.c:1501
        page_fault+0x4c/0x60 arch/x86/entry/entry_64.S:1155

other info that might help us debug this:

Chain exists of:
   (console_sem).lock --> &rq->lock --> &obj_hash[i].lock

  Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(&obj_hash[i].lock);
                                lock(&rq->lock);
                                lock(&obj_hash[i].lock);
   lock((console_sem).lock);

  *** DEADLOCK ***

3 locks held by syz-executor1/11275:
  #0:  (&mm->mmap_sem){++++}, at: [<00000000c7fa834f>]  
__do_page_fault+0x32d/0xc90 arch/x86/mm/fault.c:1355
  #1:  (rcu_callback){....}, at: [<00000000e199d59b>] __rcu_reclaim  
kernel/rcu/rcu.h:162 [inline]
  #1:  (rcu_callback){....}, at: [<00000000e199d59b>] rcu_do_batch  
kernel/rcu/tree.c:2674 [inline]
  #1:  (rcu_callback){....}, at: [<00000000e199d59b>] invoke_rcu_callbacks  
kernel/rcu/tree.c:2933 [inline]
  #1:  (rcu_callback){....}, at: [<00000000e199d59b>]  
__rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
  #1:  (rcu_callback){....}, at: [<00000000e199d59b>]  
rcu_process_callbacks+0xe57/0x17f0 kernel/rcu/tree.c:2917
  #2:  (&obj_hash[i].lock){-.-.}, at: [<000000009e73f5cf>]  
__debug_check_no_obj_freed lib/debugobjects.c:736 [inline]
  #2:  (&obj_hash[i].lock){-.-.}, at: [<000000009e73f5cf>]  
debug_check_no_obj_freed+0x1e9/0xf1f lib/debugobjects.c:774

stack backtrace:
CPU: 1 PID: 11275 Comm: syz-executor1 Not tainted 4.16.0-rc1+ #14
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  <IRQ>
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  print_circular_bug.isra.38+0x2cd/0x2dc kernel/locking/lockdep.c:1223
  check_prev_add kernel/locking/lockdep.c:1863 [inline]
  check_prevs_add kernel/locking/lockdep.c:1976 [inline]
  validate_chain kernel/locking/lockdep.c:2417 [inline]
  __lock_acquire+0x30a8/0x3e00 kernel/locking/lockdep.c:3431
  lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
  down_trylock+0x13/0x70 kernel/locking/semaphore.c:136
  __down_trylock_console_sem+0xa2/0x1e0 kernel/printk/printk.c:225
  console_trylock+0x15/0x70 kernel/printk/printk.c:2229
  console_trylock_spinning kernel/printk/printk.c:1643 [inline]
  vprintk_emit+0x5b5/0xb90 kernel/printk/printk.c:1906
  vprintk_default+0x28/0x30 kernel/printk/printk.c:1947
  vprintk_func+0x57/0xc0 kernel/printk/printk_safe.c:379
  printk+0xaa/0xca kernel/printk/printk.c:1980
  __warn_printk+0x90/0xf0 kernel/panic.c:599
  debug_print_object+0x166/0x220 lib/debugobjects.c:288
  __debug_check_no_obj_freed lib/debugobjects.c:745 [inline]
  debug_check_no_obj_freed+0x662/0xf1f lib/debugobjects.c:774
  kfree+0xc7/0x260 mm/slab.c:3799
  __rcu_reclaim kernel/rcu/rcu.h:167 [inline]
  rcu_do_batch kernel/rcu/tree.c:2674 [inline]
  invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
  __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
  rcu_process_callbacks+0xe94/0x17f0 kernel/rcu/tree.c:2917
  __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
  invoke_softirq kernel/softirq.c:365 [inline]
  irq_exit+0x1cc/0x200 kernel/softirq.c:405
  exiting_irq arch/x86/include/asm/apic.h:541 [inline]
  smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052
  apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:829
  </IRQ>
RIP: 0010:lock_is_held include/linux/lockdep.h:344 [inline]
RIP: 0010:rcu_preempt_sleep_check include/linux/rcupdate.h:301 [inline]
RIP: 0010:___might_sleep+0x352/0x470 kernel/sched/core.c:6093
RSP: 0018:ffff8801aa91f620 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff12
RAX: 0000000000000001 RBX: 1ffff10035523ec4 RCX: ffffffff819dc122
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffff8801bbc309b4
RBP: ffff8801aa91f6a0 R08: 1ffff10035523e3e R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffffffff85f0db20 R14: 0000000000001205 R15: 00000000000001cb
  clear_huge_page+0xa5/0x730 mm/memory.c:4613
  __do_huge_pmd_anonymous_page mm/huge_memory.c:570 [inline]
  do_huge_pmd_anonymous_page+0x599/0x1b00 mm/huge_memory.c:728
  ? lock_downgrade+0
Lost 42 message(s)!
Shutting down cpus with NMI
Dumping ftrace buffer:
    (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to [email-masked].

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is  
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.