syzbot


KASAN: use-after-free Read in reservation_object_test_signaled_rcu

Status: fixed on 2021/08/17 14:12
Reported-by: syzbot+e14062e58265cb7f7475@syzkaller.appspotmail.com
Fix commit: 020a44cc54d6 drm: Return -ENOTTY for non-drm ioctls
First crash: 1241d, last: 1006d
Fix bisection: fixed by (bisect log) :
commit 020a44cc54d65e673a13195e96fc0addbfd3a601
Author: Charles Baylis <cb-kernel@fishzet.co.uk>
Date: Fri Jul 16 16:43:12 2021 +0000

  drm: Return -ENOTTY for non-drm ioctls

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Write in reservation_object_test_signaled_rcu 1 717d 717d 0/1 auto-obsoleted due to no activity on 2022/08/31 08:23
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2021/08/17 06:23 4h32m bisect fix linux-4.19.y job log (1)
2021/06/28 01:11 36m bisect fix linux-4.19.y job log (0) log
2021/05/29 00:29 35m bisect fix linux-4.19.y job log (0) log
2021/04/28 23:51 37m bisect fix linux-4.19.y job log (0) log
2021/03/27 18:49 35m bisect fix linux-4.19.y job log (0) log
2021/02/25 18:11 35m bisect fix linux-4.19.y job log (0) log
2021/01/24 00:04 34m bisect fix linux-4.19.y job log (0) log
2020/12/24 23:06 38m bisect fix linux-4.19.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3294
Read of size 8 at addr ffff8880a6320fd8 by task syz-executor912/10535

CPU: 1 PID: 10535 Comm: syz-executor912 Not tainted 4.19.160-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+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __lock_acquire+0x2cb4/0x3ff0 kernel/locking/lockdep.c:3294
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3907
 seqcount_lockdep_reader_access include/linux/seqlock.h:81 [inline]
 read_seqcount_begin include/linux/seqlock.h:164 [inline]
 reservation_object_test_signaled_rcu+0x194/0xdb0 drivers/dma-buf/reservation.c:600
 vgem_fence_attach_ioctl+0x2c6/0x640 drivers/gpu/drm/vgem/vgem_fence.c:185
 drm_ioctl_kernel+0x208/0x2a0 drivers/gpu/drm/drm_ioctl.c:757
 drm_ioctl+0x507/0x9c0 drivers/gpu/drm/drm_ioctl.c:857
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x44a6d9
Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 fb ca fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ff3c3e7cdb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006dbc48 RCX: 000000000044a6d9
RDX: 0000000020000140 RSI: 00000000c10c5541 RDI: 0000000000000005
RBP: 00000000006dbc40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc4c
R13: 00007ffc07db75bf R14: 00007ff3c3e7d9c0 R15: 0000000000000000

Allocated by task 10535:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 dma_buf_export+0x1f1/0xa20 drivers/dma-buf/dma-buf.c:416
 drm_gem_dmabuf_export+0x17/0x80 drivers/gpu/drm/drm_prime.c:365
 drm_gem_prime_export+0x182/0x200 drivers/gpu/drm/drm_prime.c:546
 attach_dmabuf drivers/gpu/drm/vgem/vgem_fence.c:124 [inline]
 vgem_fence_attach_ioctl+0x395/0x640 drivers/gpu/drm/vgem/vgem_fence.c:173
 drm_ioctl_kernel+0x208/0x2a0 drivers/gpu/drm/drm_ioctl.c:757
 drm_ioctl+0x507/0x9c0 drivers/gpu/drm/drm_ioctl.c:857
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 10544:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 dma_buf_release+0x329/0x630 drivers/dma-buf/dma-buf.c:80
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 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+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a6320dc0
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 536 bytes inside of
 1024-byte region [ffff8880a6320dc0, ffff8880a63211c0)
The buggy address belongs to the page:
page:ffffea000298c800 count:1 mapcount:0 mapping:ffff88813bff0ac0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002999188 ffffea0002999788 ffff88813bff0ac0
raw: 0000000000000000 ffff8880a6320040 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a6320e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a6320f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a6320f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff8880a6321000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a6321080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/24 23:05 linux-4.19.y 0c88e405c97e e34b696c .config console log report syz C ci2-linux-4-19
2021/07/18 00:41 linux-4.19.y fcfbdfe9626e f115ae98 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in reservation_object_test_signaled_rcu
2021/03/29 21:11 linux-4.19.y 78fec1611cbf 6a81331a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in reservation_object_test_signaled_rcu
2021/01/26 18:11 linux-4.19.y 2263955bf7e7 55a7d4df .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in reservation_object_test_signaled_rcu
* Struck through repros no longer work on HEAD.