syzbot


KASAN: slab-use-after-free Read in capable_wrt_inode_uidgid

Status: premoderation: reported on 2025/07/12 19:33
Reported-by: syzbot+534ad47cae94664e5570@syzkaller.appspotmail.com
First crash: 47d, last: 47d

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in i_user_ns include/linux/fs.h:1413 [inline]
BUG: KASAN: slab-use-after-free in i_uid_into_vfsuid include/linux/fs.h:1452 [inline]
BUG: KASAN: slab-use-after-free in privileged_wrt_inode_uidgid kernel/capability.c:479 [inline]
BUG: KASAN: slab-use-after-free in capable_wrt_inode_uidgid+0xf8/0x280 kernel/capability.c:499
Read of size 8 at addr ffff88811090a840 by task syz.1.154/786

CPU: 1 UID: 0 PID: 786 Comm: syz.1.154 Not tainted 6.12.30-syzkaller-g21ed84930c16 #0 fa4558fba7fa11aa57b2c84caea5bf67b39b1b5f
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:94
 dump_stack_lvl+0x10c/0x190 lib/dump_stack.c:120
 print_address_description+0x71/0x220 mm/kasan/report.c:377
 print_report+0x4a/0x70 mm/kasan/report.c:488
 kasan_report+0x163/0x1a0 mm/kasan/report.c:601
 __asan_report_load8_noabort+0x18/0x20 mm/kasan/report_generic.c:381
 i_user_ns include/linux/fs.h:1413 [inline]
 i_uid_into_vfsuid include/linux/fs.h:1452 [inline]
 privileged_wrt_inode_uidgid kernel/capability.c:479 [inline]
 capable_wrt_inode_uidgid+0xf8/0x280 kernel/capability.c:499
 generic_permission+0x1d4/0x580 fs/namei.c:421
 do_inode_permission fs/namei.c:475 [inline]
 inode_permission+0x95/0x4c0 fs/namei.c:535
 may_lookup fs/namei.c:1760 [inline]
 link_path_walk+0x221/0xec0 fs/namei.c:2366
 path_lookupat+0x95/0x4a0 fs/namei.c:2579
 filename_lookup+0x1f5/0x520 fs/namei.c:2609
 user_path_at+0x42/0x60 fs/namei.c:3016
 ksys_umount fs/namespace.c:2034 [inline]
 __do_sys_umount fs/namespace.c:2042 [inline]
 __se_sys_umount fs/namespace.c:2040 [inline]
 __x64_sys_umount+0xf2/0x170 fs/namespace.c:2040
 x64_sys_call+0x2ab8/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:167
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x58/0xf0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fc3eaf8e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fc3ebd65038 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: ffffffffffffffda RBX: 00007fc3eb1b6080 RCX: 00007fc3eaf8e929
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000200000000040
RBP: 00007fc3eb010b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fc3eb1b6080 R15: 00007fffe501b498
 </TASK>

Allocated by task 785:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:565
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x96/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __kmalloc_cache_noprof+0x1a5/0x3c0 mm/slub.c:4378
 kmalloc_noprof include/linux/slab.h:881 [inline]
 kzalloc_noprof include/linux/slab.h:1017 [inline]
 alloc_inode+0x5b/0x120 fs/incfs/vfs.c:1594
 alloc_inode+0x7a/0x270 fs/inode.c:269
 iget5_locked+0x53/0xb0 fs/inode.c:1347
 fetch_regular_inode+0x19c/0x280 fs/incfs/vfs.c:385
 incfs_mount_fs+0x51f/0x960 fs/incfs/vfs.c:1889
 legacy_get_tree+0x103/0x1b0 fs/fs_context.c:662
 vfs_get_tree+0x9e/0x290 fs/super.c:1817
 do_new_mount+0x251/0xb40 fs/namespace.c:3519
 path_mount+0x688/0x1050 fs/namespace.c:3846
 do_mount fs/namespace.c:3859 [inline]
 __do_sys_mount fs/namespace.c:4069 [inline]
 __se_sys_mount+0x2bd/0x480 fs/namespace.c:4046
 __x64_sys_mount+0xc3/0xf0 fs/namespace.c:4046
 x64_sys_call+0x2021/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:166
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x58/0xf0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x76/0x7e

