[v6.1] KASAN: wild-memory-access Read in read_block_bitmap

0 views
Skip to first unread message

syzbot

unread,
Oct 7, 2023, 10:34:52 PM10/7/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ecda77b46871 Linux 6.1.56
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11244245680000
kernel config: https://syzkaller.appspot.com/x/.config?x=f1303837e67e0039
dashboard link: https://syzkaller.appspot.com/bug?extid=41074320433348dd071f
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7a322f2d8ce7/disk-ecda77b4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/454bc41a0e9d/vmlinux-ecda77b4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4ad963263073/Image-ecda77b4.gz.xz

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

EXT2-fs (loop4): error: ext2_free_branches: Read failure, inode=16, block=1669132791
EXT2-fs (loop4): error: ext2_free_branches: Read failure, inode=16, block=262144
==================================================================
BUG: KASAN: wild-memory-access in generic_test_bit include/asm-generic/bitops/generic-non-atomic.h:128 [inline]
BUG: KASAN: wild-memory-access in test_bit_le include/asm-generic/bitops/le.h:21 [inline]
BUG: KASAN: wild-memory-access in ext2_valid_block_bitmap fs/ext2/balloc.c:88 [inline]
BUG: KASAN: wild-memory-access in read_block_bitmap+0x338/0x628 fs/ext2/balloc.c:155
Read of size 8 at addr 1fff00010c16bff8 by task syz-executor.4/21602

CPU: 0 PID: 21602 Comm: syz-executor.4 Not tainted 6.1.56-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_report+0xe4/0x4c0 mm/kasan/report.c:398
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
generic_test_bit include/asm-generic/bitops/generic-non-atomic.h:128 [inline]
test_bit_le include/asm-generic/bitops/le.h:21 [inline]
ext2_valid_block_bitmap fs/ext2/balloc.c:88 [inline]
read_block_bitmap+0x338/0x628 fs/ext2/balloc.c:155
ext2_free_blocks+0x280/0xa28 fs/ext2/balloc.c:516
ext2_free_data fs/ext2/inode.c:1089 [inline]
ext2_free_branches+0x2f4/0x3c4 fs/ext2/inode.c:1146
ext2_free_branches+0x180/0x3c4 fs/ext2/inode.c:1137
ext2_free_branches+0x180/0x3c4 fs/ext2/inode.c:1137
__ext2_truncate_blocks+0x9a8/0xd00 fs/ext2/inode.c:1220
ext2_setsize fs/ext2/inode.c:1278 [inline]
ext2_setattr+0x8e8/0xbcc fs/ext2/inode.c:1648
notify_change+0xb58/0xe1c fs/attr.c:499
do_truncate+0x1c0/0x28c fs/open.c:65
handle_truncate fs/namei.c:3216 [inline]
do_open fs/namei.c:3561 [inline]
path_openat+0x1fa0/0x2548 fs/namei.c:3714
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
==================================================================
EXT2-fs (loop4): error: ext2_valid_block_bitmap: Invalid block bitmap - block_group = 0, block = 0
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks in system zones - Block = 3, count = 3
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 983269, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 589827, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2185560079, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 18346, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks in system zones - Block = 2, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 33261, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 100
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 64
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 65536, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 268435456, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 7565925, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1937768448, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1634433657, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1919249516, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2037609061, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1818323834, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3133565699, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 327680, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 150994944, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3925999616, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3409668, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 40
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1635017060, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1936876908, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1634433657, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1919249516, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2037609061, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1818323834, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1936876908, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 9
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 13
EXT2-fs (loop4): error: ext2_free_blocks: bit already cleared for block 32
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 163928, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683895808, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132790, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks not in datazone - block = 131072, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks in system zones - Block = 5, count = 1
EXT2-fs (loop4): error: ext2_free_blocks: Freeing blocks in system zones - Block = 5, count = 1
EXT2-fs (loop4): error: ext2_free_branches: Read failure, inode=16, block=16777216


---
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 bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

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

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

syzbot

unread,
Oct 8, 2023, 1:13:47 PM10/8/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: ecda77b46871 Linux 6.1.56
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14f32031680000
kernel config: https://syzkaller.appspot.com/x/.config?x=f1303837e67e0039
dashboard link: https://syzkaller.appspot.com/bug?extid=41074320433348dd071f
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=113d3679680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11adf559680000
mounted in repro: https://storage.googleapis.com/syzbot-assets/1c80badf1286/mount_0.gz

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

EXT2-fs (loop0): error: ext2_free_branches: Read failure, inode=16, block=1669132791
EXT2-fs (loop0): error: ext2_free_branches: Read failure, inode=16, block=262144
==================================================================
BUG: KASAN: wild-memory-access in generic_test_bit include/asm-generic/bitops/generic-non-atomic.h:128 [inline]
BUG: KASAN: wild-memory-access in test_bit_le include/asm-generic/bitops/le.h:21 [inline]
BUG: KASAN: wild-memory-access in ext2_valid_block_bitmap fs/ext2/balloc.c:88 [inline]
BUG: KASAN: wild-memory-access in read_block_bitmap+0x338/0x628 fs/ext2/balloc.c:155
Read of size 8 at addr 1fff0000e0e88ff8 by task syz-executor355/4524

CPU: 0 PID: 4524 Comm: syz-executor355 Not tainted 6.1.56-syzkaller #0
EXT2-fs (loop0): error: ext2_valid_block_bitmap: Invalid block bitmap - block_group = 0, block = 0
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks in system zones - Block = 3, count = 3
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 983269, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 589827, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2185560079, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 18346, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks in system zones - Block = 2, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 33261, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 100
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 64
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 65536, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 268435456, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 7565925, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1937768448, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1634433657, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1919249516, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2037609061, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1818323834, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3133565699, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 327680, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 150994944, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132791, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683928664, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3925999616, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 3409668, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 40
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1635017060, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1936876908, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1634433657, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1919249516, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1803188595, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1701604449, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2054779762, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1819042155, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2037609061, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1818323834, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1936876908, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 9
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 13
EXT2-fs (loop0): error: ext2_free_blocks: bit already cleared for block 32
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 163928, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 2683895808, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 1669132790, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks not in datazone - block = 131072, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks in system zones - Block = 5, count = 1
EXT2-fs (loop0): error: ext2_free_blocks: Freeing blocks in system zones - Block = 5, count = 1
EXT2-fs (loop0): error: ext2_free_branches: Read failure, inode=16, block=16777216


---
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.
Reply all
Reply to author
Forward
0 new messages