================================================ WARNING: lock held when returning to user space! 4.14.301-syzkaller #0 Not tainted ------------------------------------------------ syz-executor.4/21998 is leaving the kernel with locks still held! 1 lock held by syz-executor.4/21998: #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 ffff8880a0eb22f8 by task syz-executor.4/22054 CPU: 0 PID: 22054 Comm: syz-executor.4 Not tainted 4.14.301-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 RIP: 0033:0x7f6c6e8eb0d9 RSP: 002b:00007f6c6ce3c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f6c6ea0b050 RCX: 00007f6c6e8eb0d9 RDX: 0000000020000000 RSI: 0000000000004c03 RDI: 0000000000000006 RBP: 00007f6c6e946ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe5c5bf39f R14: 00007f6c6ce3c300 R15: 0000000000022000 Allocated by task 21996: 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 17: 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 ffff8880a0eb22c0 which belongs to the cache task_struct of size 6144 The buggy address is located 56 bytes inside of 6144-byte region [ffff8880a0eb22c0, ffff8880a0eb3ac0) The buggy address belongs to the page: page:ffffea000283ac80 count:1 mapcount:0 mapping:ffff8880a0eb22c0 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff8880a0eb22c0 0000000000000000 0000000100000001 raw: ffffea0001ecf220 ffffea0002755c20 ffff88823f8307c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a0eb2180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880a0eb2200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880a0eb2280: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880a0eb2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a0eb2380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================