================================================ WARNING: lock held when returning to user space! 4.14.307-syzkaller #0 Not tainted ------------------------------------------------ syz-executor.0/14702 is leaving the kernel with locks still held! 1 lock held by syz-executor.0/14702: #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 ffff888096e26178 by task syz-executor.0/14722 CPU: 0 PID: 14722 Comm: syz-executor.0 Not tainted 4.14.307-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 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:251 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:350 kasan_report mm/kasan/report.c:408 [inline] __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:428 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 RIP: 0033:0x7f76283740f9 RSP: 002b:00007f76268e6168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f7628493f80 RCX: 00007f76283740f9 RDX: 00000000200000c0 RSI: 0000000000004c05 RDI: 0000000000000006 RBP: 00007f76283cfae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc7922544f R14: 00007f76268e6300 R15: 0000000000022000 Allocated by task 14700: 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+0x17a/0xcb0 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 0: 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:99 [inline] delayed_put_task_struct+0x1fb/0x2e0 kernel/exit.c:227 __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 ffff888096e26140 which belongs to the cache task_struct of size 6144 The buggy address is located 56 bytes inside of 6144-byte region [ffff888096e26140, ffff888096e27940) The buggy address belongs to the page: page:ffffea00025b8980 count:1 mapcount:0 mapping:ffff888096e26140 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff888096e26140 0000000000000000 0000000100000001 raw: ffffea0002207120 ffffea0001f17820 ffff88823f8307c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888096e26000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888096e26080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888096e26100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff888096e26180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888096e26200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================