syzbot


general protection fault in debug_check_no_obj_freed

Status: closed as invalid on 2018/07/17 14:23
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+fb828c6152023b75a42b@syzkaller.appspotmail.com
First crash: 2221d, last: 2218d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in debug_check_no_obj_freed (2) mm 1 2004d 2003d 0/26 auto-closed as invalid on 2019/04/26 09:49
linux-4.19 general protection fault in debug_check_no_obj_freed (2) 2 832d 937d 0/1 auto-closed as invalid on 2022/05/11 17:22
upstream general protection fault in debug_check_no_obj_freed (7) fs batman 3 302d 349d 0/26 auto-obsoleted due to no activity on 2023/09/24 06:05
linux-4.19 general protection fault in debug_check_no_obj_freed 1 1322d 1322d 0/1 auto-closed as invalid on 2021/01/06 22:10
upstream general protection fault in debug_check_no_obj_freed (4) net 1 1094d 1088d 0/26 auto-closed as invalid on 2021/06/24 04:15
upstream general protection fault in debug_check_no_obj_freed (5) kvm 4 990d 1010d 0/26 auto-closed as invalid on 2021/11/05 02:52
upstream general protection fault in debug_check_no_obj_freed (6) tomoyo 2 897d 895d 0/26 auto-closed as invalid on 2022/02/06 02:57
upstream general protection fault in debug_check_no_obj_freed (3) mm 7 1299d 1310d 0/26 auto-closed as invalid on 2021/01/30 14:32

