================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x42e4/0x5e20 kernel/locking/lockdep.c:5012 Read of size 8 at addr ffff88802c382018 by task syz-executor.1/19860 CPU: 3 PID: 19860 Comm: syz-executor.1 Not tainted 6.4.0-syzkaller-11989-g6843306689af #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:__sanitizer_cov_trace_const_cmp4+0x0/0x20 kernel/kcov.c:303 Code: d6 fe ff ff 66 0f 1f 44 00 00 f3 0f 1e fa 48 8b 0c 24 0f b7 d6 0f b7 f7 bf 03 00 00 00 e9 b8 fe ff ff 0f 1f 84 00 00 00 00 00 0f 1e fa 48 8b 0c 24 89 f2 89 fe bf 05 00 00 00 e9 9a fe ff ff RSP: 0018:ffffc90020b676d0 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 RDX: ffff888058229040 RSI: 0000000000000002 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffffea00017bbdc0 R13: 00007f6cf516e000 R14: 0000000000000000 R15: dffffc0000000000 zap_pte_range mm/memory.c:1454 [inline] zap_pmd_range mm/memory.c:1570 [inline] zap_pud_range mm/memory.c:1599 [inline] zap_p4d_range mm/memory.c:1620 [inline] unmap_page_range+0x1d52/0x30e0 mm/memory.c:1641 unmap_single_vma+0x19a/0x2b0 mm/memory.c:1687 unmap_vmas+0x234/0x380 mm/memory.c:1726 exit_mmap+0x19c/0x960 mm/mmap.c:3196 __mmput+0x128/0x4c0 kernel/fork.c:1347 mmput+0x60/0x70 kernel/fork.c:1369 exit_mm kernel/exit.c:567 [inline] do_exit+0x9a7/0x29a0 kernel/exit.c:861 do_group_exit+0xd4/0x2a0 kernel/exit.c:1024 get_signal+0x249b/0x25f0 kernel/signal.c:2877 arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:308 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x11f/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6cf508c389 Code: Unable to access opcode bytes at 0x7f6cf508c35f. RSP: 002b:00007f6cf5ec7218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: 0000000000000001 RBX: 00007f6cf51abf88 RCX: 00007f6cf508c389 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 00007f6cf51abf8c RBP: 00007f6cf51abf80 R08: 00007ffc3ebba080 R09: 0000000000000000 R10: ffffffffffffffff R11: 0000000000000246 R12: 00007f6cf51abf8c R13: 00007ffc3eb8c25f R14: 00007f6cf5ec7300 R15: 0000000000022000 Allocated by task 19858: 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+0xa3/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] __x64_sys_mount+0x283/0x300 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 19858: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcd/0x2c0 mm/slab.c:3564 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] __x64_sys_mount+0x283/0x300 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:491 kvfree_call_rcu+0x70/0xbc0 kernel/rcu/tree.c:3368 ma_put net/ipv6/mcast.c:869 [inline] ma_put+0x11a/0x170 net/ipv6/mcast.c:865 __ipv6_dev_mc_dec+0x29a/0x360 net/ipv6/mcast.c:982 ipv6_mc_destroy_dev+0x2ca/0x670 net/ipv6/mcast.c:2800 addrconf_ifdown.isra.0+0x12c2/0x1940 net/ipv6/addrconf.c:3898 addrconf_notify+0x104/0x19b0 net/ipv6/addrconf.c:3678 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 ip6_tnl_exit_batch_net+0x57d/0x6f0 net/ipv6/ip6_tunnel.c:2278 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+0x78/0x80 mm/kasan/generic.c:491 insert_work+0x48/0x360 kernel/workqueue.c:1553 __queue_work+0x625/0x1120 kernel/workqueue.c:1714 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers+0xbc/0x4b0 kernel/time/timer.c:1746 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1d4/0x905 kernel/softirq.c:553 The buggy address belongs to the object at ffff88802c382000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff88802c382000, ffff88802c382200) The buggy address belongs to the physical page: page:ffffea0000b0e080 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2c382 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x4() raw: 00fff00000000200 ffff888012840600 ffffea00008234d0 ffffea0000b22710 raw: 0000000000000000 ffff88802c382000 0000000100000004 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 0x242040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 5234, tgid 5234 (kworker/u17:2), ts 147290754636, free_ts 147284317902 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_slowpath.constprop.0+0x2e7/0x2130 mm/page_alloc.c:4011 __alloc_pages+0x408/0x4a0 mm/page_alloc.c:4490 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x9b/0x3b0 mm/slab.c:2550 cache_alloc_refill+0x289/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x392/0x410 mm/slab.c:3521 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1076 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] tomoyo_find_next_domain+0xe2/0x1ff0 security/tomoyo/domain.c:710 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:101 [inline] tomoyo_bprm_check_security+0x139/0x1d0 security/tomoyo/tomoyo.c:91 security_bprm_check+0x49/0xb0 security/security.c:1102 search_binary_handler fs/exec.c:1726 [inline] exec_binprm fs/exec.c:1780 [inline] bprm_execve fs/exec.c:1855 [inline] bprm_execve+0x740/0x1980 fs/exec.c:1811 kernel_execve+0x3ee/0x500 fs/exec.c:2023 call_usermodehelper_exec_async+0x260/0x4e0 kernel/umh.c:110 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 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 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2c5/0x410 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4f/0x1a0 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:750 [inline] slab_alloc_node mm/slab.c:3237 [inline] slab_alloc mm/slab.c:3246 [inline] __kmem_cache_alloc_lru mm/slab.c:3423 [inline] kmem_cache_alloc+0x1bd/0x3f0 mm/slab.c:3432 vm_area_alloc+0x20/0x230 kernel/fork.c:485 mmap_region+0x429/0x2570 mm/mmap.c:2725 do_mmap+0x850/0xee0 mm/mmap.c:1362 vm_mmap_pgoff+0x1a2/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x42b/0x5b0 mm/mmap.c:1408 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88802c381f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802c381f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802c382000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802c382080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802c382100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 4 bytes skipped: 0: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 6: f3 0f 1e fa endbr64 a: 48 8b 0c 24 mov (%rsp),%rcx e: 0f b7 d6 movzwl %si,%edx 11: 0f b7 f7 movzwl %di,%esi 14: bf 03 00 00 00 mov $0x3,%edi 19: e9 b8 fe ff ff jmpq 0xfffffed6 1e: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) 25: 00 * 26: f3 0f 1e fa endbr64 <-- trapping instruction 2a: 48 8b 0c 24 mov (%rsp),%rcx 2e: 89 f2 mov %esi,%edx 30: 89 fe mov %edi,%esi 32: bf 05 00 00 00 mov $0x5,%edi 37: e9 9a fe ff ff jmpq 0xfffffed6