================================================ WARNING: lock held when returning to user space! 4.14.300-syzkaller #0 Not tainted ------------------------------------------------ syz-executor.4/12284 is leaving the kernel with locks still held! 1 lock held by syz-executor.4/12284: #0: (&lo->lo_ctl_mutex/1){+.+.}, at: [] lo_ioctl+0x87/0x1cd0 drivers/block/loop.c:1419 ================================================================== BUG: KASAN: use-after-free in mutex_can_spin_on_owner kernel/locking/mutex.c:479 [inline] BUG: KASAN: use-after-free in mutex_optimistic_spin kernel/locking/mutex.c:523 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:759 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x120f/0x1310 kernel/locking/mutex.c:893 Read of size 4 at addr ffff8880a1d86178 by task syz-executor.1/12320 CPU: 1 PID: 12320 Comm: syz-executor.1 Not tainted 4.14.300-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429 mutex_can_spin_on_owner kernel/locking/mutex.c:479 [inline] mutex_optimistic_spin kernel/locking/mutex.c:523 [inline] __mutex_lock_common kernel/locking/mutex.c:759 [inline] __mutex_lock+0x120f/0x1310 kernel/locking/mutex.c:893 lo_ioctl+0x87/0x1cd0 drivers/block/loop.c:1419 __blkdev_driver_ioctl block/ioctl.c:297 [inline] blkdev_ioctl+0x540/0x1830 block/ioctl.c:594 block_ioctl+0xd9/0x120 fs/block_dev.c:1893 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 Allocated by task 12280: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_node+0x146/0x410 mm/slab.c:3642 alloc_task_struct_node kernel/fork.c:156 [inline] dup_task_struct kernel/fork.c:515 [inline] copy_process.part.0+0x17d3/0x71c0 kernel/fork.c:1631 copy_process kernel/fork.c:1606 [inline] _do_fork+0x184/0xc80 kernel/fork.c:2092 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 Freed by task 12145: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758 __put_task_struct+0x276/0x470 kernel/fork.c:420 put_task_struct include/linux/sched/task.h:98 [inline] delayed_put_task_struct+0x1fb/0x2e0 kernel/exit.c:180 __rcu_reclaim kernel/rcu/rcu.h:195 [inline] rcu_do_batch kernel/rcu/tree.c:2699 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline] rcu_process_callbacks+0x780/0x1180 kernel/rcu/tree.c:2946 __do_softirq+0x24d/0x9ff kernel/softirq.c:288 The buggy address belongs to the object at ffff8880a1d86140 which belongs to the cache task_struct of size 6144 The buggy address is located 56 bytes inside of 6144-byte region [ffff8880a1d86140, ffff8880a1d87940) The buggy address belongs to the page: page:ffffea0002876180 count:1 mapcount:0 mapping:ffff8880a1d86140 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff8880a1d86140 0000000000000000 0000000100000001 raw: ffffea0002a613a0 ffffea00025c9ca0 ffff88823f8307c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a1d86000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880a1d86080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880a1d86100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880a1d86180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a1d86200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================