syzbot


WARNING: refcount bug in drm_gem_object_handle_put_unlocked

Status: upstream: reported C repro on 2022/09/05 09:42
Reported-by: syzbot+c512687fff9d22327436@syzkaller.appspotmail.com
First crash: 86d, last: 20d

Sample crash report:
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 3031 at lib/refcount.c:28 refcount_warn_saturate+0x1a0/0x1c8 lib/refcount.c:28
Modules linked in:
CPU: 1 PID: 3031 Comm: syz-executor859 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : refcount_warn_saturate+0x1a0/0x1c8 lib/refcount.c:28
lr : refcount_warn_saturate+0x1a0/0x1c8 lib/refcount.c:28
sp : ffff800012713b90
x29: ffff800012713b90 x28: 00000000000a201d x27: 0000000000002000
x26: dead000000000100 x25: 0000000000000000 x24: 0000000000000001
x23: 0000000000000001 x22: 0000000000000000 x21: 0000000000000000
x20: 0000000000000003 x19: ffff80000d8c8000 x18: 00000000000000c0
x17: ffff80000dd0b198 x16: ffff80000db49158 x15: ffff0000c3ca0000
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c3ca0000
x11: ff808000081c0d5c x10: 0000000000000000 x9 : e142409ecabede00
x8 : e142409ecabede00 x7 : ffff80000819545c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000100000000 x0 : 0000000000000026
Call trace:
 refcount_warn_saturate+0x1a0/0x1c8 lib/refcount.c:28
 __refcount_sub_and_test include/linux/refcount.h:283 [inline]
 __refcount_dec_and_test include/linux/refcount.h:315 [inline]
 refcount_dec_and_test include/linux/refcount.h:333 [inline]
 kref_put include/linux/kref.h:64 [inline]
 __drm_gem_object_put include/drm/drm_gem.h:381 [inline]
 drm_gem_object_put include/drm/drm_gem.h:394 [inline]
 drm_gem_object_handle_put_unlocked+0x178/0x1a0 drivers/gpu/drm/drm_gem.c:225
 drm_gem_object_release_handle+0x68/0x80 drivers/gpu/drm/drm_gem.c:244
 idr_for_each+0xf0/0x174 lib/idr.c:208
 drm_gem_release+0x30/0x48 drivers/gpu/drm/drm_gem.c:917
 drm_file_free+0x220/0x2cc drivers/gpu/drm/drm_file.c:281
 drm_close_helper drivers/gpu/drm/drm_file.c:308 [inline]
 drm_release+0x108/0x240 drivers/gpu/drm/drm_file.c:495
 __fput+0x198/0x3dc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:353
 task_work_run+0xc4/0x14c kernel/task_work.c:177
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x174/0x1f0 arch/arm64/kernel/signal.c:1127
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
irq event stamp: 1301834
hardirqs last  enabled at (1301833): [<ffff8000081befc8>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (1301834): [<ffff80000bfb5fbc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:404
softirqs last  enabled at (1301798): [<ffff80000801c33c>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (1301796): [<ffff80000801c308>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---

Crashes (13):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-gce-arm64 2022/10/31 00:42 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 2a71366b .config log report syz C WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/17 10:14 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 67cb024c .config log report syz C WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/08 16:26 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 aea5da89 .config log report syz C WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/09/01 09:49 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a41a877bc12d b01ec571 .config log report syz C WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/11/06 04:16 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 6d752409 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/11/04 22:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 6d752409 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/28 02:42 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 86777b7f .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/27 16:27 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 86777b7f .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/08 15:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 aea5da89 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/10/04 05:31 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 feb56351 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/09/11 19:02 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a6b443748715 356d8217 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/09/04 02:00 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 85413d1e802e 28811d0a .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
ci-upstream-gce-arm64 2022/09/01 09:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a41a877bc12d b01ec571 .config log report info WARNING: refcount bug in drm_gem_object_handle_put_unlocked
* Struck through repros no longer work on HEAD.