Freed by task 785:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x4a/0x60 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2413 [inline]
 slab_free mm/slub.c:4662 [inline]
 kfree+0x158/0x440 mm/slub.c:4815
 free_inode+0xa2/0xd0 fs/incfs/vfs.c:1607
 destroy_inode fs/inode.c:319 [inline]
 evict+0x7c4/0xa90 fs/inode.c:761
 dispose_list fs/inode.c:779 [inline]
 evict_inodes+0x607/0x680 fs/inode.c:833
 generic_shutdown_super+0x9d/0x300 fs/super.c:630
 kill_anon_super+0x4b/0x1d0 fs/super.c:1240
 incfs_kill_sb+0x50/0x230 fs/incfs/vfs.c:1960
 deactivate_locked_super+0xd5/0x2a0 fs/super.c:476
 deactivate_super+0xb8/0xe0 fs/super.c:509
 cleanup_mnt+0x3f1/0x480 fs/namespace.c:1374
 __cleanup_mnt+0x1d/0x40 fs/namespace.c:1381
 task_work_run+0x1e3/0x250 kernel/task_work.c:240
 resume_user_mode_work+0x36/0x50 include/linux/resume_user_mode.h:50
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x64/0xb0 kernel/entry/common.c:218
 do_syscall_64+0x64/0xf0 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x76/0x7e

The buggy address belongs to the object at ffff88811090a800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 64 bytes inside of
 freed 1024-byte region [ffff88811090a800, ffff88811090ac00)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x110908
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4000000000000040(head|zone=1)
page_type: f5(slab)
raw: 4000000000000040 ffff888100041dc0 ffffea00047cde00 dead000000000002
raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 4000000000000040 ffff888100041dc0 ffffea00047cde00 dead000000000002
head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 4000000000000003 ffffea0004424201 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 227, tgid 227 (dhcpcd), ts 14461798615, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook+0x3b9/0x3f0 mm/page_alloc.c:1795
 prep_new_page+0x1c/0x120 mm/page_alloc.c:1803
 get_page_from_freelist+0x46bb/0x4750 mm/page_alloc.c:3854
 __alloc_pages_noprof+0x30d/0x6c0 mm/page_alloc.c:5186
 alloc_slab_page+0x6b/0x1f0 mm/slub.c:-1
 allocate_slab+0x69/0x440 mm/slub.c:2655
 new_slab mm/slub.c:2709 [inline]
 ___slab_alloc+0x59a/0x8b0 mm/slub.c:3897
 __slab_alloc mm/slub.c:3987 [inline]
 __slab_alloc_node mm/slub.c:4040 [inline]
 slab_alloc_node mm/slub.c:4201 [inline]
 __do_kmalloc_node mm/slub.c:4346 [inline]
 __kmalloc_node_noprof+0x23e/0x450 mm/slub.c:4353
 __kvmalloc_node_noprof+0x11d/0x300 mm/util.c:671
 kvmalloc_array_node_noprof include/linux/slab.h:1043 [inline]
 bpf_int_jit_compile+0x362/0x1410 arch/x86/net/bpf_jit_comp.c:3425
 bpf_prog_select_runtime+0x373/0x690 kernel/bpf/core.c:2448
 bpf_migrate_filter net/core/filter.c:1317 [inline]
 bpf_prepare_filter+0x1012/0x1350 net/core/filter.c:1365
 bpf_prog_create_from_user+0x206/0x2c0 net/core/filter.c:1459
 seccomp_prepare_filter kernel/seccomp.c:693 [inline]
 seccomp_prepare_user_filter kernel/seccomp.c:730 [inline]
 seccomp_set_mode_filter kernel/seccomp.c:1965 [inline]
 do_seccomp+0x7bd/0xee0 kernel/seccomp.c:2085
 prctl_set_seccomp+0x50/0x80 kernel/seccomp.c:2138
 __do_sys_prctl kernel/sys.c:2558 [inline]
 __se_sys_prctl+0x2e4/0x1460 kernel/sys.c:2476
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811090a700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811090a780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811090a800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88811090a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811090a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/12 19:32 android16-6.12 21ed84930c16 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-12-rust KASAN: slab-use-after-free Read in capable_wrt_inode_uidgid
* Struck through repros no longer work on HEAD.