================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline] BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline] BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0xeb/0x750 kernel/locking/mutex.c:860 Read of size 8 at addr ffff888028e79110 by task init/8886 CPU: 1 PID: 8886 Comm: init Not tainted 5.15.167-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __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 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:71 [inline] atomic_long_read include/linux/atomic/atomic-instrumented.h:1183 [inline] __mutex_unlock_slowpath+0xeb/0x750 kernel/locking/mutex.c:860 device_unlock include/linux/device.h:775 [inline] device_shutdown+0x4b6/0x620 drivers/base/core.c:4555 kernel_shutdown_prepare kernel/reboot.c:266 [inline] kernel_power_off+0x4f/0xb0 kernel/reboot.c:291 __do_sys_reboot kernel/reboot.c:366 [inline] __se_sys_reboot+0x4b2/0x540 kernel/reboot.c:312 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:0x7fb521c608b4 Code: f0 ff ff 73 01 c3 48 8b 0d 71 55 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 45 55 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffdfea92d58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a9 RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fb521c608b4 RDX: 000000004321fedc RSI: 0000000028121969 RDI: 00000000fee1dead RBP: 000000004321fedc R08: 0000000000000000 R09: 0000000000000000 R10: 00007ffdfea92d30 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdfea92db8 R14: 0000560830e67169 R15: 00007fb521e38a80 Allocated by task 8802: 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_kmalloc+0xba/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] nsim_bus_dev_new drivers/net/netdevsim/bus.c:408 [inline] new_device_store+0x238/0x910 drivers/net/netdevsim/bus.c:302 kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 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 Freed by task 8874: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0xf1/0x270 mm/slub.c:4559 nsim_bus_dev_del drivers/net/netdevsim/bus.c:457 [inline] del_device_store+0x36f/0x470 drivers/net/netdevsim/bus.c:354 kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 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 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087 in6_dev_put include/net/addrconf.h:386 [inline] addrconf_ifdown+0x193c/0x1bb0 net/ipv6/addrconf.c:3934 addrconf_notify+0x432/0xf30 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391 call_netdevice_notifiers_info net/core/dev.c:2018 [inline] call_netdevice_notifiers_extack net/core/dev.c:2030 [inline] call_netdevice_notifiers net/core/dev.c:2044 [inline] unregister_netdevice_many+0xf1b/0x18f0 net/core/dev.c:11094 xfrmi_exit_batch_net+0x234/0x280 net/xfrm/xfrm_interface_core.c:810 ops_exit_list net/core/net_namespace.c:177 [inline] cleanup_net+0x763/0xb60 net/core/net_namespace.c:599 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 insert_work+0x54/0x3e0 kernel/workqueue.c:1366 __queue_work+0x963/0xd00 kernel/workqueue.c:1532 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1491 [inline] __run_timers+0x6a8/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 The buggy address belongs to the object at ffff888028e79000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 272 bytes inside of 2048-byte region [ffff888028e79000, ffff888028e79800) The buggy address belongs to the page: page:ffffea0000a39e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888028e78000 pfn:0x28e78 head:ffffea0000a39e00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001df7c08 ffffea0001d4a008 ffff888017042000 raw: ffff888028e78000 0000000000080007 00000001ffffffff 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7917, ts 409844699642, free_ts 409792876507 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_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] __kmalloc+0x1c9/0x300 mm/slub.c:4403 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] rfkill_alloc+0x94/0x250 net/rfkill/core.c:972 wiphy_new_nm+0x1122/0x1750 net/wireless/core.c:529 ieee80211_alloc_hw_nm+0x338/0x2060 net/mac80211/main.c:592 mac80211_hwsim_new_radio+0x12a/0x4200 drivers/net/wireless/mac80211_hwsim.c:3070 hwsim_new_radio_nl+0xbae/0x1090 drivers/net/wireless/mac80211_hwsim.c:3950 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2503 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] __sys_sendto+0x564/0x720 net/socket.c:2058 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+0x95/0x2d0 mm/page_alloc.c:3396 put_page include/linux/mm.h:1247 [inline] page_to_skb+0x84d/0xd20 drivers/net/virtio_net.c:509 receive_mergeable drivers/net/virtio_net.c:1070 [inline] receive_buf+0x11ff/0x65b0 drivers/net/virtio_net.c:1180 virtnet_receive drivers/net/virtio_net.c:1472 [inline] virtnet_poll+0x616/0x1260 drivers/net/virtio_net.c:1585 __napi_poll+0xc7/0x440 net/core/dev.c:7035 napi_poll net/core/dev.c:7102 [inline] net_rx_action+0x617/0xda0 net/core/dev.c:7192 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558 __do_softirq kernel/softirq.c:592 [inline] invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653 common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x22/0x40 arch/x86/include/asm/idtentry.h:629 lock_acquire+0x252/0x4f0 kernel/locking/lockdep.c:5627 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:363 [inline] dont_mount+0x1a/0x60 include/linux/dcache.h:357 vfs_unlink+0x37c/0x5f0 fs/namei.c:4282 Memory state around the buggy address: ffff888028e79000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888028e79080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888028e79100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888028e79180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888028e79200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================