================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2d90/0x3c40 kernel/locking/lockdep.c:5089 Read of size 8 at addr ffff8880238a0c18 by task syz.1.388/6950 CPU: 0 UID: 0 PID: 6950 Comm: syz.1.388 Not tainted 6.13.0-rc1-syzkaller-00025-gfeffde684ac2 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 __lock_acquire+0x2d90/0x3c40 kernel/locking/lockdep.c:5089 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:397 [inline] p9_req_put net/9p/client.c:405 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:402 req_done+0x1e7/0x2f0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2715 [inline] vring_interrupt+0x31b/0x400 drivers/virtio/virtio_ring.c:2690 __handle_irq_event_percpu+0x229/0x7d0 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/0xd10 kernel/irq/chip.c:831 generic_handle_irq_desc include/linux/irqdesc.h:173 [inline] handle_irq arch/x86/kernel/irq.c:247 [inline] call_irq_handler arch/x86/kernel/irq.c:259 [inline] __common_interrupt+0xdf/0x250 arch/x86/kernel/irq.c:285 common_interrupt+0xba/0xe0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [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 06 01 59 f6 48 89 df e8 3e 80 59 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 45 80 4a f6 65 8b 05 56 a3 e6 74 85 c0 74 16 5b RSP: 0018:ffffc90028bb76f8 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffff88806824bac0 RCX: 1ffffffff2d409de RDX: 0000000000000000 RSI: ffffffff8b4cd0e0 RDI: ffffffff8bb13700 RBP: 0000000000000246 R08: 0000000000000001 R09: fffffbfff2d36fb0 R10: ffffffff969b7d87 R11: 0000000000000001 R12: ffff88806824baa8 R13: ffff88806bcb8c80 R14: 0000000000000246 R15: ffffc90028bb7898 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] __skb_try_recv_datagram+0x177/0x4f0 net/core/datagram.c:266 __unix_dgram_recvmsg+0x1d1/0xf50 net/unix/af_unix.c:2435 unix_dgram_recvmsg+0xd0/0x110 net/unix/af_unix.c:2537 sock_recvmsg_nosec net/socket.c:1033 [inline] ____sys_recvmsg+0x5f8/0x6b0 net/socket.c:2801 ___sys_recvmsg+0x115/0x1a0 net/socket.c:2845 do_recvmmsg+0x55d/0x740 net/socket.c:2932 __sys_recvmmsg+0x21e/0x280 net/socket.c:3014 __do_compat_sys_recvmmsg_time32 net/compat.c:418 [inline] __se_compat_sys_recvmmsg_time32 net/compat.c:414 [inline] __ia32_compat_sys_recvmmsg_time32+0xc4/0x160 net/compat.c:414 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fc7579 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:00000000f512557c EFLAGS: 00000292 ORIG_RAX: 0000000000000151 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00000000200000c0 RDX: 0000000000010106 RSI: 0000000000000002 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 6955: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:901 [inline] p9_client_create+0xc8/0x11a0 net/9p/client.c:985 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1814 do_new_mount fs/namespace.c:3507 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3834 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount fs/namespace.c:4034 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4034 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 6955: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2338 [inline] slab_free mm/slub.c:4598 [inline] kfree+0x14f/0x4b0 mm/slub.c:4746 p9_client_create+0x97d/0x11a0 net/9p/client.c:1064 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1814 do_new_mount fs/namespace.c:3507 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3834 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount fs/namespace.c:4034 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4034 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880238a0c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880238a0c00, ffff8880238a0e00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880238a2000 pfn:0x238a0 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801ac42c80 0000000000000000 dead000000000001 raw: ffff8880238a2000 000000008010000e 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801ac42c80 0000000000000000 dead000000000001 head: ffff8880238a2000 000000008010000e 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea00008e2801 ffffffffffffffff 0000000000000000 head: 0000000000000004 0000000000000000 00000000ffffffff 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 5947, tgid 5947 (syz-executor), ts 38622696555, free_ts 38391087785 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3474 __alloc_pages_slowpath mm/page_alloc.c:4286 [inline] __alloc_pages_noprof+0x6a6/0x25b0 mm/page_alloc.c:4764 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_slab_page mm/slub.c:2410 [inline] allocate_slab mm/slub.c:2574 [inline] new_slab+0xca/0x410 mm/slub.c:2627 ___slab_alloc+0xd1d/0x16e0 mm/slub.c:3815 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3905 __slab_alloc_node mm/slub.c:3980 [inline] slab_alloc_node mm/slub.c:4141 [inline] __do_kmalloc_node mm/slub.c:4282 [inline] __kmalloc_node_noprof+0x2f0/0x520 mm/slub.c:4289 kmalloc_array_node_noprof include/linux/slab.h:1018 [inline] alloc_slab_obj_exts+0x41/0xa0 mm/slub.c:1964 __memcg_slab_post_alloc_hook+0x2a7/0x9b0 mm/memcontrol.c:3005 memcg_slab_post_alloc_hook mm/slub.c:2152 [inline] slab_post_alloc_hook mm/slub.c:4114 [inline] slab_alloc_node mm/slub.c:4153 [inline] kmem_cache_alloc_noprof+0x310/0x3b0 mm/slub.c:4160 anon_vma_chain_alloc mm/rmap.c:142 [inline] anon_vma_fork+0x200/0x620 mm/rmap.c:364 dup_mmap kernel/fork.c:714 [inline] dup_mm kernel/fork.c:1695 [inline] copy_mm+0x19f8/0x2550 kernel/fork.c:1744 copy_process+0x3e6d/0x6f20 kernel/fork.c:2395 kernel_clone+0xfd/0x960 kernel/fork.c:2807 __do_compat_sys_ia32_clone+0xb7/0x100 arch/x86/kernel/sys_ia32.c:254 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 page last free pid 5941 tgid 5941 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0x1080 mm/page_alloc.c:2657 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4104 [inline] slab_alloc_node mm/slub.c:4153 [inline] __do_kmalloc_node mm/slub.c:4282 [inline] __kmalloc_node_noprof+0x1d0/0x520 mm/slub.c:4289 __kvmalloc_node_noprof+0xad/0x1a0 mm/util.c:650 xt_jumpstack_alloc net/netfilter/x_tables.c:1355 [inline] xt_replace_table+0x1e3/0x940 net/netfilter/x_tables.c:1394 __do_replace+0x1d3/0x9e0 net/ipv4/netfilter/arp_tables.c:912 compat_do_replace+0x3ca/0x500 net/ipv4/netfilter/ip_tables.c:1529 do_ip6t_set_ctl+0x686/0xc20 net/ipv6/netfilter/ip6_tables.c:1641 nf_setsockopt+0x8a/0xf0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x135/0x170 net/ipv6/ipv6_sockglue.c:998 tcp_setsockopt+0xa4/0x100 net/ipv4/tcp.c:4030 do_sock_setsockopt+0x222/0x480 net/socket.c:2313 __sys_setsockopt+0x1a0/0x230 net/socket.c:2338 __do_compat_sys_socketcall+0x51c/0x700 net/compat.c:491 Memory state around the buggy address: ffff8880238a0b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880238a0b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880238a0c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880238a0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880238a0d00: 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 06 01 59 f6 call 0xf6590119 13: 48 89 df mov %rbx,%rdi 16: e8 3e 80 59 f6 call 0xf6598059 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 45 80 4a f6 call 0xf64a8079 34: 65 8b 05 56 a3 e6 74 mov %gs:0x74e6a356(%rip),%eax # 0x74e6a391 3b: 85 c0 test %eax,%eax 3d: 74 16 je 0x55 3f: 5b pop %rbx