================================================================== BUG: KASAN: use-after-free in sysfs_remove_file_ns+0x63/0x70 fs/sysfs/file.c:510 Read of size 8 at addr ffff8880328d5630 by task syz.2.1136/10642 CPU: 1 UID: 0 PID: 10642 Comm: syz.2.1136 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 sysfs_remove_file_ns+0x63/0x70 fs/sysfs/file.c:510 sysfs_remove_file include/linux/sysfs.h:770 [inline] driver_remove_file drivers/base/driver.c:201 [inline] driver_remove_file+0x4a/0x60 drivers/base/driver.c:197 remove_bind_files drivers/base/bus.c:605 [inline] bus_remove_driver+0x224/0x2c0 drivers/base/bus.c:743 driver_unregister+0x76/0xb0 drivers/base/driver.c:277 comedi_device_detach_locked+0x12f/0xa50 drivers/comedi/drivers.c:207 do_devconfig_ioctl+0x555/0x710 drivers/comedi/comedi_fops.c:848 comedi_unlocked_ioctl+0x165d/0x2f00 drivers/comedi/comedi_fops.c:2178 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fdf5958efc9 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:00007fdf5a36b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fdf597e6090 RCX: 00007fdf5958efc9 RDX: 0000000000000000 RSI: 0000000040946400 RDI: 000000000000000a RBP: 00007fdf59611f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fdf597e6128 R14: 00007fdf597e6090 R15: 00007ffce10a1e38 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffffffffffffffff pfn:0x328d5 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 00000000ffffffff 0000000000000000 raw: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 10071, tgid 10071 (syz.1.982), ts 485261337656, free_ts 499912343203 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:3055 [inline] allocate_slab mm/slub.c:3228 [inline] new_slab+0x24a/0x360 mm/slub.c:3282 ___slab_alloc+0xdae/0x1a60 mm/slub.c:4651 __kmem_cache_alloc_bulk+0x225/0x770 mm/slub.c:7394 refill_sheaf mm/slub.c:2633 [inline] kmem_cache_prefill_sheaf+0x1c3/0x430 mm/slub.c:5411 mt_get_sheaf lib/maple_tree.c:187 [inline] mas_alloc_nodes lib/maple_tree.c:1138 [inline] mas_preallocate+0xb00/0x11f0 lib/maple_tree.c:5192 vma_iter_prealloc mm/vma.h:442 [inline] __split_vma+0x34a/0x1070 mm/vma.c:528 split_vma mm/vma.c:598 [inline] vma_modify+0xee1/0x2030 mm/vma.c:1631 vma_modify_flags+0x212/0x2d0 mm/vma.c:1649 mprotect_fixup+0x1df/0xb40 mm/mprotect.c:816 do_mprotect_pkey+0x9bc/0xd40 mm/mprotect.c:990 __do_sys_mprotect mm/mprotect.c:1011 [inline] __se_sys_mprotect mm/mprotect.c:1008 [inline] __x64_sys_mprotect+0x78/0xc0 mm/mprotect.c:1008 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 page last free pid 10382 tgid 10381 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906 discard_slab mm/slub.c:3326 [inline] __put_partials+0x130/0x170 mm/slub.c:3872 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:352 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4970 [inline] slab_alloc_node mm/slub.c:5280 [inline] __do_kmalloc_node mm/slub.c:5641 [inline] __kmalloc_noprof+0x2e8/0x880 mm/slub.c:5654 kmalloc_noprof include/linux/slab.h:961 [inline] tomoyo_realpath_from_path+0xc2/0x6e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x245/0x580 security/tomoyo/file.c:723 security_file_ioctl+0x9b/0x240 security/security.c:2982 __do_sys_ioctl fs/ioctl.c:591 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0xb7/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880328d5500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880328d5580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880328d5600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880328d5680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880328d5700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================