================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x42e4/0x5e20 kernel/locking/lockdep.c:5012 Read of size 8 at addr ffff8880763b6418 by task syz-executor.0/17002 CPU: 0 PID: 17002 Comm: syz-executor.0 Not tainted 6.5.0-rc1-syzkaller-00006-g3f01e9fed845 #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+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:364 print_report mm/kasan/report.c:475 [inline] kasan_report+0x11d/0x130 mm/kasan/report.c:588 __lock_acquire+0x42e4/0x5e20 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5726 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:394 [inline] p9_req_put net/9p/client.c:402 [inline] p9_req_put+0xca/0x250 net/9p/client.c:399 req_done+0x1e2/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2501 [inline] vring_interrupt+0x2a1/0x3d0 drivers/virtio/virtio_ring.c:2476 __handle_irq_event_percpu+0x22b/0x730 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:834 generic_handle_irq_desc include/linux/irqdesc.h:161 [inline] handle_irq arch/x86/kernel/irq.c:238 [inline] __common_interrupt+0xa1/0x220 arch/x86/kernel/irq.c:257 common_interrupt+0xa8/0xd0 arch/x86/kernel/irq.c:247 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:636 RIP: 0010:bpf_lsm_inode_need_killpriv+0x0/0x10 include/linux/lsm_hook_defs.h:154 Code: 68 dc ff 31 c0 c3 0f 1f 40 00 f3 0f 1e fa e8 77 68 dc ff 31 c0 c3 0f 1f 40 00 f3 0f 1e fa e8 67 68 dc ff 31 c0 c3 0f 1f 40 00 0f 1e fa e8 57 68 dc ff 31 c0 c3 0f 1f 40 00 f3 0f 1e fa e8 47 RSP: 0018:ffffc9000f9cfb98 EFLAGS: 00000246 RAX: 1ffffffff186fbe7 RBX: ffffffff8c37df20 RCX: ffffc90007451000 RDX: 0000000000040000 RSI: ffffffff83d102ed RDI: ffff8880280398f8 RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 R13: ffff8880280398f8 R14: ffff88806b524650 R15: ffff88806b52465c security_inode_need_killpriv+0x44/0xa0 security/security.c:2329 dentry_needs_remove_privs fs/inode.c:2011 [inline] __file_remove_privs+0x3b2/0x650 fs/inode.c:2042 __generic_file_write_iter+0x86/0x240 mm/filemap.c:3995 generic_file_write_iter+0xe3/0x350 mm/filemap.c:4044 call_write_iter include/linux/fs.h:1871 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x981/0xda0 fs/read_write.c:584 ksys_write+0x122/0x250 fs/read_write.c:637 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 RIP: 0023:0xf7f1b579 Code: 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 00 00 00 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:00000000f7f163c0 EFLAGS: 00000282 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00000000ed9ff000 RDX: 0000000000040000 RSI: 00000000f734e000 RDI: 0000000000000000 RBP: 00000000f7f16480 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 16990: 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:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] p9_client_create+0xb3/0x1140 net/9p/client.c:979 v9fs_session_init+0x1e4/0x1980 fs/9p/v9fs.c:410 v9fs_mount+0xbe/0xc90 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x8d/0x350 fs/super.c:1519 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x136e/0x1e70 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x282/0x300 fs/namespace.c:3861 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 16990: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____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:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2d0 mm/slub.c:3814 p9_client_create+0x7cc/0x1140 net/9p/client.c:1050 v9fs_session_init+0x1e4/0x1980 fs/9p/v9fs.c:410 v9fs_mount+0xbe/0xc90 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:611 vfs_get_tree+0x8d/0x350 fs/super.c:1519 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x136e/0x1e70 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x282/0x300 fs/namespace.c:3861 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+0xb9/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbc0 kernel/rcu/tree.c:3368 drop_sysctl_table+0x3c2/0x4e0 fs/proc/proc_sysctl.c:1506 unregister_sysctl_table fs/proc/proc_sysctl.c:1527 [inline] unregister_sysctl_table+0x41/0x60 fs/proc/proc_sysctl.c:1519 mpls_dev_sysctl_unregister net/mpls/af_mpls.c:1446 [inline] mpls_dev_notify+0x672/0x9a0 net/mpls/af_mpls.c:1658 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline] call_netdevice_notifiers net/core/dev.c:2014 [inline] unregister_netdevice_many_notify+0x75f/0x18c0 net/core/dev.c:10850 vti6_exit_batch_net+0x3c3/0x730 net/ipv6/ip6_vti.c:1188 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614 process_one_work+0xa34/0x16f0 kernel/workqueue.c:2597 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2748 kthread+0x344/0x440 kernel/kthread.c:389 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb9/0xd0 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2649 in_dev_finish_destroy+0x15d/0x1d0 net/ipv4/devinet.c:258 in_dev_put include/linux/inetdevice.h:279 [inline] inetdev_destroy net/ipv4/devinet.c:332 [inline] inetdev_event+0x156a/0x1850 net/ipv4/devinet.c:1606 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline] call_netdevice_notifiers net/core/dev.c:2014 [inline] unregister_netdevice_many_notify+0x75f/0x18c0 net/core/dev.c:10850 sit_exit_batch_net+0x4a4/0x580 net/ipv6/sit.c:1887 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614 process_one_work+0xa34/0x16f0 kernel/workqueue.c:2597 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2748 kthread+0x344/0x440 kernel/kthread.c:389 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the object at ffff8880763b6400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880763b6400, ffff8880763b6600) The buggy address belongs to the physical page: page:ffffea0001d8ed00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x763b4 head:ffffea0001d8ed00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 04fff00000010200 ffff888012842c80 ffffea00012e2900 dead000000000002 raw: 0000000000000000 0000000080100010 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9326, tgid 9312 (syz-executor.1), ts 570365509169, free_ts 567906851513 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0xfed/0x2d30 mm/page_alloc.c:3221 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4477 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x25f/0x390 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0xbc3/0x15d0 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x143/0x350 mm/slub.c:3509 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1076 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] inetdev_init+0x66/0x580 net/ipv4/devinet.c:269 inetdev_event+0xf92/0x1850 net/ipv4/devinet.c:1538 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline] call_netdevice_notifiers net/core/dev.c:2014 [inline] register_netdevice+0xfb4/0x1640 net/core/dev.c:10084 register_netdev+0x31/0x50 net/core/dev.c:10179 ip6_tnl_init_net+0x2a4/0x450 net/ipv6/ip6_tunnel.c:2255 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2348 free_unref_page+0x33/0x370 mm/page_alloc.c:2443 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3470 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x173/0x390 mm/slub.c:3494 ptlock_alloc+0x21/0x70 mm/memory.c:6062 ptlock_init include/linux/mm.h:2797 [inline] pgtable_pte_page_ctor include/linux/mm.h:2818 [inline] __pte_alloc_one include/asm-generic/pgalloc.h:66 [inline] pte_alloc_one+0x6c/0x230 arch/x86/mm/pgtable.c:33 __pte_alloc+0x6d/0x260 mm/memory.c:440 copy_pte_range mm/memory.c:1028 [inline] copy_pmd_range mm/memory.c:1167 [inline] copy_pud_range mm/memory.c:1204 [inline] copy_p4d_range mm/memory.c:1228 [inline] copy_page_range+0x1d2a/0x3ad0 mm/memory.c:1326 dup_mmap+0x1325/0x1bc0 kernel/fork.c:758 dup_mm kernel/fork.c:1689 [inline] copy_mm kernel/fork.c:1738 [inline] copy_process+0x6663/0x75c0 kernel/fork.c:2504 kernel_clone+0xeb/0x890 kernel/fork.c:2912 __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 Memory state around the buggy address: ffff8880763b6300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880763b6380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880763b6400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880763b6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880763b6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 68 dc ff 31 c0 pushq $0xffffffffc031ffdc 5: c3 retq 6: 0f 1f 40 00 nopl 0x0(%rax) a: f3 0f 1e fa endbr64 e: e8 77 68 dc ff callq 0xffdc688a 13: 31 c0 xor %eax,%eax 15: c3 retq 16: 0f 1f 40 00 nopl 0x0(%rax) 1a: f3 0f 1e fa endbr64 1e: e8 67 68 dc ff callq 0xffdc688a 23: 31 c0 xor %eax,%eax 25: c3 retq 26: 0f 1f 40 00 nopl 0x0(%rax) * 2a: f3 0f 1e fa endbr64 <-- trapping instruction 2e: e8 57 68 dc ff callq 0xffdc688a 33: 31 c0 xor %eax,%eax 35: c3 retq 36: 0f 1f 40 00 nopl 0x0(%rax) 3a: f3 0f 1e fa endbr64 3e: e8 .byte 0xe8 3f: 47 rex.RXB