syzbot


possible deadlock in debug_check_no_obj_freed (2)

Status: upstream: reported on 2025/05/26 13:49
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+84186930788ce222de35@syzkaller.appspotmail.com
First crash: 7d21h, last: 2d07h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [serial?] possible deadlock in debug_check_no_obj_freed (2) 0 (1) 2025/05/26 13:49
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in debug_check_no_obj_freed bpf 1 227d 223d 0/28 auto-obsoleted due to no activity on 2025/01/22 14:24
linux-6.1 possible deadlock in debug_check_no_obj_freed 1 96d 96d 0/3 upstream: reported on 2025/02/22 22:49

Sample crash report:
ODEBUG: object ffffc90003077c30 is on stack ffffc90003070000, but NOT annotated.
======================================================
WARNING: possible circular locking dependency detected
6.15.0-syzkaller-01972-g914873bc7df9 #0 Not tainted
------------------------------------------------------
bch-copygc/loop/11139 is trying to acquire lock:
ffffffff8e130b60 (console_owner){-.-.}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:2048 [inline]
ffffffff8e130b60 (console_owner){-.-.}-{0:0}, at: vprintk_emit+0x444/0x7a0 kernel/printk/printk.c:2449

but task is already holding lock:
ffffffff99d1bea0 (&obj_hash[i].lock){-.-.}-{2:2}, at: __debug_object_init+0x85/0x3c0 lib/debugobjects.c:741

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&obj_hash[i].lock){-.-.}-{2:2}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xa7/0xf0 kernel/locking/spinlock.c:162
       __debug_check_no_obj_freed lib/debugobjects.c:1088 [inline]
       debug_check_no_obj_freed+0x17a/0x470 lib/debugobjects.c:1129
       free_pages_prepare mm/page_alloc.c:1265 [inline]
       __free_frozen_pages+0x509/0xe50 mm/page_alloc.c:2721
       stack_depot_save_flags+0x445/0x900 lib/stackdepot.c:678
       kasan_save_stack mm/kasan/common.c:48 [inline]
       kasan_save_track+0x4f/0x80 mm/kasan/common.c:68
       poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
       __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394
       kasan_kmalloc include/linux/kasan.h:260 [inline]
       __do_kmalloc_node mm/slub.c:4327 [inline]
       __kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4339
       kmalloc_noprof include/linux/slab.h:909 [inline]
       tty_buffer_alloc drivers/tty/tty_buffer.c:180 [inline]
       __tty_buffer_request_room+0x1c8/0x520 drivers/tty/tty_buffer.c:273
       __tty_insert_flip_string_flags+0xb8/0x430 drivers/tty/tty_buffer.c:309
       tty_insert_flip_string_fixed_flag include/linux/tty_flip.h:35 [inline]
       tty_insert_flip_string include/linux/tty_flip.h:83 [inline]
       tty_insert_flip_string_and_push_buffer+0xa3/0x1f0 drivers/tty/tty_buffer.c:559
       pty_write+0xa7/0xe0 drivers/tty/pty.c:118
       tty_put_char+0x111/0x160 drivers/tty/tty_io.c:3167
       n_tty_process_echo_ops drivers/tty/n_tty.c:647 [inline]
       __process_echoes+0x40a/0xa20 drivers/tty/n_tty.c:693
       commit_echoes drivers/tty/n_tty.c:756 [inline]
       n_tty_receive_char+0x89e/0xc30 drivers/tty/n_tty.c:1421
       n_tty_receive_buf_standard+0x5e2/0x5150 drivers/tty/n_tty.c:1590
       __receive_buf drivers/tty/n_tty.c:1624 [inline]
       n_tty_receive_buf_common+0xab3/0x12f0 drivers/tty/n_tty.c:1723
       tty_port_default_receive_buf+0x6e/0xa0 drivers/tty/tty_port.c:37
       receive_buf drivers/tty/tty_buffer.c:445 [inline]
       flush_to_ldisc+0x2c5/0x810 drivers/tty/tty_buffer.c:495
       process_one_work kernel/workqueue.c:3238 [inline]
       process_scheduled_works+0xade/0x17a0 kernel/workqueue.c:3319
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
       kthread+0x711/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x4e/0x80 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #2 (&port->lock#2){-.-.}-{3:3}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xa7/0xf0 kernel/locking/spinlock.c:162
       tty_port_tty_get drivers/tty/tty_port.c:327 [inline]
       tty_port_default_wakeup+0x21/0xf0 drivers/tty/tty_port.c:66
       serial8250_tx_chars+0x72e/0x970 drivers/tty/serial/8250/8250_port.c:1842
       serial8250_handle_irq+0x633/0xbb0 drivers/tty/serial/8250/8250_port.c:1950
       serial8250_default_handle_irq+0xbf/0x1b0 drivers/tty/serial/8250/8250_port.c:1970
       serial8250_interrupt+0xa5/0x1d0 drivers/tty/serial/8250/8250_core.c:86
       __handle_irq_event_percpu+0x28c/0x980 kernel/irq/handle.c:158
       handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
       handle_irq_event+0x8b/0x1e0 kernel/irq/handle.c:210
       handle_edge_irq+0x24d/0xb60 kernel/irq/chip.c:831
       generic_handle_irq_desc include/linux/irqdesc.h:173 [inline]
       handle_irq arch/x86/kernel/irq.c:254 [inline]
       call_irq_handler arch/x86/kernel/irq.c:266 [inline]
       __common_interrupt+0x143/0x250 arch/x86/kernel/irq.c:292
       common_interrupt+0xb6/0xe0 arch/x86/kernel/irq.c:285
       asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
       native_irq_enable arch/x86/include/asm/irqflags.h:42 [inline]
       arch_local_irq_enable arch/x86/include/asm/irqflags.h:119 [inline]
       raw_spin_rq_unlock_irq kernel/sched/sched.h:1544 [inline]
       finish_lock_switch kernel/sched/core.c:5140 [inline]
       finish_task_switch+0x26b/0x950 kernel/sched/core.c:5258
       context_switch kernel/sched/core.c:5395 [inline]
       __schedule+0x16fd/0x4d00 kernel/sched/core.c:6781
       schedule_idle+0x52/0x90 kernel/sched/core.c:6900
       do_idle+0x4ad/0x510 kernel/sched/idle.c:353
       cpu_startup_entry+0x44/0x60 kernel/sched/idle.c:423
       start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:315
       common_startup_64+0x13e/0x147

