================================================================== BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock+0x265/0x2b0 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff88805ad02404 by task syz-executor.1/5179 CPU: 1 PID: 5179 Comm: syz-executor.1 Not tainted 6.2.0-rc4-syzkaller-00067-g7287904c8771 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x265/0x2b0 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x45/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:390 [inline] p9_req_put net/9p/client.c:398 [inline] p9_req_put+0xca/0x250 net/9p/client.c:395 req_done+0x1e2/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2470 [inline] vring_interrupt+0x2a1/0x3d0 drivers/virtio/virtio_ring.c:2445 __handle_irq_event_percpu+0x264/0x970 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x263/0xd00 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0xa1/0x210 arch/x86/kernel/irq.c:250 common_interrupt+0xa8/0xd0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640 RIP: 0010:kasan_mem_to_shadow include/linux/kasan.h:60 [inline] RIP: 0010:memory_is_poisoned_n mm/kasan/generic.c:128 [inline] RIP: 0010:memory_is_poisoned mm/kasan/generic.c:159 [inline] RIP: 0010:check_region_inline mm/kasan/generic.c:180 [inline] RIP: 0010:kasan_check_range+0x56/0x190 mm/kasan/generic.c:189 Code: 39 c7 0f 86 05 01 00 00 49 83 e9 01 48 89 fd 48 b8 00 00 00 00 00 fc ff df 4d 89 ca 48 c1 ed 03 49 c1 ea 03 48 01 c5 49 01 c2 <48> 89 e8 49 8d 5a 01 48 89 da 48 29 ea 48 83 fa 10 7e 63 41 89 eb RSP: 0018:ffffc90003cef660 EFLAGS: 00000286 RAX: dffffc0000000000 RBX: 0000000000000003 RCX: ffffffff81640029 RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff8e72f7d0 RBP: fffffbfff1ce5efa R08: 0000000000000000 R09: ffffffff8e72f7d7 R10: fffffbfff1ce5efa R11: 0000000000000000 R12: ffffffff8c791b00 R13: ffff888024d0a000 R14: 0000000000000001 R15: ffff888024d0a000 instrument_atomic_read include/linux/instrumented.h:72 [inline] _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] cpumask_test_cpu include/linux/cpumask.h:444 [inline] cpu_online include/linux/cpumask.h:1030 [inline] trace_lock_release include/trace/events/lock.h:69 [inline] lock_release+0xd9/0x810 kernel/locking/lockdep.c:5679 rcu_lock_release include/linux/rcupdate.h:330 [inline] rcu_read_unlock include/linux/rcupdate.h:797 [inline] xa_load+0x15c/0x290 lib/xarray.c:1467 list_lru_from_memcg_idx mm/list_lru.c:56 [inline] list_lru_from_memcg_idx mm/list_lru.c:53 [inline] list_lru_count_one+0x1bf/0x2e0 mm/list_lru.c:185 list_lru_shrink_count include/linux/list_lru.h:122 [inline] super_cache_count+0x1b5/0x2e0 fs/super.c:147 do_shrink_slab+0x7e/0xce0 mm/vmscan.c:790 shrink_slab_memcg mm/vmscan.c:912 [inline] shrink_slab+0x388/0x660 mm/vmscan.c:991 shrink_node_memcgs mm/vmscan.c:6140 [inline] shrink_node+0x95d/0x1f40 mm/vmscan.c:6169 shrink_zones mm/vmscan.c:6407 [inline] do_try_to_free_pages+0x3b4/0x17a0 mm/vmscan.c:6469 try_to_free_mem_cgroup_pages+0x3ae/0xa80 mm/vmscan.c:6786 reclaim_high.constprop.0+0x185/0x230 mm/memcontrol.c:2394 mem_cgroup_handle_over_high+0x190/0x520 mm/memcontrol.c:2580 resume_user_mode_work include/linux/resume_user_mode.h:58 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x18c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f96549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000ffdb717c EFLAGS: 00000292 ORIG_RAX: 0000000000000034 RAX: ffffffffffffffea RBX: 00000000ffdb7220 RCX: 000000000000000a RDX: 00000000f734d000 RSI: 0000000000000000 RDI: 00000000f72a2535 RBP: 00000000ffdb7220 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 1720: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:580 [inline] p9_client_create+0xb3/0x1070 net/9p/client.c:975 v9fs_session_init+0x1e6/0x18b0 fs/9p/v9fs.c:407 v9fs_mount+0xbe/0xca0 fs/9p/vfs_super.c:125 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489 do_new_mount fs/namespace.c:3145 [inline] path_mount+0x132a/0x1e20 fs/namespace.c:3475 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount fs/namespace.c:3674 [inline] __ia32_sys_mount+0x282/0x300 fs/namespace.c:3674 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 1720: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0xaf/0x3b0 mm/slub.c:3800 p9_client_create+0x7aa/0x1070 net/9p/client.c:1046 v9fs_session_init+0x1e6/0x18b0 fs/9p/v9fs.c:407 v9fs_mount+0xbe/0xca0 fs/9p/vfs_super.c:125 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489 do_new_mount fs/namespace.c:3145 [inline] path_mount+0x132a/0x1e20 fs/namespace.c:3475 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount fs/namespace.c:3674 [inline] __ia32_sys_mount+0x282/0x300 fs/namespace.c:3674 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488 kvfree_call_rcu+0x78/0x8f0 kernel/rcu/tree.c:3376 ma_put net/ipv6/mcast.c:869 [inline] ma_put+0x11c/0x180 net/ipv6/mcast.c:865 __ipv6_dev_mc_dec+0x27c/0x340 net/ipv6/mcast.c:982 ipv6_mc_destroy_dev+0x2ca/0x630 net/ipv6/mcast.c:2800 addrconf_ifdown.isra.0+0x12c2/0x1920 net/ipv6/addrconf.c:3893 addrconf_notify+0x109/0x1c80 net/ipv6/addrconf.c:3673 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944 call_netdevice_notifiers_extack net/core/dev.c:1982 [inline] call_netdevice_notifiers net/core/dev.c:1996 [inline] unregister_netdevice_many_notify+0xa2b/0x19e0 net/core/dev.c:10839 ip_tunnel_delete_nets+0x3a3/0x5c0 net/ipv4/ip_tunnel.c:1126 ops_exit_list+0x125/0x170 net/core/net_namespace.c:174 setup_net+0x9bd/0xe60 net/core/net_namespace.c:356 copy_net_ns+0x31b/0x6b0 net/core/net_namespace.c:483 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x3b3/0x4a0 kernel/nsproxy.c:179 copy_process+0x30d3/0x7520 kernel/fork.c:2269 kernel_clone+0xeb/0x990 kernel/fork.c:2681 __do_compat_sys_ia32_clone+0x9e/0xd0 arch/x86/kernel/sys_ia32.c:254 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488 kvfree_call_rcu+0x78/0x8f0 kernel/rcu/tree.c:3376 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1709 unregister_sysctl_table fs/proc/proc_sysctl.c:1747 [inline] unregister_sysctl_table+0xc4/0x190 fs/proc/proc_sysctl.c:1722 neigh_sysctl_unregister+0x5f/0x80 net/core/neighbour.c:3873 addrconf_ifdown.isra.0+0x1350/0x1920 net/ipv6/addrconf.c:3903 addrconf_notify+0x109/0x1c80 net/ipv6/addrconf.c:3673 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1944 call_netdevice_notifiers_extack net/core/dev.c:1982 [inline] call_netdevice_notifiers net/core/dev.c:1996 [inline] unregister_netdevice_many_notify+0xa2b/0x19e0 net/core/dev.c:10839 vti6_exit_batch_net+0x3a4/0x670 net/ipv6/ip6_vti.c:1188 ops_exit_list+0x125/0x170 net/core/net_namespace.c:174 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:606 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the object at ffff88805ad02400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 4 bytes inside of 512-byte region [ffff88805ad02400, ffff88805ad02600) The buggy address belongs to the physical page: page:ffffea00016b4000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5ad00 head:ffffea00016b4000 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffff888012442c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5179, tgid 5179 (syz-executor.1), ts 117120110807, free_ts 117093849209 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2286 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x350 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x1a4/0x430 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc_node_track_caller+0x4b/0xc0 mm/slab_common.c:988 kmalloc_reserve net/core/skbuff.c:492 [inline] __alloc_skb+0xe9/0x310 net/core/skbuff.c:565 alloc_skb include/linux/skbuff.h:1270 [inline] nlmsg_new include/net/netlink.h:1002 [inline] netlink_ack+0x184/0x1370 net/netlink/af_netlink.c:2501 netlink_rcv_skb+0x34f/0x440 net/netlink/af_netlink.c:2570 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1932 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 __sys_sendto+0x23a/0x340 net/socket.c:2117 __do_compat_sys_socketcall+0x62e/0x720 net/compat.c:474 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3464 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slub.c:3452 [inline] __kmem_cache_alloc_node+0x1ea/0x430 mm/slub.c:3491 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] kobject_uevent_env+0x234/0x1620 lib/kobject_uevent.c:524 __kobject_del+0x160/0x1f0 lib/kobject.c:585 kobject_cleanup lib/kobject.c:664 [inline] kobject_release lib/kobject.c:704 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2f1/0x4d0 lib/kobject.c:721 netdev_queue_update_kobjects+0x36b/0x4f0 net/core/net-sysfs.c:1733 netif_set_real_num_tx_queues+0x1ba/0x770 net/core/dev.c:2886 veth_init_queues+0xdd/0x190 drivers/net/veth.c:1688 veth_newlink+0x687/0x9a0 drivers/net/veth.c:1814 rtnl_newlink_create net/core/rtnetlink.c:3407 [inline] __rtnl_newlink+0x10c2/0x1840 net/core/rtnetlink.c:3624 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3637 Memory state around the buggy address: ffff88805ad02300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805ad02380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88805ad02400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805ad02480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805ad02500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 39 c7 cmp %eax,%edi 2: 0f 86 05 01 00 00 jbe 0x10d 8: 49 83 e9 01 sub $0x1,%r9 c: 48 89 fd mov %rdi,%rbp f: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 16: fc ff df 19: 4d 89 ca mov %r9,%r10 1c: 48 c1 ed 03 shr $0x3,%rbp 20: 49 c1 ea 03 shr $0x3,%r10 24: 48 01 c5 add %rax,%rbp 27: 49 01 c2 add %rax,%r10 * 2a: 48 89 e8 mov %rbp,%rax <-- trapping instruction 2d: 49 8d 5a 01 lea 0x1(%r10),%rbx 31: 48 89 da mov %rbx,%rdx 34: 48 29 ea sub %rbp,%rdx 37: 48 83 fa 10 cmp $0x10,%rdx 3b: 7e 63 jle 0xa0 3d: 41 89 eb mov %ebp,%r11d