syzbot


KASAN: use-after-free Read in sysv_new_inode

Status: upstream: reported C repro on 2024/04/14 13:45
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+3d6b2fd70949d09bcec7@syzkaller.appspotmail.com
First crash: 175d, last: 27d
Bug presence (1)
Date Name Commit Repro Result
2024/05/07 upstream (ToT) dccb07f2914c C [report] KASAN: use-after-free Read in sysv_new_inode
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 origin:upstream C 17 27d 167d 0/3 upstream: reported C repro on 2024/04/22 17:59
upstream KASAN: use-after-free Read in sysv_new_inode fs 1 244d 240d 0/28 auto-obsoleted due to no activity on 2024/04/05 09:37
upstream KASAN: use-after-free Read in sysv_new_inode (2) fs C 356 3h48m 150d 0/28 upstream: reported C repro on 2024/05/09 07:33
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2024/08/31 22:55 1h57m bisect fix linux-5.15.y OK (0) job log log

Sample crash report:
Buffer I/O error on dev loop0, logical block 3245774, async page read
attempt to access beyond end of device
loop0: rw=0, want=17669880, limit=128
Buffer I/O error on dev loop0, logical block 8834939, async page read
==================================================================
BUG: KASAN: slab-out-of-bounds in sysv_new_inode+0x1062/0x11f0 fs/sysv/ialloc.c:153
Read of size 2 at addr ffff88801e72c1ce by task syz-executor810/3559

CPU: 0 PID: 3559 Comm: syz-executor810 Not tainted 5.15.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 sysv_new_inode+0x1062/0x11f0 fs/sysv/ialloc.c:153
 sysv_mknod+0x4a/0xe0 fs/sysv/namei.c:53
 lookup_open fs/namei.c:3462 [inline]
 open_last_lookups fs/namei.c:3532 [inline]
 path_openat+0x130a/0x2f20 fs/namei.c:3739
 do_filp_open+0x21c/0x460 fs/namei.c:3769
 do_sys_openat2+0x13b/0x500 fs/open.c:1253
 do_sys_open fs/open.c:1269 [inline]
 __do_sys_openat fs/open.c:1285 [inline]
 __se_sys_openat fs/open.c:1280 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1280
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f8696cde1d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 19 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:00007ffe6f992b48 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f8696cde1d9
RDX: 0000000000002c41 RSI: 0000000020000040 RDI: 00000000ffffff9c
RBP: 0000000000000004 R08: 00ffffffffffffff R09: 0000000001208000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe6f992b90
R13: 00007ffe6f992bd0 R14: 0000000000010000 R15: 0000000000000003
 </TASK>

Allocated by task 1:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 __kernfs_new_node+0xdb/0x750 fs/kernfs/dir.c:593
 kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:669
 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:985
 sysfs_add_file_mode_ns+0x308/0x3e0 fs/sysfs/file.c:317
 create_files fs/sysfs/group.c:64 [inline]
 internal_create_group+0x573/0xf00 fs/sysfs/group.c:149
 internal_create_groups fs/sysfs/group.c:189 [inline]
 sysfs_create_groups+0x52/0x110 fs/sysfs/group.c:215
 device_add_groups drivers/base/core.c:2488 [inline]
 device_add_attrs+0x13c/0x470 drivers/base/core.c:2647
 device_add+0x63e/0xfd0 drivers/base/core.c:3360
 usb_new_device+0xc17/0x18e0 drivers/usb/core/hub.c:2593
 register_root_hub+0x25f/0x540 drivers/usb/core/hcd.c:1021
 usb_add_hcd+0xc4e/0x1250 drivers/usb/core/hcd.c:3001
 dummy_hcd_probe+0x154/0x2a0 drivers/usb/gadget/udc/dummy_hcd.c:2675
 platform_probe+0x131/0x1b0 drivers/base/platform.c:1391
 really_probe+0x24e/0xb60 drivers/base/dd.c:595
 __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:755
 driver_probe_device+0x50/0x420 drivers/base/dd.c:785
 __device_attach_driver+0x2b9/0x500 drivers/base/dd.c:907
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x359/0x570 drivers/base/dd.c:979
 bus_probe_device+0xba/0x1e0 drivers/base/bus.c:487
 device_add+0xb48/0xfd0 drivers/base/core.c:3409
 platform_device_add+0x46e/0x7d0 drivers/base/platform.c:712
 init+0x83b/0x1070 drivers/usb/gadget/udc/dummy_hcd.c:2828
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

