Re: [syzbot] [bcachefs?] KASAN: slab-use-after-free Write in bch2_get_next_dev

Kent Overstreet <[email protected]>
Newsgroups org.kernel.vger.linux-bcachefs,org.kernel.vger.linux-kernel
Message-ID <gtbxhrjzbwuevau27w2zi645uu2y4xuhzutebojmh535blvah7@bc4344cq25cs>
On Sat, Jul 19, 2025 at 11:47:02AM -0700, syzbot wrote:
> Hello,
> 
> syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> kernel panic: btree_update_nodes_written leaked btree_trans
> 
> Kernel panic - not syncing: btree_update_nodes_written leaked btree_trans
> CPU: 0 UID: 0 PID: 7134 Comm: syz.4.31 Not tainted 6.16.0-rc6-syzkaller-gcbdeb0ffd5bf #0 PREEMPT(full) 
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> Call Trace:
>  <TASK>
>  dump_stack_lvl+0x99/0x250 lib/dump_stack.c:120
>  panic+0x2db/0x790 kernel/panic.c:382
>  bch2_fs_btree_iter_exit+0x475/0x490 fs/bcachefs/btree_iter.c:3732
>  __bch2_fs_free fs/bcachefs/super.c:640 [inline]
>  bch2_fs_release+0x2ab/0x830 fs/bcachefs/super.c:690
>  kobject_cleanup lib/kobject.c:689 [inline]
>  kobject_release lib/kobject.c:720 [inline]
>  kref_put include/linux/kref.h:65 [inline]
>  kobject_put+0x22b/0x480 lib/kobject.c:737
>  bch2_fs_get_tree+0xb76/0x1540 fs/bcachefs/fs.c:2578
>  vfs_get_tree+0x92/0x2b0 fs/super.c:1804
>  do_new_mount+0x24a/0xa40 fs/namespace.c:3902
>  do_mount fs/namespace.c:4239 [inline]
>  __do_sys_mount fs/namespace.c:4450 [inline]
>  __se_sys_mount+0x317/0x410 fs/namespace.c:4427
>  do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>  do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f59aa99014a
> Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f59ab804e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
> RAX: ffffffffffffffda RBX: 00007f59ab804ef0 RCX: 00007f59aa99014a
> RDX: 00002000000000c0 RSI: 0000200000000080 RDI: 00007f59ab804eb0
> RBP: 00002000000000c0 R08: 00007f59ab804ef0 R09: 0000000000818001
> R10: 0000000000818001 R11: 0000000000000246 R12: 0000200000000080
> R13: 00007f59ab804eb0 R14: 000000000000596b R15: 0000200000000000
>  </TASK>
> Kernel Offset: disabled
> 
> 
> Tested on:
> 
> commit:         cbdeb0ff bcachefs: Fix UAF by journal write path
> git tree:       git://evilpiepirate.org/bcachefs.git for-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=1627f8f0580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=37de60b3108b6d8f
> dashboard link: https://syzkaller.appspot.com/bug?extid=2b98caf09c41174a9697
> compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
> 
> Note: no patches were applied.

appears we were missing a flush_work() in the shutdown path

#syz test: git://evilpiepirate.org/bcachefs.git bcachefs-testing
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.