syzbot


KASAN: use-after-free Read in sysv_new_inode

Status: auto-obsoleted due to no activity on 2024/04/05 09:37
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+2e64084fa0c65e8706c9@syzkaller.appspotmail.com
First crash: 82d, last: 82d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [fs?] KASAN: use-after-free Read in sysv_new_inode 0 (1) 2024/02/09 10:12
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in sysv_new_inode 1 4d16h 4d16h 0/3 upstream: reported on 2024/04/22 17:59
upstream KASAN: use-after-free Read in sysv_new_inode (2) fs 41 15h24m 16d 0/26 moderation: reported on 2024/04/10 19:08
linux-5.15 KASAN: use-after-free Read in sysv_new_inode 1 12d 12d 0/3 upstream: reported on 2024/04/14 13:45

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sysv_new_inode+0xfdd/0x1170 fs/sysv/ialloc.c:153
Read of size 2 at addr ffff88803b1f61ce by task syz-executor.4/7277

CPU: 1 PID: 7277 Comm: syz-executor.4 Not tainted 6.8.0-rc3-next-20240205-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 sysv_new_inode+0xfdd/0x1170 fs/sysv/ialloc.c:153
 sysv_mknod+0x4e/0xe0 fs/sysv/namei.c:53
 lookup_open fs/namei.c:3494 [inline]
 open_last_lookups fs/namei.c:3563 [inline]
 path_openat+0x1425/0x3240 fs/namei.c:3793
 do_filp_open+0x235/0x490 fs/namei.c:3823
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1404
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1430
 do_syscall_64+0xfb/0x240
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f86a7c7dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f86a8a900c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f86a7dabf80 RCX: 00007f86a7c7dda9
RDX: 000000000000275a RSI: 0000000020000040 RDI: ffffffffffffff9c
RBP: 00007f86a7cca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f86a7dabf80 R15: 00007fff47892ea8
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0000ec7d80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x3b1f6
flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000000 dead000000000100 dead000000000122 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 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 16881, tgid 16881 (syz-executor.3), ts 1415422682739, free_ts 1421164748730
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1539
 prep_new_page mm/page_alloc.c:1546 [inline]
 get_page_from_freelist+0x34eb/0x3680 mm/page_alloc.c:3353
 __alloc_pages+0x256/0x680 mm/page_alloc.c:4609
 alloc_pages_mpol+0x3e8/0x680 mm/mempolicy.c:2263
 alloc_pages mm/mempolicy.c:2334 [inline]
 folio_alloc+0x12b/0x330 mm/mempolicy.c:2341
 filemap_alloc_folio+0xdf/0x500 mm/filemap.c:975
 __filemap_get_folio+0x431/0xbc0 mm/filemap.c:1919
 ext4_da_write_begin+0x5b9/0xa50 fs/ext4/inode.c:2885
 generic_perform_write+0x322/0x640 mm/filemap.c:3921
 ext4_buffered_write_iter+0xc6/0x350 fs/ext4/file.c:299
 ext4_file_write_iter+0x1de/0x1a10
 __kernel_write_iter+0x435/0x8c0 fs/read_write.c:523
 dump_emit_page fs/coredump.c:888 [inline]
 dump_user_range+0x46d/0x910 fs/coredump.c:915
 elf_core_dump+0x3d5e/0x4630 fs/binfmt_elf.c:2077
 do_coredump+0x1bab/0x2b50 fs/coredump.c:764
 get_signal+0x146b/0x1850 kernel/signal.c:2882
page last free pid 16881 tgid 16881 stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1140 [inline]
 free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2388
 free_unref_page_list+0x5a3/0x850 mm/page_alloc.c:2574
 release_pages+0x2744/0x2a80 mm/swap.c:1042
 __folio_batch_release+0x84/0x100 mm/swap.c:1062
 folio_batch_release include/linux/pagevec.h:83 [inline]
 truncate_inode_pages_range+0x457/0xf70 mm/truncate.c:362
 ext4_evict_inode+0x21c/0xf30 fs/ext4/inode.c:193
 evict+0x2a8/0x630 fs/inode.c:666
 __dentry_kill+0x20d/0x630 fs/dcache.c:603
 dput+0x19f/0x2b0 fs/dcache.c:845
 __fput+0x678/0x8a0 fs/file_table.c:384
 task_work_run+0x24f/0x310 kernel/task_work.c:180
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xa1b/0x27e0 kernel/exit.c:878
 do_group_exit+0x207/0x2c0 kernel/exit.c:1027
 get_signal+0x176e/0x1850 kernel/signal.c:2896
 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:105 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 irqentry_exit_to_user_mode+0x79/0x280 kernel/entry/common.c:225

Memory state around the buggy address:
 ffff88803b1f6080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88803b1f6100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88803b1f6180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                              ^
 ffff88803b1f6200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88803b1f6280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/02/05 09:36 linux-next 23e11d031852 a67b2c42 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in sysv_new_inode
* Struck through repros no longer work on HEAD.