Good day, dear maintainers,
We found a bug using a modified kernel configuration file used by syzbot.
We enhanced the coverage of the configuration file using our tool, klocalizer.
Kernel Branch: 6.2.0-rc7-next-20230213
Kernel config:?https://drive.google.com/file/d/1yVvlPL4-MMdjARqrwJ0QoKuPv_3lFQIR/view?usp=share_link
C Reproducer:?https://drive.google.com/file/d/1iGHEHtN3jEFooUWK_no4VEwK5qkzemBP/view?usp=share_link
Thank you!
Best regards,
Sanan Hasanov
==================================================================
BUG: KASAN: use-after-free in f2fs_iget+0x1140/0x53b0
Read of size 4 at addr ffff888043282568 by task syz-executor.5/12545
CPU: 0 PID: 12545 Comm: syz-executor.5 Not tainted 6.2.0-rc7-next-20230213+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x17f/0x260
print_report+0xc5/0x5e0
kasan_report+0xd7/0x110
__asan_report_load4_noabort+0x18/0x20
f2fs_iget+0x1140/0x53b0
f2fs_lookup+0x576/0xc90
__lookup_slow+0x275/0x4a0
walk_component+0x355/0x5c0
path_lookupat+0x185/0x760
filename_lookup+0x1d6/0x590
user_path_at_empty+0x4a/0x70
__do_sys_pivot_root+0x13d/0x16a0
__x64_sys_pivot_root+0x58/0x80
do_syscall_64+0x39/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5b19a8edcd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5b189dcbf8 EFLAGS: 00000246 ORIG_RAX: 000000000000009b
RAX: ffffffffffffffda RBX: 00007f5b19bbc120 RCX: 00007f5b19a8edcd
RDX: 0000000000000000 RSI: 0000000020000880 RDI: 00000000200001c0
RBP: 00007f5b19afc59c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd15d63e2f R14: 00007ffd15d63fd0 R15: 00007f5b189dcd80
</TASK>
The buggy address belongs to the physical page:
page:00000000a842bac7 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x43282
flags: 0xfffe0000000000(node=0|zone=1|lastcpupid=0x3fff)
raw: 00fffe0000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000000 ffff888043282d40 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888043282400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888043282480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888043282500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888043282580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888043282600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
F2FS-fs (loop5): sanity_check_inode: inode (ino=8) has corrupted i_extra_isize: 37888, max: 36