================================================================== 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 ffff8880590e8018 by task syz.1.1086/9065 CPU: 1 UID: 0 PID: 9065 Comm: syz.1.1086 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+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:0x7f0c2f39e0d9 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:00007f0c30348028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f0c2f625fa0 RCX: 00007f0c2f39e0d9 RDX: 0000000000000002 RSI: 00002000000001c0 RDI: ffffffffffffff9c RBP: 00007f0c2f435024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f0c2f626038 R14: 00007f0c2f625fa0 R15: 00007ffd66adff88 Allocated by task 8923: 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] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5489 _kmalloc_noprof include/linux/slab.h:988 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] io_uring_alloc_task_context+0xa7/0x656 io_uring/tctx.c:88 __io_uring_add_tctx_node.cold+0x15/0x20a io_uring/tctx.c:152 io_uring_create io_uring/io_uring.c:3075 [inline] io_uring_setup.cold+0x19e2/0x1cae io_uring/io_uring.c:3120 __do_sys_io_uring_setup io_uring/io_uring.c:3154 [inline] __se_sys_io_uring_setup io_uring/io_uring.c:3145 [inline] __x64_sys_io_uring_setup+0xc2/0x170 io_uring/io_uring.c:3145 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 Freed by task 0: 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 io_uring_free_tctx+0x149/0x200 io_uring/tctx.c:67 __io_uring_free+0x1f/0xc0 io_uring/tctx.c:74 io_uring_free include/linux/io_uring.h:30 [inline] __put_task_struct+0x104/0x590 kernel/fork.c:788 rcu_do_batch kernel/rcu/tree.c:2645 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2897 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 task_work_add+0x28b/0x3b0 kernel/task_work.c:70 io_req_normal_work_add+0x1a6/0x4a0 io_uring/tw.c:230 __io_req_task_work_add io_uring/tw.h:45 [inline] io_req_task_work_add io_uring/tw.h:50 [inline] io_fail_links io_uring/timeout.c:238 [inline] io_disarm_next+0x715/0xd30 io_uring/timeout.c:275 __io_req_find_next_prep io_uring/io_uring.c:1018 [inline] io_req_find_next io_uring/io_uring.c:1033 [inline] io_queue_next+0x186/0x1d0 io_uring/io_uring.c:1076 io_put_req io_uring/timeout.c:91 [inline] io_put_req io_uring/timeout.c:88 [inline] io_req_task_link_timeout+0x232/0x530 io_uring/timeout.c:394 tctx_task_work_run+0xabe/0xbf0 io_uring/tw.c:96 tctx_task_work+0x7a/0xa0 io_uring/tw.c:133 task_work_run+0x150/0x240 kernel/task_work.c:233 get_signal+0x1bd/0x21e0 kernel/signal.c:2818 arch_do_signal_or_restart+0x91/0x7e0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:66 [inline] exit_to_user_mode_loop+0x139/0x6f0 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline] do_syscall_64+0x666/0x870 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Second to last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 task_work_add+0x28b/0x3b0 kernel/task_work.c:70 io_req_normal_work_add+0x1a6/0x4a0 io_uring/tw.c:230 __io_req_task_work_add io_uring/tw.h:45 [inline] io_req_task_work_add io_uring/tw.h:50 [inline] io_link_timeout_fn+0x385/0x520 io_uring/timeout.c:430 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2096 hrtimer_interrupt+0x3e5/0x940 kernel/time/hrtimer.c:2215 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1051 [inline] __sysvec_apic_timer_interrupt+0x109/0x470 arch/x86/kernel/apic/apic.c:1068 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0x9e/0xc0 arch/x86/kernel/apic/apic.c:1062 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 The buggy address belongs to the object at ffff8880590e8000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 24 bytes inside of freed 1024-byte region [ffff8880590e8000, ffff8880590e8400) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880590eb800 pfn:0x590e8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801bc42dc0 ffffea000161d610 ffffea000098dc10 raw: ffff8880590eb800 000000080010000a 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801bc42dc0 ffffea000161d610 ffffea000098dc10 head: ffff8880590eb800 000000080010000a 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 5734, tgid 5734 (syz-executor), ts 56797789952, 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_mount_log security/tomoyo/mount.c:33 [inline] tomoyo_mount_acl+0x580/0x8b0 security/tomoyo/mount.c:168 tomoyo_mount_permission+0x214/0x460 security/tomoyo/mount.c:239 security_sb_mount+0xdd/0x270 security/security.c:1088 path_mount+0x158/0x23d0 fs/namespace.c:4103 do_mount fs/namespace.c:4174 [inline] __do_sys_mount fs/namespace.c:4390 [inline] __se_sys_mount fs/namespace.c:4367 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4367 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: ffff8880590e7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880590e7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880590e8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880590e8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880590e8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================