The buggy address belongs to the object at ffff88801e72c0e8
 which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 62 bytes to the right of
 168-byte region [ffff88801e72c0e8, ffff88801e72c190)
The buggy address belongs to the page:
page:ffffea000079cb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e72c
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888011decb40
raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 6926308692, free_ts 6809088710
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 __kernfs_new_node+0xdb/0x750 fs/kernfs/dir.c:593
 kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:669
 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:985
 sysfs_add_file_mode_ns+0x308/0x3e0 fs/sysfs/file.c:317
 create_files fs/sysfs/group.c:64 [inline]
 internal_create_group+0x573/0xf00 fs/sysfs/group.c:149
 internal_create_groups fs/sysfs/group.c:189 [inline]
 sysfs_create_groups+0x52/0x110 fs/sysfs/group.c:215
 device_add_groups drivers/base/core.c:2488 [inline]
 device_add_attrs+0x13c/0x470 drivers/base/core.c:2647
 device_add+0x63e/0xfd0 drivers/base/core.c:3360
 usb_new_device+0xc17/0x18e0 drivers/usb/core/hub.c:2593
 register_root_hub+0x25f/0x540 drivers/usb/core/hcd.c:1021
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
 exit_mmap+0x3cd/0x670 mm/mmap.c:3188
 __mmput+0x112/0x3b0 kernel/fork.c:1126
 free_bprm+0x135/0x2f0 fs/exec.c:1496
 kernel_execve+0x3bd/0x9b0 fs/exec.c:2011
 call_usermodehelper_exec_async+0x22f/0x370 kernel/umh.c:112
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

Memory state around the buggy address:
 ffff88801e72c080: 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00
 ffff88801e72c100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88801e72c180: 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00 00
                                              ^
 ffff88801e72c200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
 ffff88801e72c280: fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (20):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/04 21:20 linux-5.15.y 284087d4f7d5 610f2a54 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in sysv_new_inode
2024/09/09 02:55 linux-5.15.y 14e468424d3e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/07/07 15:47 linux-5.15.y f45bea23c39c 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/07/02 13:14 linux-5.15.y 4878aadf2d15 07f0a0a0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/06/17 09:42 linux-5.15.y 4878aadf2d15 88722c0f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/31 11:39 linux-5.15.y c61bd26ae81a 0c378259 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/24 22:25 linux-5.15.y 83655231580b a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/20 15:48 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/10 18:40 linux-5.15.y 284087d4f7d5 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/09 11:49 linux-5.15.y 284087d4f7d5 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/09 08:40 linux-5.15.y 284087d4f7d5 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/09 08:39 linux-5.15.y 284087d4f7d5 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/09 08:36 linux-5.15.y 284087d4f7d5 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/08 17:45 linux-5.15.y 284087d4f7d5 20bf80e1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/05/08 03:54 linux-5.15.y 284087d4f7d5 4cf3f9b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/04/28 20:34 linux-5.15.y b925f60c6ee7 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/04/28 20:12 linux-5.15.y b925f60c6ee7 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in sysv_new_inode
2024/07/10 10:41 linux-5.15.y f45bea23c39c bc144f9a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in sysv_new_inode
2024/04/14 13:44 linux-5.15.y fa3df276cd36 c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in sysv_new_inode
2024/07/25 23:10 linux-5.15.y 7c6d66f0266f 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in sysv_new_inode
* Struck through repros no longer work on HEAD.