kernel BUG in __jffs2_dbg_acct_sanity_check_nolock
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 4f069ab1ec24 Merge tag 'scsi-fixes' of git://git.kernel.or.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15eb98cd580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d101084bd46d029c dashboard link: https://syzkaller.appspot.com/bug?extid=93e9646c481467ffdf33 compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/67ba0886e1c6/disk-4f069ab1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/32b7a2fbdce1/vmlinux-4f069ab1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5c78c8a5f337/bzImage-4f069ab1.xz
The issue was bisected by AI to:
commit 7807ef7ba2a41c05f6197381f572dd38baa6c1ce
Author: David Woodhouse <[email protected]> Date: Sun May 21 02:45:27 2006 +0000
[JFFS2] Fix summary handling of unknown but compatible nodes.
reasoning: https://syzkaller.appspot.com/ai_job?id=53e8b2ef-21fa-41ad-819f-e75603353fed
AI-generated root cause summary:
In jffs2_sum_process_sum_data() (fs/jffs2/summary.c), when an eraseblock summary contains REF_UNCHECKED entries followed by an unsupported compatible node type (default: branch), the fallback-to-full-scan rollback restores c->free_size by c->sector_size - jeb->free_size and subtracts jeb->wasted_size, jeb->used_size, and jeb->dirty_size from the superblock counters, but forgets to subtract jeb->unchecked_size from c->unchecked_size or reset jeb->unchecked_size = 0. This leaves both c->unchecked_size and jeb->unchecked_size inflated by the previously scanned unchecked nodes (0x0b60 bytes in this report, making the superblock sum 0x020b60 != 0x020000). Because jffs2_dbg_acct_paranoia_check_nolock() is disabled when CONFIG_JFFS2_FS_DEBUG=0, scanning completes silently until jffs2_build_xattr_subsystem() later finds a corrupted xref node in another eraseblock and calls jffs2_mark_node_obsolete(), which invokes __jffs2_dbg_acct_sanity_check_nolock() (fs/jffs2/debug.c:47) and hits BUG().
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=93e9646c481467ffdf33
IMPORTANT: if you fix the issue, please add the following tag to the commit:
The bisection result may be wrong.
If you agree with it, please also add:
jffs2: error: (10291) verify_xattr_ref: node CRC failed at 0x014c90, read=0xf5b51bf7, calc=0xc505f375
jffs2: error: (10291) __jffs2_dbg_acct_sanity_check_nolock: eeep, space accounting superblock info is screwed.
jffs2: error: (10291) __jffs2_dbg_acct_sanity_check_nolock: free 0x003b9c + dirty 0x009000 + used 0x003828 + erasing 0x000000 + bad 0x000000 + wasted 0x00001c + unchecked 0x010780 != total 0x020000.
------------[ cut here ]------------ kernel BUG at fs/jffs2/debug.c:47! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 10291 Comm: syz.0.954 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 RIP: 0010:__jffs2_dbg_acct_sanity_check_nolock.cold+0x409/0x540 fs/jffs2/debug.c:47 Code: 00 42 54 8c 8b 44 24 08 48 c7 c7 40 41 54 8c 50 8b 44 24 18 50 8b 44 24 38 50 8b 44 24 38 50 44 8b 4c 24 38 e8 1f ad f8 ff 90 <0f> 0b e8 b7 c1 5f 01 e9 1d fc ff ff 4c 89 e7 89 4c 24 20 e8 a6 c1 RSP: 0018:ffffc900052df7f8 EFLAGS: 00010282 RAX: 00000000000000c6 RBX: ffff888038134000 RCX: 0000000000000000 RDX: 00000000000000c6 RSI: ffffffff81ec5519 RDI: fffff52000a5bef0 RBP: ffff88803813416c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000200 R11: 0000000000000001 R12: 0000000000009000 R13: ffff88803560abc0 R14: ffff88803560a580 R15: 0000000000020000 FS: 00007f906e8176c0(0000) GS:ffff88812245c000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fa593cade14 CR3: 00000000764eb000 CR4: 00000000003526f0 Call Trace: <TASK> jffs2_mark_node_obsolete+0x37b/0x1330 fs/jffs2/nodemgmt.c:682 jffs2_build_xattr_subsystem.cold+0xcf/0x229 fs/jffs2/xattr.c:800 jffs2_build_filesystem fs/jffs2/build.c:214 [inline] jffs2_do_mount_fs+0x16a8/0x22f0 fs/jffs2/build.c:416 jffs2_do_fill_super+0x3d4/0xa60 fs/jffs2/fs.c:574 jffs2_fill_super+0x283/0x370 fs/jffs2/super.c:290 mtd_get_sb+0x2f9/0x4d0 drivers/mtd/mtdsuper.c:59 mtd_get_sb_by_nr drivers/mtd/mtdsuper.c:90 [inline] get_tree_mtd+0x6f9/0x8a0 drivers/mtd/mtdsuper.c:143 vfs_get_tree+0x92/0x320 fs/super.c:1881 fc_mount fs/namespace.c:1282 [inline] do_new_mount_fc fs/namespace.c:3910 [inline] do_new_mount fs/namespace.c:3986 [inline] path_mount+0x7d0/0x2850 fs/namespace.c:4337 do_mount fs/namespace.c:4350 [inline] __do_sys_mount fs/namespace.c:4563 [inline] __se_sys_mount fs/namespace.c:4540 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4540 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f906d9a9b59 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f906e817028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f906dc35fa0 RCX: 00007f906d9a9b59 RDX: 0000200000000600 RSI: 00002000000005c0 RDI: 0000200000000580 RBP: 00007f906da3a18b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000800000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f906dc36038 R14: 00007f906dc35fa0 R15: 00007ffedc9d04a8 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__jffs2_dbg_acct_sanity_check_nolock.cold+0x409/0x540 fs/jffs2/debug.c:47 Code: 00 42 54 8c 8b 44 24 08 48 c7 c7 40 41 54 8c 50 8b 44 24 18 50 8b 44 24 38 50 8b 44 24 38 50 44 8b 4c 24 38 e8 1f ad f8 ff 90 <0f> 0b e8 b7 c1 5f 01 e9 1d fc ff ff 4c 89 e7 89 4c 24 20 e8 a6 c1 RSP: 0018:ffffc900052df7f8 EFLAGS: 00010282 RAX: 00000000000000c6 RBX: ffff888038134000 RCX: 0000000000000000 RDX: 00000000000000c6 RSI: ffffffff81ec5519 RDI: fffff52000a5bef0 RBP: ffff88803813416c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000200 R11: 0000000000000001 R12: 0000000000009000 R13: ffff88803560abc0 R14: ffff88803560a580 R15: 0000000000020000 FS: 00007f906e8176c0(0000) GS:ffff88812245c000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fa593cade14 CR3: 00000000764eb000 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 [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot. For information about bisection process see: https://goo.gl/tpsmEJ#ai-bisection
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
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