syzbot


KASAN: use-after-free Read in drm_getunique

Status: upstream: reported syz repro on 2020/12/15 15:58
Reported-by: syzbot+4f9a7322e7df98511d8c@syzkaller.appspotmail.com
First crash: 721d, last: 281d

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in drm_getunique syz inconclusive 2 553d 553d 22/24 fixed on 2021/11/10 00:50
linux-4.19 KASAN: use-after-free Read in drm_getunique syz done 2 559d 727d 1/1 fixed on 2021/06/26 05:18
Patch testing requests:
Created Duration User Patch Repo Result
2022/10/11 17:30 14m retest repro linux-4.14.y report log

Sample crash report:
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
Bluetooth: hci0 command 0x0409 tx timeout
==================================================================
BUG: KASAN: use-after-free in drm_getunique+0x1b4/0x250 drivers/gpu/drm/drm_ioctl.c:118
Read of size 4 at addr ffff8880af695818 by task syz-executor.0/8538

CPU: 1 PID: 8538 Comm: syz-executor.0 Not tainted 4.14.212-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 drm_getunique+0x1b4/0x250 drivers/gpu/drm/drm_ioctl.c:118
 drm_ioctl_kernel+0x14c/0x200 drivers/gpu/drm/drm_ioctl.c:736
 drm_ioctl+0x419/0x870 drivers/gpu/drm/drm_ioctl.c:836
 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+0x46/0xbb
RIP: 0033:0x45e159
RSP: 002b:00007fdd9f7dfc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e159
RDX: 0000000020000180 RSI: 00000000c0145401 RDI: 0000000000000003
RBP: 000000000119c068 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c034
R13: 00007fff4256ec3f R14: 00007fdd9f7e09c0 R15: 000000000119c034

Allocated by task 8536:
 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_trace+0x131/0x3d0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 drm_master_create drivers/gpu/drm/drm_auth.c:100 [inline]
 drm_new_set_master+0x11a/0x5e0 drivers/gpu/drm/drm_auth.c:138
 drm_master_open+0xee/0x120 drivers/gpu/drm/drm_auth.c:236
 drm_open_helper drivers/gpu/drm/drm_file.c:251 [inline]
 drm_open+0x873/0x1010 drivers/gpu/drm/drm_file.c:155
 drm_stub_open+0x27b/0x400 drivers/gpu/drm/drm_drv.c:944
 chrdev_open+0x23c/0x6d0 fs/char_dev.c:423
 do_dentry_open+0x44b/0xec0 fs/open.c:777
 vfs_open+0x105/0x220 fs/open.c:888
 do_last fs/namei.c:3428 [inline]
 path_openat+0x628/0x2970 fs/namei.c:3569
 do_filp_open+0x179/0x3c0 fs/namei.c:3603
 do_sys_open+0x296/0x410 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 8536:
 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]
 kfree+0xc9/0x250 mm/slab.c:3815
 drm_master_destroy drivers/gpu/drm/drm_auth.c:322 [inline]
 kref_put include/linux/kref.h:70 [inline]
 drm_master_put+0x134/0x180 drivers/gpu/drm/drm_auth.c:333
 drm_new_set_master+0x3b1/0x5e0 drivers/gpu/drm/drm_auth.c:157
 drm_setmaster_ioctl+0x222/0x2c0 drivers/gpu/drm/drm_auth.c:190
 drm_ioctl_kernel+0x14c/0x200 drivers/gpu/drm/drm_ioctl.c:736
 drm_ioctl+0x419/0x870 drivers/gpu/drm/drm_ioctl.c:836
 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+0x46/0xbb

The buggy address belongs to the object at ffff8880af695800
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 24 bytes inside of
 256-byte region [ffff8880af695800, ffff8880af695900)
The buggy address belongs to the page:
page:ffffea0002bda540 count:1 mapcount:0 mapping:ffff8880af695080 index:0xffff8880af695940
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880af695080 ffff8880af695940 000000010000000a
raw: ffffea0002bda160 ffffea0002ca30e0 ffff88813fe807c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880af695700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880af695780: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880af695800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8880af695880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880af695900: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/12/15 15:57 linux-4.14.y 3f2ecb86cb90 97183ed7 .config log report syz
* Struck through repros no longer work on HEAD.