syzbot


KASAN: use-after-free Read in ucma_close

Status: fixed on 2018/03/23 18:14
Reported-by: syzbot+dcfd344365a56fbebd0f@syzkaller.appspotmail.com
Fix commit: ed65a4dc2208 RDMA/ucma: Fix use-after-free access in ucma_close
First crash: 1788d, last: 1774d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ucma_close (2) syz done 1 870d 869d 17/24 fixed on 2020/11/16 12:12

Sample crash report:
audit: type=1400 audit(1521077309.305:6): avc:  denied  { map } for  pid=4216 comm="bash" path="/bin/bash" dev="sda1" ino=1457 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1
audit: type=1400 audit(1521077327.053:7): avc:  denied  { map } for  pid=4233 comm="syzkaller942099" path="/root/syzkaller942099266" dev="sda1" ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: use-after-free in ucma_close+0x2d7/0x2f0 drivers/infiniband/core/ucma.c:1693
Read of size 8 at addr ffff8801d2f52c40 by task syzkaller942099/4233

CPU: 1 PID: 4233 Comm: syzkaller942099 Not tainted 4.16.0-rc5+ #353
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+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x23c/0x360 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 ucma_close+0x2d7/0x2f0 drivers/infiniband/core/ucma.c:1693
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43e918
RSP: 002b:00007ffc3b4b31b8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043e918
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004be2c0 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006cc160 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4233:
 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:552
 kmem_cache_alloc_trace+0x136/0x740 mm/slab.c:3607
 kmalloc include/linux/slab.h:512 [inline]
 kzalloc include/linux/slab.h:701 [inline]
 ucma_alloc_ctx+0xce/0x610 drivers/infiniband/core/ucma.c:188
 ucma_create_id+0x205/0x620 drivers/infiniband/core/ucma.c:473
 ucma_write+0x2d6/0x3d0 drivers/infiniband/core/ucma.c:1633
 __vfs_write+0xef/0x970 fs/read_write.c:480
 vfs_write+0x189/0x510 fs/read_write.c:544
 SYSC_write fs/read_write.c:589 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:581
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4233:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kfree+0xd9/0x260 mm/slab.c:3800
 ucma_create_id+0x45b/0x620 drivers/infiniband/core/ucma.c:500
 ucma_write+0x2d6/0x3d0 drivers/infiniband/core/ucma.c:1633
 __vfs_write+0xef/0x970 fs/read_write.c:480
 vfs_write+0x189/0x510 fs/read_write.c:544
 SYSC_write fs/read_write.c:589 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:581
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d2f52bc0
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 128 bytes inside of
 256-byte region [ffff8801d2f52bc0, ffff8801d2f52cc0)
The buggy address belongs to the page:
page:ffffea00074bd480 count:1 mapcount:0 mapping:ffff8801d2f52080 index:0xffff8801d2f52d00
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d2f52080 ffff8801d2f52d00 000000010000000b
raw: ffffea0006c300a0 ffffea000737fee0 ffff8801dac007c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d2f52b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
 ffff8801d2f52b80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8801d2f52c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff8801d2f52c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801d2f52d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (176):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce 2018/03/15 01:31 upstream 3032f8c504d2 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/15 00:37 upstream 3032f8c504d2 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/14 22:53 upstream 3032f8c504d2 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/14 10:39 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/14 09:23 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/14 05:38 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz C