Sample crash report:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
kasan: CONFIG_KASAN_INLINE enabled
general protection fault: 0000 [#1] SMP KASAN
kasan: GPF could be caused by NULL-ptr deref or user memory access
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 6842 Comm: syz-executor6 Not tainted 4.16.0-rc6+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__debug_check_no_obj_freed lib/debugobjects.c:737 [inline]
RIP: 0010:debug_check_no_obj_freed+0x239/0xf1f lib/debugobjects.c:774
RSP: 0018:ffff88016ec46fc8 EFLAGS: 00010002
RAX: 0000000000000009 RBX: 078e0401078e0401 RCX: 0000000000000082
RDX: 00f1c08020f1c080 RSI: 1ffff10032698561 RDI: ffff8801934c2b08
RBP: ffff88016ec47198 R08: 1ffff1002dd88d37 R09: ffff8801cf4c8ca0
R10: ffffed002dd88e1e R11: ffff8801cf4c8d68 R12: ffffed002dd88e0e
R13: ffff88016ec47170 R14: 078e0401078e0401 R15: dffffc0000000000
FS:  00007f126fd20700(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd936d15db8 CR3: 0000000006e22003 CR4: 00000000001606e0
DR0: 0000000020000000 DR1: 0000000020000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
 kmem_cache_free+0x24c/0x2a0 mm/slab.c:3742
 remove_vma+0x162/0x1b0 mm/mmap.c:176
 exit_mmap+0x311/0x500 mm/mmap.c:3049
 __mmput kernel/fork.c:960 [inline]
 mmput+0x223/0x6d0 kernel/fork.c:981
 exit_mm kernel/exit.c:544 [inline]
 do_exit+0x90a/0x1ad0 kernel/exit.c:852
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x454879
RSP: 002b:00007f126fd1fce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000072bf80 RCX: 0000000000454879
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000072bf80
RBP: 000000000072bf80 R08: 0000000000000000 R09: 000000000072bf58
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd49a7a50f R14: 00007f126fd209c0 R15: 0000000000000001
Code: 4d 85 f6 0f 84 d7 04 00 00 4d 8d 55 80 4c 8b 9d 80 fe ff ff 4c 8b 8d 88 fe ff ff 31 c0 49 c1 ea 03 4d 01 fa 4c 89 f2 48 c1 ea 03 <42> 80 3c 3a 00 0f 85 06 05 00 00 49 8d 7e 18 83 c0 01 49 8b 16 
RIP: __debug_check_no_obj_freed lib/debugobjects.c:737 [inline] RSP: ffff88016ec46fc8
RIP: debug_check_no_obj_freed+0x239/0xf1f lib/debugobjects.c:774 RSP: ffff88016ec46fc8

======================================================
WARNING: possible circular locking dependency detected
4.16.0-rc6+ #1 Not tainted
------------------------------------------------------
syz-executor6/6842 is trying to acquire lock:
 ((console_sem).lock){-.-.}, at: [<00000000936a11ae>] down_trylock+0x13/0x70 kernel/locking/semaphore.c:136

but task is already holding lock:
 (&obj_hash[i].lock){-.-.}, at: [<000000001e00f428>] __debug_check_no_obj_freed lib/debugobjects.c:736 [inline]
 (&obj_hash[i].lock){-.-.}, at: [<000000001e00f428>] 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:5352
       sched_init+0xb19/0xc43 kernel/sched/core.c:6049
       start_kernel+0x452/0x819 init/main.c:586
       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:239

-> #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.38+0x1758/0x4b60 kernel/fork.c:1763
       copy_process kernel/fork.c:1606 [inline]
       _do_fork+0x1f7/0xf70 kernel/fork.c:2087
       kernel_thread+0x34/0x40 kernel/fork.c:2146
       rest_init+0x22/0xf0 init/main.c:403
       start_kernel+0x7f1/0x819 init/main.c:717
       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:239

-> #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
       con_flush_chars+0x6e/0x80 drivers/tty/vt/vt.c:2863
       n_tty_write+0x71b/0xec0 drivers/tty/n_tty.c:2325
       do_tty_write drivers/tty/tty_io.c:958 [inline]
       tty_write+0x3fa/0x840 drivers/tty/tty_io.c:1042
       __vfs_write+0xef/0x970 fs/read_write.c:480
       vfs_write+0x189/0x510 fs/read_write.c:544
       SYSC_write fs/read_write.c:589 [inline]
       SyS_write+0xef/0x220 fs/read_write.c:581
       do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

-> #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
       kasan_die_handler+0x31/0x3f arch/x86/mm/kasan_init_64.c:247
       notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93
       __atomic_notifier_call_chain kernel/notifier.c:183 [inline]
       atomic_notifier_call_chain+0x77/0x140 kernel/notifier.c:193
       notify_die+0x18c/0x280 kernel/notifier.c:549
       do_general_protection+0x331/0x3e0 arch/x86/kernel/traps.c:558
       general_protection+0x25/0x50 arch/x86/entry/entry_64.S:1150
       __debug_check_no_obj_freed lib/debugobjects.c:737 [inline]
       debug_check_no_obj_freed+0x239/0xf1f lib/debugobjects.c:774
       kmem_cache_free+0x24c/0x2a0 mm/slab.c:3742
       remove_vma+0x162/0x1b0 mm/mmap.c:176
       exit_mmap+0x311/0x500 mm/mmap.c:3049
       __mmput kernel/fork.c:960 [inline]
       mmput+0x223/0x6d0 kernel/fork.c:981
       exit_mm kernel/exit.c:544 [inline]
       do_exit+0x90a/0x1ad0 kernel/exit.c:852
       do_group_exit+0x149/0x400 kernel/exit.c:968
       get_signal+0x73a/0x16d0 kernel/signal.c:2469
       do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
       exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
       prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
       do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

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 ***

2 locks held by syz-executor6/6842:
 #0:  (&obj_hash[i].lock){-.-.}, at: [<000000001e00f428>] __debug_check_no_obj_freed lib/debugobjects.c:736 [inline]
 #0:  (&obj_hash[i].lock){-.-.}, at: [<000000001e00f428>] debug_check_no_obj_freed+0x1e9/0xf1f lib/debugobjects.c:774
 #1:  (rcu_read_lock){....}, at: [<000000008e0e18fc>] rcu_read_unlock include/linux/rcupdate.h:682 [inline]
 #1:  (rcu_read_lock){....}, at: [<000000008e0e18fc>] atomic_notifier_call_chain+0x0/0x140 kernel/notifier.c:184

stack backtrace:
CPU: 1 PID: 6842 Comm: syz-executor6 Not tainted 4.16.0-rc6+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x24d 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
 kasan_die_handler+0x31/0x3f arch/x86/mm/kasan_init_64.c:247
 notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93
 __atomic_notifier_call_chain kernel/notifier.c:183 [inline]
 atomic_notifier_call_chain+0x77/0x140 kernel/notifier.c:193
 notify_die+0x18c/0x280 kernel/notifier.c:549
 do_general_protection+0x331/0x3e0 arch/x86/kernel/traps.c:558
 general_protection+0x25/0x50 arch/x86/entry/entry_64.S:1150
RIP: 0010:__debug_check_no_obj_freed lib/debugobjects.c:737 [inline]
RIP: 0010:debug_check_no_obj_freed+0x239/0xf1f lib/debugobjects.c:774
RSP: 0018:ffff88016ec46fc8 EFLAGS: 00010002
RAX: 0000000000000009 RBX: 078e0401078e0401 RCX: 0000000000000082
RDX: 00f1c08020f1c080 RSI: 1ffff10032698561 RDI: ffff8801934c2b08
RBP: ffff88016ec47198 R08: 1ffff1002dd88d37 R09: ffff8801cf4c8ca0
R10: ffffed002dd88e1e R11: ffff8801cf4c8d68 R12: ffffed002dd88e0e
R13: ffff88016ec47170 R14: 078e0401078e0401 R15: dffffc0000000000
 kmem_cache_free+0x24c/0x2a0 mm/slab.c:3742
 remove_vma+0x162/0x1b0 mm/mmap.c:176
 exit_mmap+0x311/0x500 mm/mmap.c:3049
 __mmput kernel/fork.c:960 [inline]
 mmput+0x223/0x6d0 kernel/fork.c:981
 exit_mm kernel/exit.c:544 [inline]
 do_exit+0x90a/0x1ad0 kernel/exit.c:852
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 ? do_syscall
Lost 18 message(s)!
---[ end trace a5be101c0e3795fb ]---
general protection fault: 0000 [#2] SMP KASAN
Dumping ftrace buffer:

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/25 15:30 upstream bcfc1f455466 e033c1f1 .config console log report ci-upstream-kasan-gce-root
2018/03/27 21:53 upstream 3eb2ce825ea1 bf5e585c .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.