Hello.
We are Ubisectech Sirius Team, the vulnerability lab of China ValiantSec. Recently, our team has discovered a issue in Linux kernel 6.7. Attached to the email were a PoC file of the issue.
Stack dump:
bcachefs (loop3): flushing journal and stopping allocators, journal seq 10
bcachefs (loop3): flushing journal and stopping allocators complete, journal seq 10
------------[ cut here ]------------
kernel BUG at fs/bcachefs/journal.c:1054!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 PID: 48336 Comm: syz-executor.3 Not tainted 6.7.0 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:bch2_fs_journal_stop+0x2c0/0x300 fs/bcachefs/journal.c:1054
Code: c1 ea 03 80 3c 02 00 75 42 48 8b ab a0 04 00 00 4c 89 e7 48 89 ee e8 6f cd b0 fd 49 39 ec 0f 84 73 fe ff ff e8 51 d2 b0 fd 90 <0f> 0b 48 89 df e8 16 8b 07 fe e9 3e fe ff ff e8 5c fd ac 06 48 89
RSP: 0018:ffffc900025f7a70 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff8880147c9e00 RCX: ffffffff83d923f1
RDX: ffff888045690000 RSI: ffffffff83d923ff RDI: 0000000000000006
RBP: 000000000000000a R08: 0000000000000006 R09: 000000000000000b
R10: 000000000000000a R11: 0000000000000000 R12: 000000000000000b
R13: 1ffff920004bef4e R14: 0000000000000001 R15: ffff8880147c9e00
FS: 0000555555734480(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffeb0ee2ff8 CR3: 0000000026d5c000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
__bch2_fs_read_only+0x2b0/0x4b0 fs/bcachefs/super.c:251
bch2_fs_read_only+0x45f/0xb00 fs/bcachefs/super.c:306
__bch2_fs_stop+0xf6/0x5d0 fs/bcachefs/super.c:571
generic_shutdown_super+0x161/0x3d0 fs/super.c:696
bch2_kill_sb+0x3c/0x50 fs/bcachefs/fs.c:1972
deactivate_locked_super+0xbc/0x1a0 fs/super.c:484
deactivate_super+0xb1/0xd0 fs/super.c:517
cleanup_mnt+0x2df/0x430 fs/namespace.c:1256
task_work_run+0x16a/0x260 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x217/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1e/0x60 kernel/entry/common.c:296
do_syscall_64+0x53/0x120 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f29fa69178b
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 90 f3 0f 1e fa 31 f6 e9 05 00 00 00 0f 1f 44 00 00 f3 0f 1e fa b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b0 ff ff ff f7 d8
RSP: 002b:00007ffeb0ee32b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f29fa69178b
RDX: 00007f29fa629350 RSI: 0000000000000009 RDI: 00007ffeb0ee3370
RBP: 00007ffeb0ee3370 R08: 0000000000000000 R09: 00007ffeb0ee3140
R10: 0000555555735a43 R11: 0000000000000246 R12: 00007f29fa6f02c0
R13: 00007ffeb0ee4450 R14: 0000555555735970 R15: 00007ffeb0ee4440
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_fs_journal_stop+0x2c0/0x300 fs/bcachefs/journal.c:1054
Code: c1 ea 03 80 3c 02 00 75 42 48 8b ab a0 04 00 00 4c 89 e7 48 89 ee e8 6f cd b0 fd 49 39 ec 0f 84 73 fe ff ff e8 51 d2 b0 fd 90 <0f> 0b 48 89 df e8 16 8b 07 fe e9 3e fe ff ff e8 5c fd ac 06 48 89
RSP: 0018:ffffc900025f7a70 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff8880147c9e00 RCX: ffffffff83d923f1
RDX: ffff888045690000 RSI: ffffffff83d923ff RDI: 0000000000000006
RBP: 000000000000000a R08: 0000000000000006 R09: 000000000000000b
R10: 000000000000000a R11: 0000000000000000 R12: 000000000000000b
R13: 1ffff920004bef4e R14: 0000000000000001 R15: ffff8880147c9e00
FS: 0000555555734480(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c9c72af7b0 CR3: 0000000026d5c000 CR4: 0000000000750ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Thank you for taking the time to read this email and we look forward to working with you further.