syzbot


KASAN: use-after-free Read in ucma_event_handler

Status: auto-closed as invalid on 2019/10/25 08:49
Reported-by: syzbot+884f113b747dff373884@syzkaller.appspotmail.com
First crash: 1121d, last: 1121d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ucma_event_handler 1 1345d 1344d 0/22 auto-closed as invalid on 2019/04/28 22:49

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:840 [inline]
BUG: KASAN: use-after-free in __mutex_lock+0x1285/0x1470 kernel/locking/mutex.c:893
Read of size 8 at addr ffff888093072248 by task kworker/u4:5/2845

CPU: 1 PID: 2845 Comm: kworker/u4:5 Not tainted 4.14.125 #19
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: ib_addr process_one_req
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x19c lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 __mutex_lock_common kernel/locking/mutex.c:840 [inline]
 __mutex_lock+0x1285/0x1470 kernel/locking/mutex.c:893
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
 ucma_event_handler+0xbd/0xe20 drivers/infiniband/core/ucma.c:337
 addr_handler+0x1db/0x2b0 drivers/infiniband/core/cma.c:2804
 process_one_req+0x239/0x590 drivers/infiniband/core/addr.c:625
 process_one_work+0x863/0x1600 kernel/workqueue.c:2114
 worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
 kthread+0x319/0x430 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 7570:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 ucma_open+0x4f/0x290 drivers/infiniband/core/ucma.c:1704
 misc_open+0x34f/0x480 drivers/char/misc.c:154
 chrdev_open+0x207/0x590 fs/char_dev.c:423
 do_dentry_open+0x73b/0xeb0 fs/open.c:758
 vfs_open+0x105/0x220 fs/open.c:872
 do_last fs/namei.c:3425 [inline]
 path_openat+0x8bd/0x3f70 fs/namei.c:3566
 do_filp_open+0x18e/0x250 fs/namei.c:3600
 do_sys_open+0x2c5/0x430 fs/open.c:1065
 SYSC_openat fs/open.c:1092 [inline]
 SyS_openat+0x30/0x40 fs/open.c:1086
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7565:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 ucma_close+0x280/0x310 drivers/infiniband/core/ucma.c:1763
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888093072200
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 72 bytes inside of
 256-byte region [ffff888093072200, ffff888093072300)
The buggy address belongs to the page:
page:ffffea00024c1c80 count:1 mapcount:0 mapping:ffff8880930720c0 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880930720c0 0000000000000000 000000010000000c
raw: ffffea0002376be0 ffffea0002309060 ffff8880aa8007c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888093072100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093072180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888093072200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff888093072280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093072300: 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 2019/06/12 08:28 linux-4.14.y 2bf3258a12af ea2f4006 .config log report