ci-upstream-kasan-gce 2018/03/13 01:58 upstream fc6eabbbf8ef f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 19:35 upstream 0c8efd610b58 f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 15:55 upstream 0c8efd610b58 f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 14:42 upstream 0c8efd610b58 f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 13:33 upstream 0c8efd610b58 f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 10:44 upstream 0c8efd610b58 f505ca4b .config console log report syz C
ci-upstream-kasan-gce 2018/03/12 00:40 upstream abeb75218aeb 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/11 16:11 upstream 3266b5bd97ea 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/11 05:24 upstream 3266b5bd97ea 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/10 20:04 upstream cdb06e9d8f52 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/10 02:01 upstream 719ea86151f3 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/09 23:19 upstream 719ea86151f3 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/09 15:58 upstream 1b88accf6a65 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/09 11:59 upstream 1b88accf6a65 36d1c454 .config console log report syz C
ci-upstream-kasan-gce 2018/03/08 17:21 upstream 1b88accf6a65 acd0caa5 .config console log report syz C
ci-upstream-kasan-gce 2018/03/08 16:28 upstream 1b88accf6a65 acd0caa5 .config console log report syz C
ci-upstream-kasan-gce 2018/03/08 07:43 upstream 851710a80961 d50edb7e .config console log report syz C
ci-upstream-kasan-gce 2018/03/08 06:10 upstream 851710a80961 d50edb7e .config console log report syz C
ci-upstream-kasan-gce 2018/03/07 19:53 upstream 86f84779d8e9 a5e76540 .config console log report syz C
ci-upstream-kasan-gce 2018/03/06 20:05 upstream ce380619fab9 c8a18476 .config console log report syz C
ci-upstream-kasan-gce-386 2018/03/15 01:32 upstream 3032f8c504d2 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/15 00:24 upstream 3032f8c504d2 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/14 23:12 upstream 3032f8c504d2 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/14 11:02 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/14 09:36 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/14 04:40 upstream fc6eabbbf8ef 08dacaa0 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/13 02:47 upstream fc6eabbbf8ef f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 19:50 upstream 0c8efd610b58 f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 16:53 upstream 0c8efd610b58 f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 15:51 upstream 0c8efd610b58 f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 15:26 upstream 0c8efd610b58 f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 12:05 upstream 0c8efd610b58 f505ca4b .config console log report syz
ci-upstream-kasan-gce-386 2018/03/12 01:00 upstream abeb75218aeb 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/11 20:24 upstream 3266b5bd97ea 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/11 15:56 upstream 3266b5bd97ea 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/11 05:08 upstream 3266b5bd97ea 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/10 20:17 upstream cdb06e9d8f52 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/10 10:45 upstream cdb06e9d8f52 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/10 02:03 upstream 719ea86151f3 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/09 23:41 upstream 719ea86151f3 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/09 12:29 upstream 1b88accf6a65 36d1c454 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/08 17:18 upstream 1b88accf6a65 acd0caa5 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/08 16:42 upstream 1b88accf6a65 acd0caa5 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/08 07:25 upstream 851710a80961 d50edb7e .config console log report syz
ci-upstream-kasan-gce-386 2018/03/08 04:27 upstream 851710a80961 d50edb7e .config console log report syz
ci-upstream-kasan-gce-386 2018/03/07 20:07 upstream 86f84779d8e9 a5e76540 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/07 15:15 upstream 86f84779d8e9 a5e76540 .config console log report syz
ci-upstream-kasan-gce-386 2018/03/06 20:52 upstream ce380619fab9 c8a18476 .config console log report syz
ci-upstream-kasan-gce 2018/03/21 02:38 upstream 1b5f3ba415fe 113a43ff .config console log report
ci-upstream-kasan-gce 2018/03/20 22:34 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 20:44 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 19:15 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 15:33 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 14:16 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 13:04 upstream 1b5f3ba415fe 72c33b66 .config console log report
ci-upstream-kasan-gce 2018/03/20 08:23 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/20 05:55 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/19 23:12 upstream c698ca527893 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/19 22:08 upstream c698ca527893 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/19 14:26 upstream c698ca527893 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/19 11:59 upstream c698ca527893 7e7d7ed2 .config console log report
ci-upstream-kasan-gce 2018/03/19 06:27 upstream 9e1909b9da04 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/18 23:34 upstream 9e1909b9da04 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/18 21:40 upstream 9e1909b9da04 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/18 05:48 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/17 23:26 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/17 13:05 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/17 08:12 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/17 04:28 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/16 16:27 upstream df09348f78dc 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/16 13:42 upstream df09348f78dc 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/16 10:04 upstream e2c15aff5f35 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/16 04:56 upstream e2c15aff5f35 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 21:40 upstream e2c15aff5f35 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 20:24 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 18:54 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 12:09 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 10:36 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/15 08:11 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/14 15:00 upstream fc6eabbbf8ef 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/13 23:49 upstream fc6eabbbf8ef 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/13 17:23 upstream fc6eabbbf8ef 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/13 15:31 upstream fc6eabbbf8ef 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/13 12:36 upstream fc6eabbbf8ef 08dacaa0 .config console log report
ci-upstream-kasan-gce 2018/03/06 19:44 upstream ce380619fab9 c8a18476 .config console log report
ci-upstream-kasan-gce-386 2018/03/20 04:14 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report
ci-upstream-kasan-gce-386 2018/03/20 00:49 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report
ci-upstream-kasan-gce-386 2018/03/19 04:28 upstream 9e1909b9da04 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/19 02:16 upstream 9e1909b9da04 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/18 18:54 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/18 15:55 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/18 08:21 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/18 04:02 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/17 15:59 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/17 05:52 upstream 8f5fd927c3a7 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/16 23:20 upstream df09348f78dc 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/16 21:46 upstream df09348f78dc 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/15 13:27 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/14 19:22 upstream 3032f8c504d2 08dacaa0 .config console log report
ci-upstream-kasan-gce-386 2018/03/13 22:24 upstream fc6eabbbf8ef 08dacaa0 .config console log report
* Struck through repros no longer work on HEAD.