================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irq include/linux/spinlock_api_smp.h:142 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irq+0x36/0x50 kernel/locking/spinlock.c:174 Read of size 1 at addr ffff888057f53818 by task syz.1.642/7851 CPU: 0 UID: 0 PID: 7851 Comm: syz.1.642 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP 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+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 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+0x132/0x370 kernel/locking/lockdep.c:5825 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock_irq+0x36/0x50 kernel/locking/spinlock.c:174 spin_lock_irq include/linux/spinlock.h:372 [inline] gadget_dev_open+0x44/0x1b0 drivers/usb/gadget/legacy/inode.c:1919 do_dentry_open+0x6ab/0x14d0 fs/open.c:947 vfs_open+0x82/0x3f0 fs/open.c:1052 do_open fs/namei.c:4700 [inline] path_openat+0x2873/0x4280 fs/namei.c:4863 do_file_open+0x20e/0x430 fs/namei.c:4892 do_sys_openat2+0x10f/0x1e0 fs/open.c:1368 do_sys_open fs/open.c:1374 [inline] __do_sys_openat fs/open.c:1390 [inline] __se_sys_openat fs/open.c:1385 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1385 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f456cb9e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f456db31028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f456ce25fa0 RCX: 00007f456cb9e0d9 RDX: 0000000000000002 RSI: 00002000000001c0 RDI: ffffffffffffff9c RBP: 00007f456cc35024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f456ce26038 R14: 00007f456ce25fa0 R15: 00007ffee24eaff8 Allocated by task 847: 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 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5334 [inline] __kmalloc_node_track_caller_noprof+0x331/0x830 mm/slub.c:5471 kmalloc_reserve+0xe8/0x350 net/core/skbuff.c:637 pskb_expand_head+0x249/0x10e0 net/core/skbuff.c:2312 skb_expand_head+0x1ee/0x420 net/core/skbuff.c:2468 ip6_finish_output2+0x135a/0x1ce0 net/ipv6/ip6_output.c:74 __ip6_finish_output+0x357/0xdf0 net/ipv6/ip6_output.c:208 ip6_finish_output net/ipv6/ip6_output.c:219 [inline] NF_HOOK_COND include/linux/netfilter.h:307 [inline] ip6_output+0x2aa/0xa60 net/ipv6/ip6_output.c:246 dst_output include/net/dst.h:470 [inline] ip6_local_out+0xcb/0x1f0 net/ipv6/output_core.c:128 ip6tunnel_xmit include/net/ip6_tunnel.h:174 [inline] udp_tunnel6_xmit_skb+0x8ae/0xf20 net/ipv6/ip6_udp_tunnel.c:112 send6+0x4bc/0xc40 drivers/net/wireguard/socket.c:151 wg_socket_send_skb_to_peer+0xf6/0x210 drivers/net/wireguard/socket.c:177 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline] wg_packet_tx_worker+0x199/0x7f0 drivers/net/wireguard/send.c:276 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 847: 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:2677 [inline] slab_free mm/slub.c:6377 [inline] kfree+0x22b/0x6c0 mm/slub.c:6692 skb_kfree_head net/core/skbuff.c:1083 [inline] skb_free_head+0xb9/0x160 net/core/skbuff.c:1095 skb_release_data+0x6c5/0x8e0 net/core/skbuff.c:1122 skb_release_all net/core/skbuff.c:1197 [inline] __kfree_skb net/core/skbuff.c:1211 [inline] sk_skb_reason_drop+0x102/0x1b0 net/core/skbuff.c:1250 kfree_skb_reason include/linux/skbuff.h:1323 [inline] kfree_skb include/linux/skbuff.h:1332 [inline] ipip6_tunnel_xmit net/ipv6/sit.c:1040 [inline] sit_tunnel_xmit+0xf4b/0x20a0 net/ipv6/sit.c:1075 __netdev_start_xmit include/linux/netdevice.h:5397 [inline] netdev_start_xmit include/linux/netdevice.h:5406 [inline] xmit_one net/core/dev.c:3889 [inline] dev_hard_start_xmit+0x121/0x760 net/core/dev.c:3905 __dev_queue_xmit+0x1bbf/0x4970 net/core/dev.c:4878 dev_queue_xmit include/linux/netdevice.h:3448 [inline] neigh_connected_output+0x3b7/0x5d0 net/core/neighbour.c:1645 neigh_output include/net/neighbour.h:560 [inline] ip6_finish_output2+0xb0f/0x1ce0 net/ipv6/ip6_output.c:136 __ip6_finish_output+0x357/0xdf0 net/ipv6/ip6_output.c:208 ip6_finish_output net/ipv6/ip6_output.c:219 [inline] NF_HOOK_COND include/linux/netfilter.h:307 [inline] ip6_output+0x2aa/0xa60 net/ipv6/ip6_output.c:246 dst_output include/net/dst.h:470 [inline] ip6_local_out+0xcb/0x1f0 net/ipv6/output_core.c:128 ip6tunnel_xmit include/net/ip6_tunnel.h:174 [inline] udp_tunnel6_xmit_skb+0x8ae/0xf20 net/ipv6/ip6_udp_tunnel.c:112 send6+0x4bc/0xc40 drivers/net/wireguard/socket.c:151 wg_socket_send_skb_to_peer+0xf6/0x210 drivers/net/wireguard/socket.c:177 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline] wg_packet_tx_worker+0x199/0x7f0 drivers/net/wireguard/send.c:276 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888057f53800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 24 bytes inside of freed 1024-byte region [ffff888057f53800, ffff888057f53c00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x57f50 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801bc42dc0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801bc42dc0 dead000000000100 dead000000000122 head: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5727, tgid 5727 (syz-executor), ts 56913473057, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 refill_objects+0xe3/0x410 mm/slub.c:7310 refill_sheaf mm/slub.c:2804 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675 alloc_from_pcs mm/slub.c:4773 [inline] slab_alloc_node mm/slub.c:4905 [inline] __do_kmalloc_node mm/slub.c:5333 [inline] __kmalloc_noprof+0x66d/0x820 mm/slub.c:5359 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] tomoyo_init_log+0x1224/0x20c0 security/tomoyo/audit.c:273 tomoyo_supervisor+0x506/0x1340 security/tomoyo/common.c:2232 tomoyo_audit_path2_log security/tomoyo/file.c:184 [inline] tomoyo_path2_perm+0x534/0x700 security/tomoyo/file.c:948 security_sb_pivotroot+0xc4/0x210 security/security.c:1117 path_pivot_root+0x14f/0x1320 fs/namespace.c:4680 __do_sys_pivot_root fs/namespace.c:4784 [inline] __se_sys_pivot_root fs/namespace.c:4767 [inline] __x64_sys_pivot_root+0x19a/0x1c0 fs/namespace.c:4767 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page_owner free stack trace missing Memory state around the buggy address: ffff888057f53700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888057f53780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888057f53800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888057f53880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888057f53900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================