Hello,
syzbot found the following issue on:
HEAD commit: 72d681a01da5 Revert "net: use struct_group to copy ip/ipv6..
git tree: android13-5.15-lts
console+strace:
https://syzkaller.appspot.com/x/log.txt?x=14d07561480000
kernel config:
https://syzkaller.appspot.com/x/.config?x=f4ba95ecf3958808
dashboard link:
https://syzkaller.appspot.com/bug?extid=eaa12770098b5ebf8847
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:
https://syzkaller.appspot.com/x/repro.syz?x=16caa461480000
C reproducer:
https://syzkaller.appspot.com/x/repro.c?x=178b26fe480000
Downloadable assets:
disk image:
https://storage.googleapis.com/syzbot-assets/9121a81631c9/disk-72d681a0.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/e5b495231897/vmlinux-72d681a0.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/bbbaed45751a/bzImage-72d681a0.xz
mounted in repro:
https://storage.googleapis.com/syzbot-assets/c1b8b6e3530e/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+eaa127...@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: use-after-free in ext4_ext_rm_leaf+0x14d4/0x1800 fs/ext4/extents.c:2619
Read of size 4 at addr ffff888123a80ff4 by task syz-executor214/14902
CPU: 0 PID: 14902 Comm: syz-executor214 Not tainted 5.15.80-syzkaller-00318-g72d681a01da5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
print_address_description+0x87/0x3d0 mm/kasan/report.c:256
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
ext4_ext_rm_leaf+0x14d4/0x1800 fs/ext4/extents.c:2619
ext4_ext_remove_space+0xfc5/0x21b0 fs/ext4/extents.c:2957
ext4_ext_truncate+0x19f/0x250 fs/ext4/extents.c:4419
ext4_truncate+0x942/0xf50 fs/ext4/inode.c:4268
ext4_setattr+0xfe4/0x1920 fs/ext4/inode.c:5529
notify_change+0xd8f/0x1040 fs/attr.c:426
do_truncate+0x214/0x300 fs/open.c:66
handle_truncate fs/namei.c:3136 [inline]
do_open fs/namei.c:3484 [inline]
path_openat+0x2849/0x2ea0 fs/namei.c:3615
do_filp_open+0x277/0x4f0 fs/namei.c:3642
do_sys_openat2+0x13b/0x500 fs/open.c:1234
do_sys_open fs/open.c:1250 [inline]
__do_sys_openat fs/open.c:1266 [inline]
__se_sys_openat fs/open.c:1261 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1261
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f1c3248a7f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 71 15 00 00 90 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:00007f1c2a0f42f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f1c3250f7c0 RCX: 00007f1c3248a7f9
RDX: 000000000000275a RSI: 00000000200001c0 RDI: 00000000ffffff9c
RBP: 00007f1c324dc814 R08: 00007f1c2a0f4700 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: be734677a9d9a8be
R13: 0030656c69662f2e R14: 6f6f6c2f7665642f R15: 00007f1c3250f7c8
</TASK>
The buggy address belongs to the page:
page:ffffea00048ea000 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x123a80
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea0004950488 ffffea000496e388 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x100cca(GFP_HIGHUSER_MOVABLE), pid 14254, ts 252534449862, free_ts 252822873974
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
prep_new_page mm/page_alloc.c:2501 [inline]
get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
__alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
__alloc_pages_node include/linux/gfp.h:591 [inline]
alloc_pages_node include/linux/gfp.h:605 [inline]
alloc_pages include/linux/gfp.h:618 [inline]
shmem_alloc_page mm/shmem.c:1587 [inline]
shmem_alloc_and_acct_page+0x4a0/0xa20 mm/shmem.c:1612
shmem_getpage_gfp+0x1487/0x25f0 mm/shmem.c:1907
shmem_getpage mm/shmem.c:152 [inline]
shmem_write_begin+0xc8/0x1b0 mm/shmem.c:2478
generic_perform_write+0x2cd/0x5d0 mm/filemap.c:3825
__generic_file_write_iter+0x25b/0x4b0 mm/filemap.c:3952
generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3984
call_write_iter include/linux/fs.h:2138 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xc8d/0x1050 fs/read_write.c:594
ksys_write+0x198/0x2c0 fs/read_write.c:647
__do_sys_write fs/read_write.c:659 [inline]
__se_sys_write fs/read_write.c:656 [inline]
__x64_sys_write+0x7b/0x90 fs/read_write.c:656
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1364 [inline]
free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435
free_unref_page_prepare mm/page_alloc.c:3433 [inline]
free_unref_page_list+0x16a/0xad0 mm/page_alloc.c:3554
release_pages+0xf3e/0xf90 mm/swap.c:1010
__pagevec_release+0x81/0xf0 mm/swap.c:1030
pagevec_release include/linux/pagevec.h:81 [inline]
shmem_undo_range+0x64c/0x1c90 mm/shmem.c:965
shmem_truncate_range mm/shmem.c:1064 [inline]
shmem_evict_inode+0x228/0xa30 mm/shmem.c:1146
evict+0x2a3/0x630 fs/inode.c:587
iput_final fs/inode.c:1663 [inline]
iput+0x61c/0x7d0 fs/inode.c:1689
dentry_unlink_inode+0x349/0x430 fs/dcache.c:376
__dentry_kill+0x3e2/0x5d0 fs/dcache.c:582
dentry_kill+0xc0/0x2a0
dput+0x175/0x320 fs/dcache.c:888
__fput+0x65a/0x910 fs/file_table.c:288
____fput+0x15/0x20 fs/file_table.c:308
task_work_run+0x147/0x1b0 kernel/task_work.c:164
ptrace_notify+0x29a/0x340 kernel/signal.c:2382
Memory state around the buggy address:
ffff888123a80e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888123a80f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888123a80f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888123a81000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888123a81080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff