bisecting fixing commit since 0c88e405c97ed1828443b67891e6d4bb6e56cd4e building syzkaller on e34b696c0d7c04dbc824dee8b5123969bbca19b7 testing commit 0c88e405c97ed1828443b67891e6d4bb6e56cd4e with gcc (GCC) 8.4.1 20210217 kernel signature: 327e38bdbcc5c508676b3f47afb5b4c1df94c7f289dd0384ce0963575c8c816d run #0: crashed: general protection fault in vgem_fence_attach_ioctl run #1: crashed: general protection fault in vgem_fence_attach_ioctl run #2: crashed: WARNING in mutex_destroy 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: general protection fault in vgem_fence_attach_ioctl 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: general protection fault in vgem_fence_attach_ioctl 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: general protection fault in vgem_fence_attach_ioctl run #16: crashed: WARNING in mutex_destroy run #17: crashed: general protection fault in vgem_fence_attach_ioctl run #18: crashed: WARNING in mutex_destroy run #19: crashed: WARNING in mutex_destroy testing current HEAD eb575cd5d7f60241d016fdd13a9e86d962093c9b testing commit eb575cd5d7f60241d016fdd13a9e86d962093c9b with gcc (GCC) 8.4.1 20210217 kernel signature: cd771fb07bc43f5b79474b8391f9cef6f4d972f0489d9c610989e85a9f9eaefe run #0: crashed: general protection fault in vgem_fence_attach_ioctl run #1: crashed: WARNING in mutex_destroy run #2: crashed: WARNING in mutex_destroy 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: general protection fault in vgem_fence_attach_ioctl 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 mutex_destroy revisions tested: 2, total time: 36m32.722854171s (build: 17m12.90584093s, test: 18m55.949983929s) the crash still happens on HEAD commit msg: Linux 4.19.195 crash: WARNING in mutex_destroy bond0 (unregistering): Releasing backup interface bond_slave_1 bond0 (unregistering): Releasing backup interface bond_slave_0 bond0 (unregistering): Released all slaves ------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock)) WARNING: CPU: 0 PID: 27647 at kernel/locking/mutex-debug.c:103 mutex_destroy+0xf3/0x130 kernel/locking/mutex-debug.c:103 Modules linked in: CPU: 0 PID: 27647 Comm: syz-executor340 Not tainted 4.19.195-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:mutex_destroy+0xf3/0x130 kernel/locking/mutex-debug.c:103 Code: 03 38 d0 7c 04 84 d2 75 49 8b 05 d8 af 7a 0a 85 c0 0f 85 63 ff ff ff 48 c7 c6 a0 5c 09 88 48 c7 c7 e0 5c 09 88 e8 be ba 3b 06 <0f> 0b e9 49 ff ff ff e8 c1 18 46 00 e9 35 ff ff ff e8 77 19 46 00 RSP: 0018:ffff8881dc6f7db8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff8881d4f1d3c0 RCX: 0000000000000000 RDX: 1ffffffff1322479 RSI: 0000000000000004 RDI: 0000000000000286 RBP: ffff8881dc6f7dc0 R08: fffffbfff132e741 R09: fffffbfff132e740 R10: fffffbfff132e740 R11: ffffffff89973a03 R12: ffff8881d4f1d3c0 R13: ffff8881d4f1d310 R14: ffffffff8c54c4c0 R15: 0000000000000000 FS: 00007f6aa9ef2700(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd4edd5a10 CR3: 00000001df551001 CR4: 00000000001606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: 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:0x44a299 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6aa9ef2308 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: 0000000000000000 RBX: 00000000004cb528 RCX: 000000000044a299 RDX: 0000000020000040 RSI: 00000000c00464b4 RDI: 0000000000000005 RBP: 00000000004cb520 R08: 00007f6aa9ef2700 R09: 0000000000000000 R10: 00007f6aa9ef2700 R11: 0000000000000246 R12: 00000000004cb52c R13: 000000000049b07c R14: 6972642f7665642f R15: 0000000000022000 irq event stamp: 17 hardirqs last enabled at (17): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline] hardirqs last enabled at (17): [] _raw_spin_unlock_irq+0x27/0x90 kernel/locking/spinlock.c:192 hardirqs last disabled at (16): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (16): [] _raw_spin_lock_irq+0x3c/0x90 kernel/locking/spinlock.c:160 softirqs last enabled at (0): [] copy_process.part.2+0x176b/0x7960 kernel/fork.c:1855 softirqs last disabled at (0): [<0000000000000000>] (null) ---[ end trace 205b9184ad08b9a5 ]--- ================================================================== BUG: KASAN: use-after-free in reservation_object_reserve_shared+0x212/0x250 include/linux/reservation.h:143 Read of size 8 at addr ffff8881e377ab40 by task syz-executor340/4814 CPU: 0 PID: 4814 Comm: syz-executor340 Tainted: G W 4.19.195-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_load8_noabort+0x14/0x20 mm/kasan/report.c:433 reservation_object_reserve_shared+0x212/0x250 include/linux/reservation.h:143 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:758 drm_ioctl+0x6a9/0xae0 drivers/gpu/drm/drm_ioctl.c:858 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:0x44a299 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6aa9f34308 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000004cb508 RCX: 000000000044a299 RDX: 0000000020000140 RSI: 00000000c10c5541 RDI: 0000000000000005 RBP: 00000000004cb500 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004cb50c R13: 000000000049b07c R14: 6972642f7665642f R15: 0000000000022000 Allocated by task 4814: 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+0x15d/0x3d0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] kzalloc include/linux/slab.h:709 [inline] dma_buf_export+0x1b4/0x970 drivers/dma-buf/dma-buf.c:416 drm_gem_dmabuf_export drivers/gpu/drm/drm_prime.c:365 [inline] drm_gem_prime_export+0x16c/0x280 drivers/gpu/drm/drm_prime.c:546 attach_dmabuf drivers/gpu/drm/vgem/vgem_fence.c:124 [inline] vgem_fence_attach_ioctl+0x3fe/0x580 drivers/gpu/drm/vgem/vgem_fence.c:173 drm_ioctl_kernel+0x1b7/0x240 drivers/gpu/drm/drm_ioctl.c:758 drm_ioctl+0x6a9/0xae0 drivers/gpu/drm/drm_ioctl.c:858 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 4824: 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 dma_buf_release+0x2db/0x560 drivers/dma-buf/dma-buf.c:80 __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 ffff8881e377a900 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 576 bytes inside of 1024-byte region [ffff8881e377a900, ffff8881e377ad00) The buggy address belongs to the page: page:ffffea00078dde80 count:1 mapcount:0 mapping:ffff8881f6000ac0 index:0x0 compound_mapcount: 0 flags: 0x17ff00000008100(slab|head) raw: 017ff00000008100 ffffea0007380a08 ffffea00077db488 ffff8881f6000ac0 raw: 0000000000000000 ffff8881e377a000 0000000100000007 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881e377aa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e377aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e377ab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e377ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e377ac00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 10957 Comm: syz-executor340 Tainted: G B W 4.19.195-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:vgem_fence_attach_ioctl+0x250/0x580 drivers/gpu/drm/vgem/vgem_fence.c:184 Code: 80 3c 02 00 0f 85 01 03 00 00 4d 8b bc 24 10 01 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d bf e0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 cd 02 00 00 49 8b 87 e0 00 00 00 4c 89 f2 48 c1 RSP: 0018:ffff8881e3497a70 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff8881ee2257c0 RCX: 0000000000000000 RDX: 000000000000001c RSI: 0000000000000004 RDI: 00000000000000e0 RBP: ffff8881e3497ab0 R08: ffffed103eca4561 R09: ffffed103eca4560 R10: ffffed103eca4560 R11: ffff8881f6522b03 R12: ffff8881db06f0c0 R13: ffff8881cbee66c0 R14: ffff8881ee2257c4 R15: 0000000000000000 FS: 00007f6aa9f34700(0000) GS:ffff8881f6500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004d16e0 CR3: 00000001d5676003 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: drm_ioctl_kernel+0x1b7/0x240 drivers/gpu/drm/drm_ioctl.c:758 drm_ioctl+0x6a9/0xae0 drivers/gpu/drm/drm_ioctl.c:858 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:0x44a299 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6aa9f34308 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000004cb508 RCX: 000000000044a299 RDX: 0000000020000140 RSI: 00000000c10c5541 RDI: 0000000000000005 RBP: 00000000004cb500 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004cb50c R13: 000000000049b07c R14: 6972642f7665642f R15: 0000000000022000 Modules linked in: ---[ end trace 205b9184ad08b9a6 ]--- RIP: 0010:vgem_fence_attach_ioctl+0x250/0x580 drivers/gpu/drm/vgem/vgem_fence.c:184 Code: 80 3c 02 00 0f 85 01 03 00 00 4d 8b bc 24 10 01 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d bf e0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 cd 02 00 00 49 8b 87 e0 00 00 00 4c 89 f2 48 c1 RSP: 0018:ffff8881e3497a70 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff8881ee2257c0 RCX: 0000000000000000 RDX: 000000000000001c RSI: 0000000000000004 RDI: 00000000000000e0 RBP: ffff8881e3497ab0 R08: ffffed103eca4561 R09: ffffed103eca4560 R10: ffffed103eca4560 R11: ffff8881f6522b03 R12: ffff8881db06f0c0 R13: ffff8881cbee66c0 R14: ffff8881ee2257c4 R15: 0000000000000000 FS: 00007f6aa9f34700(0000) GS:ffff8881f6500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6aa9f13718 CR3: 00000001d5676003 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400