================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x42e4/0x5e20 kernel/locking/lockdep.c:5012 Read of size 8 at addr ffff8880261b0418 by task udevd/6365 CPU: 0 PID: 6365 Comm: udevd Not tainted 6.4.0-syzkaller-12415-g8fc3b8f082cc #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:check_pointer_msg lib/vsprintf.c:699 [inline] RIP: 0010:check_pointer lib/vsprintf.c:710 [inline] RIP: 0010:string+0xeb/0x3d0 lib/vsprintf.c:723 Code: 4d 85 f6 44 0f bf 64 24 46 0f 84 8b 02 00 00 e8 3b cc 71 f7 49 8d 9e 00 f0 ff ff 48 c7 c7 00 e0 ff ff 48 89 de e8 65 c8 71 f7 <48> 81 fb 00 e0 ff ff 0f 87 48 01 00 00 e8 13 cc 71 f7 48 8b 44 24 RSP: 0018:ffffc900242d7918 EFLAGS: 00000293 RAX: 0000000000000000 RBX: ffff8880241e4740 RCX: ffffffff8a13135b RDX: ffff88801d47a400 RSI: 0000000000000000 RDI: 0000000000000007 RBP: 000000000000000b R08: 0000000000000007 R09: ffffffffffffe000 R10: ffff8880241e4740 R11: 0000000000000001 R12: 00000000ffffffff R13: 0000000000000000 R14: ffff8880241e5740 R15: ffff0a00ffffff04 vsnprintf+0xa36/0x1710 lib/vsprintf.c:2817 tomoyo_supervisor+0xfe/0xec0 security/tomoyo/common.c:2060 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline] tomoyo_path_number_perm+0x413/0x570 security/tomoyo/file.c:734 security_file_ioctl+0x54/0xb0 security/security.c:2608 __do_sys_ioctl fs/ioctl.c:864 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0xb7/0x210 fs/ioctl.c:856 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 RIP: 0033:0x7ffb82d1ad49 Code: 5c c3 48 8d 44 24 08 48 89 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 b8 10 00 00 00 c7 44 24 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 76 10 48 8b 15 ae 60 0d 00 f7 d8 41 83 c8 RSP: 002b:00007ffc130d6c48 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffb82d1ad49 RDX: 00007ffc130d6c80 RSI: 0000000080280215 RDI: 0000000000000009 RBP: 000055b1958813d0 R08: 0000000000000000 R09: 00007ffb82df1c10 R10: 0000000000001000 R11: 0000000000000246 R12: 0000000000000009 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001 Allocated by task 13143: 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 13143: 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:521 ____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: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 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:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2649 sctp_endpoint_destroy net/sctp/endpointola.c:228 [inline] sctp_endpoint_put+0x193/0x200 net/sctp/endpointola.c:243 sctp_destroy_sock+0xa6/0x400 net/sctp/socket.c:5100 sk_common_release+0x68/0x3a0 net/core/sock.c:3693 sctp_close+0x4dc/0x940 net/sctp/socket.c:1549 inet_release+0x132/0x270 net/ipv4/af_inet.c:427 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:480 __sock_release+0xcd/0x290 net/socket.c:654 sock_close+0x1c/0x20 net/socket.c:1386 __fput+0x40c/0xad0 fs/file_table.c:384 task_work_run+0x16f/0x270 kernel/task_work.c:179 get_signal+0x1c7/0x25f0 kernel/signal.c:2653 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_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 The buggy address belongs to the object at ffff8880261b0400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880261b0400, ffff8880261b0600) The buggy address belongs to the physical page: page:ffffea0000986c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x261b0 head:ffffea0000986c00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012842c80 ffffea0000923d00 dead000000000002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5179, tgid 5179 (syz-executor.0), ts 123890878274, free_ts 123877579374 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_node include/linux/gfp.h:237 [inline] alloc_slab_page mm/slub.c:1864 [inline] allocate_slab+0xa7/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 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc_node+0x51/0x1a0 mm/slab_common.c:992 kmalloc_array_node include/linux/slab.h:680 [inline] kcalloc_node include/linux/slab.h:685 [inline] memcg_alloc_slab_cgroups+0x8f/0x150 mm/memcontrol.c:2899 account_slab mm/slab.h:636 [inline] allocate_slab+0x2d6/0x390 mm/slub.c:2027 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] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x365/0x380 mm/slub.c:3494 fib_table_insert+0x75f/0x1be0 net/ipv4/fib_trie.c:1362 fib_magic+0x493/0x580 net/ipv4/fib_frontend.c:1104 fib_add_ifaddr+0x38d/0x560 net/ipv4/fib_frontend.c:1141 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:750 [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+0x16c/0x380 mm/slub.c:3494 getname_flags.part.0+0x50/0x4f0 fs/namei.c:140 getname_flags include/linux/audit.h:319 [inline] getname fs/namei.c:219 [inline] __do_sys_unlink fs/namei.c:4443 [inline] __se_sys_unlink fs/namei.c:4441 [inline] __ia32_sys_unlink+0xb5/0x110 fs/namei.c:4441 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 Memory state around the buggy address: ffff8880261b0300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880261b0380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880261b0400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880261b0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880261b0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 4d 85 f6 test %r14,%r14 3: 44 0f bf 64 24 46 movswl 0x46(%rsp),%r12d 9: 0f 84 8b 02 00 00 je 0x29a f: e8 3b cc 71 f7 callq 0xf771cc4f 14: 49 8d 9e 00 f0 ff ff lea -0x1000(%r14),%rbx 1b: 48 c7 c7 00 e0 ff ff mov $0xffffffffffffe000,%rdi 22: 48 89 de mov %rbx,%rsi 25: e8 65 c8 71 f7 callq 0xf771c88f * 2a: 48 81 fb 00 e0 ff ff cmp $0xffffffffffffe000,%rbx <-- trapping instruction 31: 0f 87 48 01 00 00 ja 0x17f 37: e8 13 cc 71 f7 callq 0xf771cc4f 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 44 rex.R 3f: 24 .byte 0x24