bisecting fixing commit since f6d5cb9e2c06f7d583dd9f4f7cca21d13d78c32a building syzkaller on d5a3ae1f760e7cb2cd5a721d9645ae22eae114fe testing commit f6d5cb9e2c06f7d583dd9f4f7cca21d13d78c32a with gcc (GCC) 8.4.1 20210217 kernel signature: 20ea3a0fe3b254e70ca6898e61d6622ab37de65ef8cfbcd1b2b26a942d5ef2c3 run #0: crashed: general protection fault in vgem_fence_attach_ioctl run #1: crashed: WARNING in mutex_destroy run #2: crashed: general protection fault in vgem_fence_attach_ioctl run #3: crashed: WARNING in mutex_destroy run #4: crashed: general protection fault in vgem_fence_attach_ioctl run #5: crashed: WARNING in mutex_destroy run #6: crashed: WARNING in mutex_destroy run #7: crashed: WARNING in mutex_destroy run #8: crashed: general protection fault in vgem_fence_attach_ioctl run #9: crashed: WARNING in mutex_destroy run #10: crashed: general protection fault in vgem_fence_attach_ioctl run #11: crashed: general protection fault in vgem_fence_attach_ioctl run #12: crashed: general protection fault in vgem_fence_attach_ioctl run #13: crashed: general protection fault in vgem_fence_attach_ioctl run #14: crashed: general protection fault in vgem_fence_attach_ioctl run #15: crashed: WARNING in mutex_destroy run #16: crashed: general protection fault in vgem_fence_attach_ioctl run #17: crashed: general protection fault in vgem_fence_attach_ioctl run #18: crashed: general protection fault in vgem_fence_attach_ioctl run #19: crashed: general protection fault in vgem_fence_attach_ioctl testing current HEAD 2d19be4653f5e74ed95560b69f94eb6791d49af3 testing commit 2d19be4653f5e74ed95560b69f94eb6791d49af3 with gcc (GCC) 8.4.1 20210217 kernel signature: ad627214571e6f6ad07bde9861f597b2dbd2e01b233b43f18530dd7cd4aa2dd0 run #0: crashed: WARNING in mutex_destroy run #1: crashed: WARNING in mutex_destroy run #2: crashed: general protection fault in vgem_fence_attach_ioctl run #3: crashed: general protection fault in vgem_fence_attach_ioctl run #4: crashed: general protection fault in vgem_fence_attach_ioctl run #5: crashed: general protection fault in vgem_fence_attach_ioctl run #6: crashed: WARNING in mutex_destroy run #7: crashed: general protection fault in vgem_fence_attach_ioctl run #8: crashed: general protection fault in vgem_fence_attach_ioctl run #9: crashed: WARNING in corrupted revisions tested: 2, total time: 26m35.900583551s (build: 16m22.178012666s, test: 9m16.496042044s) the crash still happens on HEAD commit msg: Linux 4.19.177 crash: WARNING in corrupted ------------[ cut here ]------------ ================================================================== DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock)) WARNING: CPU: 0 PID: 14631 at kernel/locking/mutex-debug.c:103 mutex_destroy+0xf3/0x130 kernel/locking/mutex-debug.c:103 BUG: KASAN: use-after-free in __write_once_size include/linux/compiler.h:234 [inline] BUG: KASAN: use-after-free in reservation_object_add_shared_replace drivers/dma-buf/reservation.c:166 [inline] BUG: KASAN: use-after-free in reservation_object_add_shared_fence+0xc9d/0xd20 drivers/dma-buf/reservation.c:237 Kernel panic - not syncing: panic_on_warn set ... Write of size 8 at addr ffff8881d75b4198 by task syz-executor.4/14630 CPU: 0 PID: 14631 Comm: syz-executor.4 Not tainted 4.19.177-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x226 lib/dump_stack.c:118 panic+0x1cd/0x375 kernel/panic.c:186 __warn.cold.7+0x1b/0x36 kernel/panic.c:541 report_bug+0x1a1/0x200 lib/bug.c:186 fixup_bug arch/x86/kernel/traps.c:178 [inline] fixup_bug arch/x86/kernel/traps.c:173 [inline] do_error_trap+0x200/0x350 arch/x86/kernel/traps.c:296 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:1038 RIP: 0010:mutex_destroy+0xf3/0x130 kernel/locking/mutex-debug.c:103 Code: 03 38 d0 7c 04 84 d2 75 49 8b 05 78 6f e2 08 85 c0 0f 85 63 ff ff ff 48 c7 c6 e0 ca 29 87 48 c7 c7 20 cb 29 87 e8 fc 91 76 05 <0f> 0b e9 49 ff ff ff e8 51 e8 45 00 e9 35 ff ff ff e8 07 e9 45 00 RSP: 0018:ffff8881d4f87db8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff8881ddcef380 RCX: 0000000000000000 RDX: 1ffffffff10a3f61 RSI: 0000000000000004 RDI: 0000000000000282 RBP: ffff8881d4f87dc0 R08: fffffbfff10b0359 R09: fffffbfff10b0358 R10: fffffbfff10b0358 R11: ffffffff88581ac3 R12: ffff8881ddcef380 R13: ffff8881ddcef2d0 R14: ffffffff8ac0d700 R15: 0000000000000000 ww_mutex_destroy include/linux/ww_mutex.h:358 [inline] reservation_object_fini include/linux/reservation.h:129 [inline] dma_buf_release+0x456/0x560 drivers/dma-buf/dma-buf.c:77 __fput+0x249/0x7f0 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x108/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x185/0x1e0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x413/0x4e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x465109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f976100e188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: 0000000000000000 RBX: 000000000055d040 RCX: 0000000000465109 RDX: 0000000020000040 RSI: 00000000c00464b4 RDI: 0000000000000003 RBP: 00000000004af711 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055d040 R13: 00007ffe2037076f R14: 00007f976100e300 R15: 0000000000022000 CPU: 1 PID: 14630 Comm: syz-executor.4 Not tainted 4.19.177-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x226 lib/dump_stack.c:118 print_address_description.cold.6+0x9/0x211 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:396 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438 __write_once_size include/linux/compiler.h:234 [inline] reservation_object_add_shared_replace drivers/dma-buf/reservation.c:166 [inline] reservation_object_add_shared_fence+0xc9d/0xd20 drivers/dma-buf/reservation.c:237 vgem_fence_attach_ioctl+0x479/0x580 drivers/gpu/drm/vgem/vgem_fence.c:197 drm_ioctl_kernel+0x1b7/0x240 drivers/gpu/drm/drm_ioctl.c:757 drm_ioctl+0x6a9/0xae0 drivers/gpu/drm/drm_ioctl.c:857 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 ksys_ioctl+0x62/0x90 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:710 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x465109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f976102f188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000055cfa0 RCX: 0000000000465109 RDX: 0000000020000140 RSI: 00000000c10c5541 RDI: 0000000000000003 RBP: 00000000004af711 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055cfa0 R13: 00007ffe2037076f R14: 00007f976102f300 R15: 0000000000022000 Allocated by task 14630: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:553 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:538 __do_kmalloc mm/slab.c:3727 [inline] __kmalloc_track_caller+0x159/0x3d0 mm/slab.c:3742 __do_krealloc mm/slab_common.c:1499 [inline] krealloc+0x65/0xb0 mm/slab_common.c:1546 reservation_object_reserve_shared+0x115/0x250 drivers/dma-buf/reservation.c:91 vgem_fence_attach_ioctl+0x438/0x580 drivers/gpu/drm/vgem/vgem_fence.c:196 drm_ioctl_kernel+0x1b7/0x240 drivers/gpu/drm/drm_ioctl.c:757 drm_ioctl+0x6a9/0xae0 drivers/gpu/drm/drm_ioctl.c:857 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 ksys_ioctl+0x62/0x90 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:710 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 14631: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x13c/0x220 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 reservation_object_fini include/linux/reservation.h:127 [inline] dma_buf_release+0x44e/0x560 drivers/dma-buf/dma-buf.c:77 __fput+0x249/0x7f0 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x108/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x185/0x1e0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x413/0x4e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881d75b4180 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 24 bytes inside of 64-byte region [ffff8881d75b4180, ffff8881d75b41c0) The buggy address belongs to the page: page:ffffea00075d6d00 count:1 mapcount:0 mapping:ffff8881f6400340 index:0x0 flags: 0x17ffe0000000100(slab) raw: 017ffe0000000100 ffffea00075d6d48 ffffea00075d5448 ffff8881f6400340 raw: 0000000000000000 ffff8881d75b4000 0000000100000020 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d75b4080: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8881d75b4100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff8881d75b4180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff8881d75b4200: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8881d75b4280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ================================================================== Kernel Offset: disabled Rebooting in 86400 seconds..