-> #1 (&port_lock_key){-.-.}-{3:3}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xa7/0xf0 kernel/locking/spinlock.c:162
       uart_port_lock_irqsave include/linux/serial_core.h:715 [inline]
       serial8250_console_write+0x17e/0x1ba0 drivers/tty/serial/8250/8250_port.c:3415
       console_emit_next_record kernel/printk/printk.c:3138 [inline]
       console_flush_all+0x728/0xc40 kernel/printk/printk.c:3226
       __console_flush_and_unlock kernel/printk/printk.c:3285 [inline]
       console_unlock+0xc4/0x270 kernel/printk/printk.c:3325
       vprintk_emit+0x5b7/0x7a0 kernel/printk/printk.c:2450
       _printk+0xcf/0x120 kernel/printk/printk.c:2475
       register_console+0xa8b/0xf90 kernel/printk/printk.c:4125
       univ8250_console_init+0x52/0x90 drivers/tty/serial/8250/8250_core.c:513
       console_init+0x1a1/0x670 kernel/printk/printk.c:4323
       start_kernel+0x2cc/0x500 init/main.c:1034
       x86_64_start_reservations+0x24/0x30 arch/x86/kernel/head64.c:307
       x86_64_start_kernel+0x143/0x1c0 arch/x86/kernel/head64.c:288
       common_startup_64+0x13e/0x147

-> #0 (console_owner){-.-.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3168 [inline]
       check_prevs_add kernel/locking/lockdep.c:3287 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       console_trylock_spinning kernel/printk/printk.c:2048 [inline]
       vprintk_emit+0x460/0x7a0 kernel/printk/printk.c:2449
       _printk+0xcf/0x120 kernel/printk/printk.c:2475
       debug_object_is_on_stack lib/debugobjects.c:-1 [inline]
       lookup_object_or_alloc lib/debugobjects.c:688 [inline]
       __debug_object_init+0x2c8/0x3c0 lib/debugobjects.c:743
       rhashtable_init_noprof+0x7c0/0xbb0 lib/rhashtable.c:1085
       bch2_copygc_thread+0x116/0xdc0 fs/bcachefs/movinggc.c:355
       kthread+0x711/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x4e/0x80 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

