syzbot


KASAN: double-free or invalid-free in cirrus_ttm_tt_create

Status: closed as invalid on 2017/12/06 12:56
Subsystems: dri
[Documentation on labels]
Reported-by: syzbot+d382126b5f0e780823690218a806a9e312a5f50d@syzkaller.appspotmail.com
First crash: 2702d, last: 2635d

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in cirrus_ttm_tt_create+0xc0/0xe0 drivers/gpu/drm/cirrus/cirrus_ttm.c:213

CPU: 3 PID: 30170 Comm: syz-executor5 Not tainted 4.14.0-rc8-next-20171110+ #12
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_double_free+0x55/0x80 mm/kasan/report.c:333
 kasan_slab_free+0xa3/0xc0 mm/kasan/kasan.c:514
 __cache_free mm/slab.c:3492 [inline]
 kfree+0xca/0x250 mm/slab.c:3807
 cirrus_ttm_tt_create+0xc0/0xe0 drivers/gpu/drm/cirrus/cirrus_ttm.c:213
 ttm_bo_add_ttm+0x2e1/0x420 drivers/gpu/drm/ttm/ttm_bo.c:247
 ttm_bo_validate+0x52b/0x6e0 drivers/gpu/drm/ttm/ttm_bo.c:1128
 ttm_bo_init_reserved+0xe3e/0x1370 drivers/gpu/drm/ttm/ttm_bo.c:1229
 ttm_bo_init+0x59/0x170 drivers/gpu/drm/ttm/ttm_bo.c:1264
 cirrus_bo_create+0x31d/0x450 drivers/gpu/drm/cirrus/cirrus_ttm.c:343
 cirrus_gem_create+0xcc/0x1b0 drivers/gpu/drm/cirrus/cirrus_main.c:237
 cirrus_dumb_create+0x171/0x310 drivers/gpu/drm/cirrus/cirrus_main.c:258
 drm_mode_create_dumb_ioctl+0x238/0x2c0 drivers/gpu/drm/drm_dumb_buffers.c:91
 drm_ioctl_kernel+0x1e7/0x2e0 drivers/gpu/drm/drm_ioctl.c:741
 drm_ioctl+0x72e/0xa50 drivers/gpu/drm/drm_ioctl.c:837
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x447c99
RSP: 002b:00007f68d275abd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f68d275b6cc RCX: 0000000000447c99
RDX: 000000002048aff7 RSI: fffffffffffff4b2 RDI: 0000000000000014
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004a971e
R13: 0000000000000000 R14: 00007f68d275a9c8 R15: 00007f68d275ab38

Allocated by task 30170:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3614
 kmalloc include/linux/slab.h:514 [inline]
 kzalloc include/linux/slab.h:703 [inline]
 cirrus_ttm_tt_create+0x56/0xe0 drivers/gpu/drm/cirrus/cirrus_ttm.c:208
 ttm_bo_add_ttm+0x2e1/0x420 drivers/gpu/drm/ttm/ttm_bo.c:247
 ttm_bo_validate+0x52b/0x6e0 drivers/gpu/drm/ttm/ttm_bo.c:1128
 ttm_bo_init_reserved+0xe3e/0x1370 drivers/gpu/drm/ttm/ttm_bo.c:1229
 ttm_bo_init+0x59/0x170 drivers/gpu/drm/ttm/ttm_bo.c:1264
 cirrus_bo_create+0x31d/0x450 drivers/gpu/drm/cirrus/cirrus_ttm.c:343
 cirrus_gem_create+0xcc/0x1b0 drivers/gpu/drm/cirrus/cirrus_main.c:237
 cirrus_dumb_create+0x171/0x310 drivers/gpu/drm/cirrus/cirrus_main.c:258
 drm_mode_create_dumb_ioctl+0x238/0x2c0 drivers/gpu/drm/drm_dumb_buffers.c:91
 drm_ioctl_kernel+0x1e7/0x2e0 drivers/gpu/drm/drm_ioctl.c:741
 drm_ioctl+0x72e/0xa50 drivers/gpu/drm/drm_ioctl.c:837
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 30170:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3492 [inline]
 kfree+0xca/0x250 mm/slab.c:3807
 cirrus_ttm_backend_destroy+0x1d/0x20 drivers/gpu/drm/cirrus/cirrus_ttm.c:194
 ttm_tt_destroy.part.7+0x12a/0x180 drivers/gpu/drm/ttm/ttm_tt.c:184
 ttm_tt_destroy drivers/gpu/drm/ttm/ttm_tt.c:171 [inline]
 ttm_tt_init+0x230/0x2c0 drivers/gpu/drm/ttm/ttm_tt.c:202
 cirrus_ttm_tt_create+0x9a/0xe0 drivers/gpu/drm/cirrus/cirrus_ttm.c:212
 ttm_bo_add_ttm+0x2e1/0x420 drivers/gpu/drm/ttm/ttm_bo.c:247
 ttm_bo_validate+0x52b/0x6e0 drivers/gpu/drm/ttm/ttm_bo.c:1128
 ttm_bo_init_reserved+0xe3e/0x1370 drivers/gpu/drm/ttm/ttm_bo.c:1229
 ttm_bo_init+0x59/0x170 drivers/gpu/drm/ttm/ttm_bo.c:1264
 cirrus_bo_create+0x31d/0x450 drivers/gpu/drm/cirrus/cirrus_ttm.c:343
 cirrus_gem_create+0xcc/0x1b0 drivers/gpu/drm/cirrus/cirrus_main.c:237
 cirrus_dumb_create+0x171/0x310 drivers/gpu/drm/cirrus/cirrus_main.c:258
 drm_mode_create_dumb_ioctl+0x238/0x2c0 drivers/gpu/drm/drm_dumb_buffers.c:91
 drm_ioctl_kernel+0x1e7/0x2e0 drivers/gpu/drm/drm_ioctl.c:741
 drm_ioctl+0x72e/0xa50 drivers/gpu/drm/drm_ioctl.c:837
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 entry_SYSCALL_64_fastpath+0x1f/0x96

The buggy address belongs to the object at ffff880060e56f00
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff880060e56f00, ffff880060e56f60)
The buggy address belongs to the page:
page:ffffea0001839580 count:1 mapcount:0 mapping:ffff880060e56000 index:0xffff880060e56480
flags: 0x500000000000100(slab)
raw: 0500000000000100 ffff880060e56000 ffff880060e56480 000000010000001e
raw: ffffea0001fea360 ffffea0001f27be0 ffff88002dc004c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff880060e56e00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff880060e56e80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff880060e56f00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                   ^
 ffff880060e56f80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
 ffff880060e57000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/11/10 06:37 linux-next d9e0e63d9a6f e0a2b195 .config console log report skylake-linux-next-kasan-qemu
2017/09/04 19:10 linux-next 9829d9f31f6c f400a0da .config console log report skylake-linux-next-kasan-qemu
* Struck through repros no longer work on HEAD.