================================================================== 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 ffff88811677f3e8 by task kworker/1:31/2538 CPU: 1 PID: 2538 Comm: kworker/1:31 Not tainted 5.15.78-syzkaller-00911-gc73b4619ad86 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: events flush_stashed_error_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3d0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452 kasan_check_range+0x2aa/0x2e0 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+0x9a/0xd0 fs/sysfs/file.c:190 ext4_notify_error_sysfs+0x25/0x30 fs/ext4/sysfs.c:511 flush_stashed_error_work+0x305/0x320 process_one_work+0x6db/0xc00 kernel/workqueue.c:2313 worker_thread+0xb3e/0x1340 kernel/workqueue.c:2460 kthread+0x41c/0x500 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Allocated by task 3508: 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+0xb2/0xe0 mm/kasan/common.c:466 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook mm/slab.h:550 [inline] slab_alloc_node mm/slub.c:3236 [inline] slab_alloc mm/slub.c:3244 [inline] kmem_cache_alloc+0x189/0x2f0 mm/slub.c:3249 kmem_cache_zalloc include/linux/slab.h:711 [inline] __kernfs_new_node+0xdb/0x6e0 fs/kernfs/dir.c:593 kernfs_new_node fs/kernfs/dir.c:655 [inline] kernfs_create_dir_ns+0x9b/0x230 fs/kernfs/dir.c:991 sysfs_create_dir_ns+0x181/0x390 fs/sysfs/dir.c:59 create_dir lib/kobject.c:89 [inline] kobject_add_internal+0x766/0xda0 lib/kobject.c:255 kobject_add_varg lib/kobject.c:390 [inline] kobject_init_and_add+0x123/0x190 lib/kobject.c:473 ext4_register_sysfs+0xc0/0x2c0 fs/ext4/sysfs.c:524 ext4_fill_super+0x8983/0x9650 fs/ext4/super.c:4936 mount_bdev+0x280/0x3b0 fs/super.c:1369 ext4_mount+0x34/0x40 fs/ext4/super.c:6540 legacy_get_tree+0xf0/0x190 fs/fs_context.c:610 vfs_get_tree+0x88/0x290 fs/super.c:1499 do_new_mount+0x289/0xad0 fs/namespace.c:2994 path_mount+0x60b/0x1050 fs/namespace.c:3324 do_mount fs/namespace.c:3337 [inline] __do_sys_mount fs/namespace.c:3545 [inline] __se_sys_mount+0x2d2/0x3c0 fs/namespace.c:3522 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3522 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 657: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1721 [inline] slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1747 slab_free mm/slub.c:3515 [inline] kmem_cache_free+0x11a/0x2e0 mm/slub.c:3531 kernfs_put+0x3d9/0x540 fs/kernfs/dir.c:547 sysfs_put include/linux/sysfs.h:641 [inline] __kobject_del+0x10e/0x300 lib/kobject.c:621 kobject_del+0x45/0x60 lib/kobject.c:643 ext4_unregister_sysfs+0x91/0xa0 fs/ext4/sysfs.c:558 ext4_put_super+0x80/0xd70 fs/ext4/super.c:1174 generic_shutdown_super+0x157/0x2e0 fs/super.c:466 kill_block_super+0x80/0xe0 fs/super.c:1396 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1143 __cleanup_mnt+0x19/0x20 fs/namespace.c:1150 task_work_run+0x147/0x1b0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0xfd/0x110 kernel/entry/common.c:175 exit_to_user_mode_prepare kernel/entry/common.c:207 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x79/0xc0 kernel/entry/common.c:300 do_syscall_64+0x50/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff88811677f3e8 which belongs to the cache kernfs_node_cache of size 136 The buggy address is located 0 bytes inside of 136-byte region [ffff88811677f3e8, ffff88811677f470) The buggy address belongs to the page: page:ffffea000459dfc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11677f flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 0000000000000000 dead000000000122 ffff888100276a80 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 3515, ts 2631066974499, free_ts 2618548752105 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495 prep_new_page mm/page_alloc.c:2501 [inline] get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548 allocate_slab+0x62/0x580 mm/slub.c:1928 new_slab mm/slub.c:1991 [inline] ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3024 __slab_alloc+0x4a/0x90 mm/slub.c:3111 slab_alloc_node mm/slub.c:3202 [inline] slab_alloc mm/slub.c:3244 [inline] kmem_cache_alloc+0x205/0x2f0 mm/slub.c:3249 kmem_cache_zalloc include/linux/slab.h:711 [inline] __kernfs_new_node+0xdb/0x6e0 fs/kernfs/dir.c:593 kernfs_new_node fs/kernfs/dir.c:655 [inline] kernfs_create_dir_ns+0x9b/0x230 fs/kernfs/dir.c:991 internal_create_group+0x29d/0xf60 fs/sysfs/group.c:137 sysfs_create_group+0x1f/0x30 fs/sysfs/group.c:175 netdev_queue_add_kobject net/core/net-sysfs.c:1672 [inline] netdev_queue_update_kobjects+0x1b4/0x3e0 net/core/net-sysfs.c:1711 register_queue_kobjects net/core/net-sysfs.c:1772 [inline] netdev_register_kobject+0x270/0x320 net/core/net-sysfs.c:2018 register_netdevice+0x1133/0x1720 net/core/dev.c:10332 register_netdev+0x3c/0x50 net/core/dev.c:10456 ip6gre_init_net+0x251/0x320 net/ipv6/ip6_gre.c:1621 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1364 [inline] free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435 free_unref_page_prepare mm/page_alloc.c:3433 [inline] free_unref_page_list+0x16a/0xad0 mm/page_alloc.c:3554 release_pages+0xf3e/0xf90 mm/swap.c:1010 free_pages_and_swap_cache+0x97/0xb0 mm/swap_state.c:320 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu+0x860/0xa00 mm/mmu_gather.c:249 tlb_finish_mmu+0xd2/0x1f0 mm/mmu_gather.c:340 exit_mmap+0x46e/0x7a0 mm/mmap.c:3202 __mmput+0x95/0x300 kernel/fork.c:1162 mmput+0x50/0x60 kernel/fork.c:1184 exit_mm+0x50d/0x760 kernel/exit.c:504 do_exit+0x63c/0x24d0 kernel/exit.c:815 do_group_exit+0x13a/0x300 kernel/exit.c:925 get_signal+0x77e/0x1600 kernel/signal.c:2890 arch_do_signal_or_restart+0x9f/0x670 arch/x86/kernel/signal.c:865 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop+0xd4/0x110 kernel/entry/common.c:172 exit_to_user_mode_prepare kernel/entry/common.c:207 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x79/0xc0 kernel/entry/common.c:300 Memory state around the buggy address: ffff88811677f280: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88811677f300: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb >ffff88811677f380: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb ^ ffff88811677f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ffff88811677f480: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb ==================================================================