[syzbot] [ocfs2?] kernel BUG in ocfs2_remove_refcount_tree

1 view
Skip to first unread message

syzbot

unread,
2:41 AM (15 hours ago) 2:41 AM
to jl...@evilplan.org, jose...@linux.alibaba.com, linux-...@vger.kernel.org, ma...@fasheh.com, ocfs2...@lists.linux.dev, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cc3ee4ba57b7 Merge tag 'x86-urgent-2025-12-06' of git://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1084a992580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c076ba11dc381bf9
dashboard link: https://syzkaller.appspot.com/bug?extid=6d832e79d3efe1c46743
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16affc1a580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=168f221a580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/add7b22e16d3/disk-cc3ee4ba.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/df4dfdacc713/vmlinux-cc3ee4ba.xz
kernel image: https://storage.googleapis.com/syzbot-assets/13e72276bff4/bzImage-cc3ee4ba.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/31e89a92b694/mount_0.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=121da6c2580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6d832e...@syzkaller.appspotmail.com

------------[ cut here ]------------
kernel BUG at fs/ocfs2/refcounttree.c:774!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 5921 Comm: syz-executor Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:ocfs2_remove_refcount_tree+0xd51/0xd60 fs/ocfs2/refcounttree.c:774
Code: fe e9 be fd ff ff 44 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c d8 fd ff ff 4c 89 ff e8 2a 9d 80 fe e9 cb fd ff ff e8 30 3e 1e fe 90 <0f> 0b 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90
RSP: 0018:ffffc90003eb72c0 EFLAGS: 00010293
RAX: ffffffff83a1f400 RBX: 0000000000000010 RCX: ffff888025443c80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003eb74b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 00000000fffffffc R12: 1ffff1100aff633b
R13: 1ffff920007d6e68 R14: 1ffff110092a8c52 R15: 0000000000000000
FS: 000055557d56b500(0000) GS:ffff888126e4f000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055557d596648 CR3: 00000000343a8000 CR4: 00000000003526f0
Call Trace:
<TASK>
ocfs2_wipe_inode fs/ocfs2/inode.c:888 [inline]
ocfs2_delete_inode fs/ocfs2/inode.c:1155 [inline]
ocfs2_evict_inode+0x142a/0x4020 fs/ocfs2/inode.c:1297
evict+0x5f4/0xae0 fs/inode.c:837
d_delete_notify include/linux/fsnotify.h:377 [inline]
vfs_rmdir+0x3f4/0x670 fs/namei.c:5249
do_rmdir+0x27f/0x4a0 fs/namei.c:5291
__do_sys_unlinkat fs/namei.c:5468 [inline]
__se_sys_unlinkat fs/namei.c:5462 [inline]
__x64_sys_unlinkat+0xc2/0xf0 fs/namei.c:5462
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9853deed27
Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 07 01 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:00007fff08488218 EFLAGS: 00000207 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 00007f9853deed27
RDX: 0000000000000200 RSI: 00007fff084893c0 RDI: 00000000ffffff9c
RBP: 00007f9853e73d7d R08: 000055557d58e66b R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000207 R12: 00007fff084893c0
R13: 00007f9853e73d7d R14: 000000000001da3d R15: 00007fff0848b580
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:ocfs2_remove_refcount_tree+0xd51/0xd60 fs/ocfs2/refcounttree.c:774
Code: fe e9 be fd ff ff 44 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c d8 fd ff ff 4c 89 ff e8 2a 9d 80 fe e9 cb fd ff ff e8 30 3e 1e fe 90 <0f> 0b 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90
RSP: 0018:ffffc90003eb72c0 EFLAGS: 00010293
RAX: ffffffff83a1f400 RBX: 0000000000000010 RCX: ffff888025443c80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003eb74b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: 00000000fffffffc R12: 1ffff1100aff633b
R13: 1ffff920007d6e68 R14: 1ffff110092a8c52 R15: 0000000000000000
FS: 000055557d56b500(0000) GS:ffff888126e4f000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055557d596648 CR3: 00000000343a8000 CR4: 00000000003526f0


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
3:08 AM (14 hours ago) 3:08 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] ocfs2: validate i_refcount_loc when refcount flag is set
Author: karti...@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Add validation in ocfs2_validate_inode_block() to check that if an
inode has OCFS2_HAS_REFCOUNT_FL set, it must also have a valid
i_refcount_loc. A corrupted filesystem image can have this inconsistent
state, which later triggers a BUG_ON in ocfs2_remove_refcount_tree()
when the inode is being wiped during unlink.

Catch this corruption early during inode validation to fail gracefully
instead of crashing the kernel.

Reported-by: syzbot+6d832e...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6d832e79d3efe1c46743
Signed-off-by: Deepanshu Kartikey <karti...@gmail.com>
---
fs/ocfs2/inode.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 78f81950c9ee..dd56407fc056 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1484,6 +1484,13 @@ int ocfs2_validate_inode_block(struct super_block *sb,
goto bail;
}

+ if ((di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) &&
+ !di->i_refcount_loc) {
+ rc = ocfs2_error(sb, "Invalid dinode #%llu: refcount flag set but i_refcount_loc is zero\n",
+ (unsigned long long)bh->b_blocknr);
+ goto bail;
+ }
+
rc = 0;

bail:
--
2.43.0

syzbot

unread,
3:39 AM (14 hours ago) 3:39 AM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+6d832e...@syzkaller.appspotmail.com
Tested-by: syzbot+6d832e...@syzkaller.appspotmail.com

Tested on:

commit: c2f2b01b Merge tag 'i3c/for-6.19' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=146e321a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=34836e56fe7fb6c8
dashboard link: https://syzkaller.appspot.com/bug?extid=6d832e79d3efe1c46743
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=13284ec2580000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages