[f2fs?] KASAN: slab-out-of-bounds Read in __exchange_data_block

7 views
Skip to first unread message

syzbot

unread,
Jan 4, 2023, 12:37:53 PM1/4/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c4215ee4771b Linux 4.14.302
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15998dac480000
kernel config: https://syzkaller.appspot.com/x/.config?x=4a9988fe055c9527
dashboard link: https://syzkaller.appspot.com/bug?extid=b90cfae120fee25396b5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c93ba055d204/disk-c4215ee4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bfbc929a33c1/vmlinux-c4215ee4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/444658051770/bzImage-c4215ee4.xz

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

F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop4): invalid crc value
F2FS-fs (loop4): Found nat_bits in checkpoint
F2FS-fs (loop4): Mounted with checkpoint version = 753bd00b
==================================================================
BUG: KASAN: slab-out-of-bounds in __roll_back_blkaddrs fs/f2fs/file.c:1001 [inline]
BUG: KASAN: slab-out-of-bounds in __exchange_data_block+0x2dbc/0x30a0 fs/f2fs/file.c:1137
Read of size 4 at addr ffff88809215ce20 by task syz-executor.4/10018

CPU: 1 PID: 10018 Comm: syz-executor.4 Not tainted 4.14.302-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
__roll_back_blkaddrs fs/f2fs/file.c:1001 [inline]
__exchange_data_block+0x2dbc/0x30a0 fs/f2fs/file.c:1137
f2fs_insert_range fs/f2fs/file.c:1404 [inline]
f2fs_fallocate+0x1368/0x26f0 fs/f2fs/file.c:1501
vfs_fallocate+0x346/0x790 fs/open.c:319
SYSC_fallocate fs/open.c:342 [inline]
SyS_fallocate+0x4a/0x80 fs/open.c:336
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7ff735a9e0c9
RSP: 002b:00007ff734010168 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007ff735bbdf80 RCX: 00007ff735a9e0c9
RDX: 0000000000000000 RSI: 0000000000000020 RDI: 0000000000000005
RBP: 00007ff735af9ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000ff8000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdad81361f R14: 00007ff734010300 R15: 0000000000022000

Allocated by task 10018:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x88/0xd0 mm/util.c:430
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
__exchange_data_block+0x132/0x30a0 fs/f2fs/file.c:1111
f2fs_insert_range fs/f2fs/file.c:1404 [inline]
f2fs_fallocate+0x1368/0x26f0 fs/f2fs/file.c:1501
vfs_fallocate+0x346/0x790 fs/open.c:319
SYSC_fallocate fs/open.c:342 [inline]
SyS_fallocate+0x4a/0x80 fs/open.c:336
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff888092158e80
which belongs to the cache kmalloc-16384 of size 16384
The buggy address is located 16288 bytes inside of
16384-byte region [ffff888092158e80, ffff88809215ce80)
The buggy address belongs to the page:
page:ffffea0002485600 count:1 mapcount:0 mapping:ffff888092158e80 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff888092158e80 0000000000000000 0000000100000001
raw: ffffea0002485420 ffff88813fe64c48 ffff88813fe65200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809215cd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809215cd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809215ce00: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809215ce80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809215cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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.

syzbot

unread,
Feb 27, 2023, 3:47:44 PM2/27/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 7878a41b6cc1 Linux 4.14.307
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=151faf1cc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=77c994a24403ce1c
dashboard link: https://syzkaller.appspot.com/bug?extid=b90cfae120fee25396b5
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1724f474c80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17eafe18c80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1fdebf709d79/disk-7878a41b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/88229e373f4d/vmlinux-7878a41b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/bf3c4c287a8b/bzImage-7878a41b.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/4684fa5e317c/mount_0.gz

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

attempt to access beyond end of device
loop0: rw=2049, want=57344, limit=40427
attempt to access beyond end of device
loop0: rw=2049, want=57352, limit=40427
==================================================================
BUG: KASAN: slab-out-of-bounds in __roll_back_blkaddrs fs/f2fs/file.c:1001 [inline]
BUG: KASAN: slab-out-of-bounds in __exchange_data_block+0x2dbc/0x30a0 fs/f2fs/file.c:1137
Read of size 4 at addr ffff88809236c8a0 by task syz-executor263/8119

CPU: 0 PID: 8119 Comm: syz-executor263 Not tainted 4.14.307-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:251
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:350
kasan_report mm/kasan/report.c:408 [inline]
__asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:428
__roll_back_blkaddrs fs/f2fs/file.c:1001 [inline]
__exchange_data_block+0x2dbc/0x30a0 fs/f2fs/file.c:1137
f2fs_move_file_range fs/f2fs/file.c:2330 [inline]
f2fs_ioc_move_range fs/f2fs/file.c:2376 [inline]
f2fs_ioctl+0x52b3/0x6b70 fs/f2fs/file.c:2698
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7fd26ae79619
RSP: 002b:00007fd263dc22f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fd26af037b0 RCX: 00007fd26ae79619
RDX: 0000000020000100 RSI: 00000000c020f509 RDI: 0000000000000004
RBP: 00007fd26aed05a8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 6c5f657669746361
R13: 0030656c69662f2e R14: 0031656c69662f2e R15: 00007fd26af037b8

Allocated by task 8119:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x84/0xc0 mm/util.c:432
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
__exchange_data_block+0x132/0x30a0 fs/f2fs/file.c:1111
f2fs_move_file_range fs/f2fs/file.c:2330 [inline]
f2fs_ioc_move_range fs/f2fs/file.c:2376 [inline]
f2fs_ioctl+0x52b3/0x6b70 fs/f2fs/file.c:2698
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff888092368900
which belongs to the cache kmalloc-16384 of size 16384
The buggy address is located 16288 bytes inside of
16384-byte region [ffff888092368900, ffff88809236c900)
The buggy address belongs to the page:
page:ffffea000248da00 count:1 mapcount:0 mapping:ffff888092368900 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff888092368900 0000000000000000 0000000100000001
raw: ffffea00027bea20 ffff88813fe64c48 ffff88813fe65200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809236c780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88809236c800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809236c880: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809236c900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809236c980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages