lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2D7EE43B-5C6F-4F46-AE09-D5B50FF64589@gmail.com>
Date: Mon, 4 Aug 2025 20:21:25 +0800
From: Alan Huang <mmpgouride@...il.com>
To: syzbot <syzbot+cd063f869beedf5b9cd7@...kaller.appspotmail.com>
Cc: kent.overstreet@...ux.dev,
 linux-bcachefs@...r.kernel.org,
 linux-kernel@...r.kernel.org,
 syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [bcachefs?] UBSAN: array-index-out-of-bounds in
 bch2_accounting_validate

On Aug 4, 2025, at 15:18, syzbot <syzbot+cd063f869beedf5b9cd7@...kaller.appspotmail.com> wrote:
> 
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    352af6a011d5 Merge tag 'rust-6.17' of git://git.kernel.org..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=135d7aa2580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=cae1291240e8962a
> dashboard link: https://syzkaller.appspot.com/bug?extid=cd063f869beedf5b9cd7
> compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14dcc6a2580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=133e02f0580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/a762497d1fce/disk-352af6a0.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/3055e1e47995/vmlinux-352af6a0.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/aa300ee98202/bzImage-352af6a0.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/de2a4b00a48a/mount_0.gz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+cd063f869beedf5b9cd7@...kaller.appspotmail.com
> 
> bcachefs (loop0): error reading btree root btree=subvolumes level=0: btree_node_read_error, fixing
> bcachefs (loop0): invalid bkey in btree_node btree=snapshot_trees level=0: u64s 6 type snapshot_tree POS_MIN len 0 ver 0: subvol 1 root snapshot 4294967295
>  bad pos, deleting
> bcachefs (loop0): error reading btree root btree=snapshot_trees level=0: btree_node_read_error, fixing
> ------------[ cut here ]------------
> UBSAN: array-index-out-of-bounds in fs/bcachefs/disk_accounting.c:238:2
> index 175 is out of range for type 'const unsigned int[9]'
> CPU: 0 UID: 0 PID: 5849 Comm: syz-executor427 Tainted: G        W           6.16.0-syzkaller-11322-g352af6a011d5 #0 PREEMPT_{RT,(full)} 
> Tainted: [W]=WARN
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
> Call Trace:
> <TASK>
> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
> ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
> __ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
> bch2_accounting_validate+0x112f/0x1400 fs/bcachefs/disk_accounting.c:238
> bch2_bkey_val_validate+0x202/0x3e0 fs/bcachefs/bkey_methods.c:143
> btree_node_bkey_val_validate fs/bcachefs/btree_io.c:880 [inline]
> bch2_btree_node_read_done+0x4051/0x5550 fs/bcachefs/btree_io.c:1303
> btree_node_read_work+0x40e/0xe60 fs/bcachefs/btree_io.c:1440
> bch2_btree_node_read+0x887/0x2a00 fs/bcachefs/btree_io.c:-1
> __bch2_btree_root_read fs/bcachefs/btree_io.c:1906 [inline]
> bch2_btree_root_read+0x5f0/0x760 fs/bcachefs/btree_io.c:1928
> read_btree_roots+0x2c6/0x840 fs/bcachefs/recovery.c:615
> bch2_fs_recovery+0x261f/0x3a50 fs/bcachefs/recovery.c:1006
> bch2_fs_start+0xaaf/0xda0 fs/bcachefs/super.c:1213
> bch2_fs_get_tree+0xb39/0x1520 fs/bcachefs/fs.c:2488
> vfs_get_tree+0x92/0x2b0 fs/super.c:1815
> do_new_mount+0x2a2/0x9e0 fs/namespace.c:3805
> do_mount fs/namespace.c:4133 [inline]
> __do_sys_mount fs/namespace.c:4344 [inline]
> __se_sys_mount+0x317/0x410 fs/namespace.c:4321
> 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:0x7f5016bf5eaa
> Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 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 b8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffd552f5c58 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
> RAX: ffffffffffffffda RBX: 00007ffd552f5c70 RCX: 00007f5016bf5eaa
> RDX: 0000200000001000 RSI: 0000200000000000 RDI: 00007ffd552f5c70
> RBP: 0000200000000000 R08: 00007ffd552f5cb0 R09: 000000000000492c
> R10: 0000000000000000 R11: 0000000000000282 R12: 0000200000001000
> R13: 00007ffd552f5cb0 R14: 0000000000000003 R15: 0000000000000000
> </TASK>
> ---[ end trace ]---
> 
> 
> ---
> 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 syzkaller@...glegroups.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
> 


#syz test

diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c
index f96530c70262..4f5b290dc8f1 100644
--- a/fs/bcachefs/disk_accounting.c
+++ b/fs/bcachefs/disk_accounting.c
@@ -184,6 +184,11 @@ int bch2_accounting_validate(struct bch_fs *c, struct bkey_s_c k,
        void *end = &acc_k + 1;
        int ret = 0;
 
+       bkey_fsck_err_on(acc_k.type >= BCH_DISK_ACCOUNTING_TYPE_NR,
+                        c, accounting_key_type_invalid,
+                        "invalid accounting type (%u >= %u)",
+                        acc_k.type, BCH_DISK_ACCOUNTING_TYPE_NR);
+
        bkey_fsck_err_on((from.flags & BCH_VALIDATE_commit) &&
                         bversion_zero(k.k->bversion),
                         c, accounting_key_version_0,
diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
index 5317b1bfe2e5..5ba28a684f51 100644
--- a/fs/bcachefs/sb-errors_format.h
+++ b/fs/bcachefs/sb-errors_format.h
@@ -328,6 +328,7 @@ enum bch_fsck_flags {
        x(accounting_key_replicas_devs_unsorted,                280,    FSCK_AUTOFIX)   \
        x(accounting_key_version_0,                             282,    FSCK_AUTOFIX)   \
        x(accounting_key_nr_counters_wrong,                     307,    FSCK_AUTOFIX)   \
+       x(accounting_key_type_invalid,                          325,    FSCK_AUTOFIX)   \
        x(logged_op_but_clean,                                  283,    FSCK_AUTOFIX)   \
        x(compression_opt_not_marked_in_sb,                     295,    FSCK_AUTOFIX)   \
        x(compression_type_not_marked_in_sb,                    296,    FSCK_AUTOFIX)   \
@@ -336,7 +337,7 @@ enum bch_fsck_flags {
        x(dirent_stray_data_after_cf_name,                      305,    0)              \
        x(rebalance_work_incorrectly_set,                       309,    FSCK_AUTOFIX)   \
        x(rebalance_work_incorrectly_unset,                     310,    FSCK_AUTOFIX)   \
-       x(MAX,                                                  325,    0)
+       x(MAX,                                                  326,    0)
 
 enum bch_sb_error_id {
 #define x(t, n, ...) BCH_FSCK_ERR_##t = n,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