================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:132 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 Read of size 1 at addr ffff888050018418 by task syz.0.361/7716 CPU: 0 UID: 0 PID: 7716 Comm: syz.0.361 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x156/0x4c9 mm/kasan/report.c:482 kasan_report+0xdf/0x1e0 mm/kasan/report.c:595 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:574 kasan_check_byte include/linux/kasan.h:402 [inline] lock_acquire kernel/locking/lockdep.c:5842 [inline] lock_acquire+0x148/0x380 kernel/locking/lockdep.c:5825 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:132 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:274 [inline] p9_req_put net/9p/client.c:282 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:279 req_done+0x1dc/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt+0x2ef/0x650 drivers/virtio/virtio_ring.c:3255 __handle_irq_event_percpu+0x232/0x8e0 kernel/irq/handle.c:209 handle_irq_event_percpu kernel/irq/handle.c:246 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:263 handle_edge_irq+0x375/0x970 kernel/irq/chip.c:855 generic_handle_irq_desc include/linux/irqdesc.h:186 [inline] handle_irq arch/x86/kernel/irq.c:262 [inline] call_irq_handler arch/x86/kernel/irq.c:318 [inline] __common_interrupt+0xd8/0x2f0 arch/x86/kernel/irq.c:333 common_interrupt+0x60/0xe0 arch/x86/kernel/irq.c:326 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:688 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:179 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 76 5a 56 f6 48 89 df e8 5e aa 56 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 c5 e0 46 f6 65 8b 05 3e 3e 7e 08 85 c0 74 16 5b RSP: 0000:ffffc90000007df8 EFLAGS: 00000246 RAX: 0000000000000006 RBX: ffff88802b2284c0 RCX: 0000000000000004 RDX: 0000000000000000 RSI: ffffffff8de73b43 RDI: ffffffff8c1ace20 RBP: 0000000000000287 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88802b2284c0 R13: ffff88802a787418 R14: ffff88802b228740 R15: dffffc0000000000 __run_hrtimer kernel/time/hrtimer.c:1781 [inline] __hrtimer_run_queues+0x42b/0xa70 kernel/time/hrtimer.c:1849 hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1866 handle_softirqs+0x1eb/0x9e0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0xef/0x150 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 RIP: 0010:check_kcov_mode kernel/kcov.c:185 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0x39/0x70 kernel/kcov.c:217 Code: 65 48 8b 15 21 28 04 12 a9 00 01 ff 00 74 1b f6 c4 01 74 07 a9 00 00 ff 00 74 05 e9 d1 33 86 09 8b 82 54 16 00 00 85 c0 74 f1 <8b> 82 30 16 00 00 83 f8 02 75 e6 48 8b 8a 38 16 00 00 8b 92 34 16 RSP: 0000:ffffc900271174a8 EFLAGS: 00000246 RAX: 0000000080000001 RBX: 0000000000000001 RCX: ffffffff828008a0 RDX: ffff888047f98000 RSI: ffffffff8280045d RDI: ffff888047f98000 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff888041c36880 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000ae8 rcu_lock_release include/linux/rcupdate.h:322 [inline] rcu_read_unlock include/linux/rcupdate.h:881 [inline] page_table_check_clear+0x47d/0x9e0 mm/page_table_check.c:89 __page_table_check_pte_clear+0xf1/0x100 mm/page_table_check.c:155 page_table_check_pte_clear include/linux/page_table_check.h:55 [inline] ptep_get_and_clear_full arch/x86/include/asm/pgtable.h:1271 [inline] get_and_clear_full_ptes include/linux/pgtable.h:865 [inline] zap_present_folio_ptes mm/memory.c:1630 [inline] zap_present_ptes mm/memory.c:1712 [inline] do_zap_pte_range mm/memory.c:1814 [inline] zap_pte_range mm/memory.c:1916 [inline] zap_pmd_range mm/memory.c:2008 [inline] zap_pud_range mm/memory.c:2036 [inline] zap_p4d_range mm/memory.c:2057 [inline] unmap_page_range+0x2a10/0x4840 mm/memory.c:2078 unmap_single_vma+0x153/0x240 mm/memory.c:2120 unmap_vmas+0x218/0x470 mm/memory.c:2162 exit_mmap+0x18a/0xdd0 mm/mmap.c:1277 __mmput+0x12a/0x410 kernel/fork.c:1174 mmput+0x67/0x80 kernel/fork.c:1197 exit_mm kernel/exit.c:581 [inline] do_exit+0x78a/0x2a90 kernel/exit.c:959 do_group_exit+0xd5/0x2a0 kernel/exit.c:1112 get_signal+0x1ec7/0x21e0 kernel/signal.c:3034 arch_do_signal_or_restart+0x91/0x770 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:64 [inline] exit_to_user_mode_loop+0x86/0x4a0 kernel/entry/common.c:98 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:325 [inline] __do_fast_syscall_32+0x578/0x8c0 arch/x86/entry/syscall_32.c:310 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fc6f6c Code: Unable to access opcode bytes at 0xf7fc6f42. RSP: 002b:00000000f546550c EFLAGS: 00000292 ORIG_RAX: 0000000000000151 RAX: 0000000000010106 RBX: 0000000000000005 RCX: 00000000800000c0 RDX: 0000000000010106 RSI: 0000000000000002 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 7731: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:962 [inline] p9_client_create+0xaf/0xd40 net/9p/client.c:862 v9fs_session_init+0x40/0xce0 fs/9p/v9fs.c:442 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3760 [inline] do_new_mount fs/namespace.c:3836 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4146 do_mount fs/namespace.c:4159 [inline] __do_sys_mount fs/namespace.c:4348 [inline] __se_sys_mount fs/namespace.c:4325 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4325 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe3/0x8c0 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 7731: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2670 [inline] slab_free mm/slub.c:6082 [inline] kfree+0x1f6/0x6b0 mm/slub.c:6399 p9_client_create+0x72d/0xd40 net/9p/client.c:941 v9fs_session_init+0x40/0xce0 fs/9p/v9fs.c:442 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3760 [inline] do_new_mount fs/namespace.c:3836 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4146 do_mount fs/namespace.c:4159 [inline] __do_sys_mount fs/namespace.c:4348 [inline] __se_sys_mount fs/namespace.c:4325 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4325 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe3/0x8c0 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888050018400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888050018400, ffff888050018600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888050018c00 pfn:0x50018 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801b842c80 ffff8880404007c8 ffffea000113eb10 raw: ffff888050018c00 000000000010000b 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801b842c80 ffff8880404007c8 ffffea000113eb10 head: ffff888050018c00 000000000010000b 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffea0001400601 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5644, tgid 5644 (dhcpcd), ts 28924654389, free_ts 28158724143 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1888 prep_new_page mm/page_alloc.c:1896 [inline] get_page_from_freelist+0x111d/0x3140 mm/page_alloc.c:3961 __alloc_frozen_pages_noprof+0x27c/0x2ba0 mm/page_alloc.c:5249 alloc_slab_page mm/slub.c:3238 [inline] allocate_slab mm/slub.c:3411 [inline] new_slab+0xa6/0x6e0 mm/slub.c:3469 refill_objects+0x26b/0x400 mm/slub.c:7091 refill_sheaf mm/slub.c:2787 [inline] alloc_full_sheaf mm/slub.c:2808 [inline] __pcs_replace_empty_main+0x19f/0x600 mm/slub.c:4546 alloc_from_pcs mm/slub.c:4639 [inline] slab_alloc_node mm/slub.c:4773 [inline] __do_kmalloc_node mm/slub.c:5176 [inline] __kmalloc_noprof+0x688/0x850 mm/slub.c:5189 kmalloc_noprof include/linux/slab.h:966 [inline] kzalloc_noprof include/linux/slab.h:1204 [inline] tomoyo_init_log+0x1224/0x20c0 security/tomoyo/audit.c:275 tomoyo_supervisor+0x506/0x1340 security/tomoyo/common.c:2232 tomoyo_audit_net_log security/tomoyo/network.c:368 [inline] tomoyo_audit_inet_log+0x250/0x350 security/tomoyo/network.c:395 tomoyo_inet_entry security/tomoyo/network.c:487 [inline] tomoyo_check_inet_address+0x5b0/0x6d0 security/tomoyo/network.c:535 tomoyo_socket_bind_permission+0x275/0x350 security/tomoyo/network.c:748 security_socket_bind+0xd3/0x230 security/security.c:4148 __sys_bind_socket net/socket.c:1871 [inline] __sys_bind+0x140/0x260 net/socket.c:1905 __do_sys_bind net/socket.c:1910 [inline] __se_sys_bind net/socket.c:1908 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1908 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 page last free pid 5343 tgid 5343 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1432 [inline] __free_frozen_pages+0x7ca/0x10a0 mm/page_alloc.c:2977 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xe0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4459 [inline] slab_alloc_node mm/slub.c:4788 [inline] kmem_cache_alloc_noprof+0x241/0x6e0 mm/slub.c:4795 alloc_filename fs/namei.c:142 [inline] do_getname+0x35/0x390 fs/namei.c:182 getname include/linux/fs.h:2512 [inline] class_filename_constructor include/linux/fs.h:2539 [inline] do_sys_openat2+0xc5/0x1e0 fs/open.c:1365 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1383 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888050018300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888050018380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888050018400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888050018480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888050018500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 76 5a 56 f6 call 0xf6565a89 13: 48 89 df mov %rbx,%rdi 16: e8 5e aa 56 f6 call 0xf656aa79 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 c5 e0 46 f6 call 0xf646e0f9 34: 65 8b 05 3e 3e 7e 08 mov %gs:0x87e3e3e(%rip),%eax # 0x87e3e79 3b: 85 c0 test %eax,%eax 3d: 74 16 je 0x55 3f: 5b pop %rbx