other info that might help us debug this:

Chain exists of:
  console_owner --> &port->lock#2 --> &obj_hash[i].lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&obj_hash[i].lock);
                               lock(&port->lock#2);
                               lock(&obj_hash[i].lock);
  lock(console_owner);

 *** DEADLOCK ***

1 lock held by bch-copygc/loop/11139:
 #0: ffffffff99d1bea0 (&obj_hash[i].lock){-.-.}-{2:2}, at: __debug_object_init+0x85/0x3c0 lib/debugobjects.c:741

stack backtrace:
CPU: 1 UID: 0 PID: 11139 Comm: bch-copygc/loop Not tainted 6.15.0-syzkaller-01972-g914873bc7df9 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2046
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3168 [inline]
 check_prevs_add kernel/locking/lockdep.c:3287 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
 console_trylock_spinning kernel/printk/printk.c:2048 [inline]
 vprintk_emit+0x460/0x7a0 kernel/printk/printk.c:2449
 _printk+0xcf/0x120 kernel/printk/printk.c:2475
 debug_object_is_on_stack lib/debugobjects.c:-1 [inline]
 lookup_object_or_alloc lib/debugobjects.c:688 [inline]
 __debug_object_init+0x2c8/0x3c0 lib/debugobjects.c:743
 rhashtable_init_noprof+0x7c0/0xbb0 lib/rhashtable.c:1085
 bch2_copygc_thread+0x116/0xdc0 fs/bcachefs/movinggc.c:355
 kthread+0x711/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x4e/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
------------[ cut here ]------------
WARNING: CPU: 1 PID: 11139 at lib/debugobjects.c:655 debug_object_is_on_stack lib/debugobjects.c:655 [inline]
WARNING: CPU: 1 PID: 11139 at lib/debugobjects.c:655 lookup_object_or_alloc lib/debugobjects.c:688 [inline]
WARNING: CPU: 1 PID: 11139 at lib/debugobjects.c:655 __debug_object_init+0x2c9/0x3c0 lib/debugobjects.c:743
Modules linked in:
CPU: 1 UID: 0 PID: 11139 Comm: bch-copygc/loop Not tainted 6.15.0-syzkaller-01972-g914873bc7df9 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:655 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:688 [inline]
RIP: 0010:__debug_object_init+0x2c9/0x3c0 lib/debugobjects.c:743
Code: 4c fc cc 41 ff c7 44 89 3d 24 97 12 15 48 c7 c1 c0 54 e2 8b 48 c7 c7 20 55 e2 8b 84 c0 48 0f 45 f9 48 89 de e8 68 61 63 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 3a 1c 00 00 8b 05 9c 41 c8 09 3b 05 9a
RSP: 0018:ffffc90003077780 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90003077c30 RCX: 13d4388e78a4e500
RDX: 0000000000000000 RSI: 0000000080000001 RDI: 0000000000000000
RBP: ffff888025680020 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff1bfa644 R12: 0000000000000040
R13: ffff8880796aae38 R14: dffffc0000000000 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffff888125d91000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000000080 CR3: 00000000796ad000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 rhashtable_init_noprof+0x7c0/0xbb0 lib/rhashtable.c:1085
 bch2_copygc_thread+0x116/0xdc0 fs/bcachefs/movinggc.c:355
 kthread+0x711/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x4e/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/27 09:52 upstream 914873bc7df9 874a1386 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in debug_check_no_obj_freed
2025/05/28 04:11 linux-next fefff2755f2a 874a1386 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in debug_check_no_obj_freed
2025/05/27 23:59 linux-next fefff2755f2a 874a1386 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in debug_check_no_obj_freed
2025/05/26 05:27 linux-next 176e917e010c 2d4582d0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in debug_check_no_obj_freed
2025/05/23 07:12 linux-next 460178e842c7 fa44301a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in debug_check_no_obj_freed
2025/05/22 13:45 linux-next 460178e842c7 0919b50b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in debug_check_no_obj_freed
* Struck through repros no longer work on HEAD.