================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline] BUG: KASAN: use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] BUG: KASAN: use-after-free in kernfs_get+0x21/0x90 fs/kernfs/dir.c:504 Read of size 4 at addr ffff88810ef22708 by task kworker/0:0/6 CPU: 0 PID: 6 Comm: kworker/0:0 Tainted: G W 5.15.185-syzkaller-00339-ge678c93d43cc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: events flush_stashed_error_work Call Trace: __dump_stack+0x21/0x30 lib/dump_stack.c:88 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0xf1/0x140 mm/kasan/report.c:444 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x280/0x290 mm/kasan/generic.c:189 __kasan_check_read+0x11/0x20 mm/kasan/shadow.c:31 instrument_atomic_read include/linux/instrumented.h:71 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] kernfs_get+0x21/0x90 fs/kernfs/dir.c:504 sysfs_notify+0x5a/0xd0 fs/sysfs/file.c:190 ext4_notify_error_sysfs+0x25/0x30 fs/ext4/sysfs.c:516 flush_stashed_error_work+0x2d5/0x2f0 fs/ext4/super.c:-1 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472 kthread+0x411/0x500 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 7902: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:433 [inline] __kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:466 kasan_slab_alloc include/linux/kasan.h:217 [inline] slab_post_alloc_hook+0x4f/0x2b0 mm/slab.h:550 slab_alloc_node mm/slub.c:3240 [inline] slab_alloc mm/slub.c:3250 [inline] kmem_cache_alloc+0xf7/0x260 mm/slub.c:3255 kmem_cache_zalloc include/linux/slab.h:737 [inline] __kernfs_new_node+0xdb/0x680 fs/kernfs/dir.c:593 kernfs_new_node+0x150/0x260 fs/kernfs/dir.c:669 kernfs_create_dir_ns+0x47/0x130 fs/kernfs/dir.c:1017 sysfs_create_dir_ns+0x11c/0x280 fs/sysfs/dir.c:59 create_dir lib/kobject.c:89 [inline] kobject_add_internal+0x755/0xda0 lib/kobject.c:263 kobject_add_varg lib/kobject.c:398 [inline] kobject_init_and_add+0x122/0x190 lib/kobject.c:481 ext4_register_sysfs+0xbb/0x2c0 fs/ext4/sysfs.c:529 ext4_fill_super+0x863b/0x9030 fs/ext4/super.c:4941 mount_bdev+0x2ae/0x3e0 fs/super.c:1400 ext4_mount+0x34/0x40 fs/ext4/super.c:6618 legacy_get_tree+0xed/0x190 fs/fs_context.c:611 vfs_get_tree+0x89/0x260 fs/super.c:1530 do_new_mount+0x25a/0xa20 fs/namespace.c:3010 path_mount+0x675/0x1020 fs/namespace.c:3340 do_mount fs/namespace.c:3353 [inline] __do_sys_mount fs/namespace.c:3561 [inline] __se_sys_mount+0x318/0x380 fs/namespace.c:3538 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3538 x64_sys_call+0x6bf/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:166 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 7902: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373 kasan_slab_free include/linux/kasan.h:193 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1749 slab_free mm/slub.c:3521 [inline] kmem_cache_free+0x100/0x320 mm/slub.c:3539 kernfs_put+0x310/0x480 fs/kernfs/dir.c:547 sysfs_put include/linux/sysfs.h:641 [inline] __kobject_del+0xf8/0x2f0 lib/kobject.c:629 kobject_del+0x45/0x60 lib/kobject.c:651 ext4_unregister_sysfs+0x91/0xa0 fs/ext4/sysfs.c:563 ext4_put_super+0x70/0xa70 fs/ext4/super.c:1183 generic_shutdown_super+0x151/0x330 fs/super.c:475 kill_block_super+0x7f/0xf0 fs/super.c:1427 deactivate_locked_super+0xa0/0x100 fs/super.c:335 deactivate_super+0xaf/0xe0 fs/super.c:366 cleanup_mnt+0x446/0x500 fs/namespace.c:1139 __cleanup_mnt+0x19/0x20 fs/namespace.c:1146 task_work_run+0x127/0x190 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0xd0/0xe0 kernel/entry/common.c:181 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88810ef22708 which belongs to the cache kernfs_node_cache of size 136 The buggy address is located 0 bytes inside of 136-byte region [ffff88810ef22708, ffff88810ef22790) The buggy address belongs to the page: page:ffffea00043bc880 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10ef22 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea00043bc900 0000000e0000000e ffff8881001c4000 raw: 0000000000000000 0000000000140014 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 7793, ts 439062699184, free_ts 439046384145 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5789 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1932 [inline] new_slab+0xa1/0x4d0 mm/slub.c:1995 ___slab_alloc+0x381/0x810 mm/slub.c:3028 __slab_alloc+0x49/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3250 [inline] kmem_cache_alloc+0x138/0x260 mm/slub.c:3255 kmem_cache_zalloc include/linux/slab.h:737 [inline] __kernfs_new_node+0xdb/0x680 fs/kernfs/dir.c:593 kernfs_new_node+0x150/0x260 fs/kernfs/dir.c:669 __kernfs_create_file+0x4e/0x270 fs/kernfs/file.c:987 sysfs_add_file_mode_ns+0x29a/0x350 fs/sysfs/file.c:317 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x489/0xcf0 fs/sysfs/group.c:149 internal_create_groups fs/sysfs/group.c:189 [inline] sysfs_create_groups+0x58/0x120 fs/sysfs/group.c:215 device_add_groups drivers/base/core.c:2501 [inline] device_add_attrs+0x155/0x700 drivers/base/core.c:2660 device_add+0x5e3/0xed0 drivers/base/core.c:3373 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616 free_the_page mm/page_alloc.c:805 [inline] __free_pages+0x6c/0x100 mm/page_alloc.c:5865 free_pages+0x82/0x90 mm/page_alloc.c:5876 kasan_depopulate_vmalloc_pte+0x6b/0x90 mm/kasan/shadow.c:354 apply_to_pte_range mm/memory.c:2642 [inline] apply_to_pmd_range mm/memory.c:2686 [inline] apply_to_pud_range mm/memory.c:2722 [inline] apply_to_p4d_range mm/memory.c:2758 [inline] __apply_to_page_range+0x8b0/0xbf0 mm/memory.c:2794 apply_to_existing_page_range+0x38/0x50 mm/memory.c:2827 kasan_release_vmalloc+0x97/0xb0 mm/kasan/shadow.c:464 __purge_vmap_area_lazy+0xc05/0x1840 mm/vmalloc.c:1715 _vm_unmap_aliases+0x2fd/0x380 mm/vmalloc.c:2118 vm_unmap_aliases+0x19/0x20 mm/vmalloc.c:2141 change_page_attr_set_clr+0x311/0xc10 arch/x86/mm/pat/set_memory.c:1740 change_page_attr_clear arch/x86/mm/pat/set_memory.c:1797 [inline] set_memory_ro+0x89/0xd0 arch/x86/mm/pat/set_memory.c:1943 bpf_jit_binary_lock_ro include/linux/filter.h:899 [inline] bpf_int_jit_compile+0xc493/0xcc60 arch/x86/net/bpf_jit_comp.c:2478 bpf_prog_select_runtime+0x6f1/0x9f0 kernel/bpf/core.c:1934 bpf_prog_load+0x106d/0x1550 kernel/bpf/syscall.c:2332 Memory state around the buggy address: ffff88810ef22600: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ffff88810ef22680: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc >ffff88810ef22700: fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810ef22780: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb ffff88810ef22800: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc ================================================================== general protection fault, probably for non-canonical address 0xfd8ffc29800003e5: 0000 [#1] PREEMPT SMP KASAN KASAN: maybe wild-memory-access in range [0xec80014c00001f28-0xec80014c00001f2f] CPU: 0 PID: 6 Comm: kworker/0:0 Tainted: G B W 5.15.185-syzkaller-00339-ge678c93d43cc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: events flush_stashed_error_work RIP: 0010:kernfs_root fs/kernfs/kernfs-internal.h:50 [inline] RIP: 0010:kernfs_find_and_get_ns+0x54/0x110 fs/kernfs/dir.c:884 Code: 48 89 f8 48 c1 e8 03 42 80 3c 28 00 74 05 e8 73 a3 d8 ff 49 8b 5c 24 08 48 85 db 49 0f 44 dc 48 83 c3 50 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 4d a3 d8 ff 48 8b 1b 48 83 c3 68 RSP: 0018:ffffc90000067c60 EFLAGS: 00010a03 RAX: 1d900029800003e5 RBX: ec80014c00001f2e RCX: ffffffff81ce74ed RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88810ef22710 RBP: ffffc90000067c88 R08: fffffffffffffffa R09: 0000000000000003 R10: ffffed1021de44e1 R11: 1ffff11021de44e1 R12: ffff88810ef22708 R13: dffffc0000000000 R14: 0000000000000000 R15: ffffffff854f0360 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00002000000c0000 CR3: 000000011e1b7000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 000000000000000e DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: kernfs_find_and_get include/linux/kernfs.h:574 [inline] sysfs_notify+0x71/0xd0 fs/sysfs/file.c:193 ext4_notify_error_sysfs+0x25/0x30 fs/ext4/sysfs.c:516 flush_stashed_error_work+0x2d5/0x2f0 fs/ext4/super.c:-1 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472 kthread+0x411/0x500 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Modules linked in: ---[ end trace 9f5c1eef7ebd391c ]--- RIP: 0010:kernfs_root fs/kernfs/kernfs-internal.h:50 [inline] RIP: 0010:kernfs_find_and_get_ns+0x54/0x110 fs/kernfs/dir.c:884 Code: 48 89 f8 48 c1 e8 03 42 80 3c 28 00 74 05 e8 73 a3 d8 ff 49 8b 5c 24 08 48 85 db 49 0f 44 dc 48 83 c3 50 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 4d a3 d8 ff 48 8b 1b 48 83 c3 68 RSP: 0018:ffffc90000067c60 EFLAGS: 00010a03 RAX: 1d900029800003e5 RBX: ec80014c00001f2e RCX: ffffffff81ce74ed RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88810ef22710 RBP: ffffc90000067c88 R08: fffffffffffffffa R09: 0000000000000003 R10: ffffed1021de44e1 R11: 1ffff11021de44e1 R12: ffff88810ef22708 R13: dffffc0000000000 R14: 0000000000000000 R15: ffffffff854f0360 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f3581acbbac CR3: 000000000660f000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 000000000000000e DR6: 00000000ffff0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 48 89 f8 mov %rdi,%rax 3: 48 c1 e8 03 shr $0x3,%rax 7: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) c: 74 05 je 0x13 e: e8 73 a3 d8 ff call 0xffd8a386 13: 49 8b 5c 24 08 mov 0x8(%r12),%rbx 18: 48 85 db test %rbx,%rbx 1b: 49 0f 44 dc cmove %r12,%rbx 1f: 48 83 c3 50 add $0x50,%rbx 23: 48 89 d8 mov %rbx,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 48 89 df mov %rbx,%rdi 34: e8 4d a3 d8 ff call 0xffd8a386 39: 48 8b 1b mov (%rbx),%rbx 3c: 48 83 c3 68 add $0x68,%rbx