syzbot


KASAN: use-after-free Read in __list_add_valid (4)

Status: closed as dup on 2018/03/22 15:30
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+5aef6b1a99035b4b6705@syzkaller.appspotmail.com
First crash: 2452d, last: 2436d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: null-ptr-deref Write in rdma_resolve_addr rdma C 66 2439d 2450d
Discussions (2)
Title Replies (including bot) Last reply
Re: KASAN: use-after-free Read in __list_add_valid (4) 1 (1) 2018/03/22 15:30
Re: KASAN: use-after-free Read in __list_add_valid (4) 1 (1) 2018/03/22 15:30
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __list_add_valid (5) rdma C 16 2428d 2434d 11/28 fixed on 2019/02/21 08:43
upstream KASAN: use-after-free Read in __list_add_valid (3) kvm net virt 16 2487d 2494d 4/28 fixed on 2018/02/04 11:35
upstream KASAN: use-after-free Read in __list_add_valid (2) net 1 2554d 2554d 0/28 closed as invalid on 2018/01/19 22:57
upstream KASAN: use-after-free Read in __list_add_valid syz 26 2590d 2638d 3/28 fixed on 2017/10/24 22:03

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0xc6/0xd0 lib/list_debug.c:26
Read of size 8 at addr ffff8801b0aad418 by task syzkaller827066/4597

CPU: 0 PID: 4597 Comm: syzkaller827066 Not tainted 4.16.0-rc6+ #360
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
 __list_add_valid+0xc6/0xd0 lib/list_debug.c:26
 __list_add include/linux/list.h:60 [inline]
 list_add_tail include/linux/list.h:93 [inline]
 cma_listen_on_all drivers/infiniband/core/cma.c:2309 [inline]
 rdma_listen+0x581/0x8e0 drivers/infiniband/core/cma.c:3331
 ucma_listen+0x172/0x1f0 drivers/infiniband/core/ucma.c:1064
 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
RIP: 0033:0x4415e9
RSP: 002b:00007ffc1af73c48 EFLAGS: 00000207 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004415e9
RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 0000000000008d1b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000207 R12: 0000000000000000
R13: 00000000006cd448 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4179:
 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]
 rdma_create_id+0xd0/0x630 drivers/infiniband/core/cma.c:787
 ucma_create_id+0x31a/0x620 drivers/infiniband/core/ucma.c:479
 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 4179:
 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
 rdma_destroy_id+0x821/0xda0 drivers/infiniband/core/cma.c:1691
 ucma_close+0x100/0x2f0 drivers/infiniband/core/ucma.c:1712
 __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

The buggy address belongs to the object at ffff8801b0aad240
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 472 bytes inside of
 1024-byte region [ffff8801b0aad240, ffff8801b0aad640)
The buggy address belongs to the page:
page:ffffea0006c2ab00 count:1 mapcount:0 mapping:ffff8801b0aac040 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801b0aac040 0000000000000000 0000000100000007
raw: ffffea0006f28620 ffffea0006f26920 ffff8801dac00ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b0aad300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b0aad380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801b0aad400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8801b0aad480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b0aad500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (61):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/20 00:56 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report syz C ci-upstream-kasan-gce
2018/03/15 04:45 upstream 3032f8c504d2 08dacaa0 .config console log report syz C ci-upstream-kasan-gce
2018/03/20 00:57 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report syz ci-upstream-kasan-gce-386
2018/03/15 04:44 upstream 3032f8c504d2 08dacaa0 .config console log report syz ci-upstream-kasan-gce-386
2018/03/23 10:44 upstream c4f4d2f91772 2e9d9054 .config console log report ci-upstream-kasan-gce
2018/03/23 03:39 upstream c4f4d2f91772 2e9d9054 .config console log report ci-upstream-kasan-gce
2018/03/20 21:43 upstream 1b5f3ba415fe 72c33b66 .config console log report ci-upstream-kasan-gce
2018/03/20 20:07 upstream 1b5f3ba415fe 72c33b66 .config console log report ci-upstream-kasan-gce
2018/03/20 08:15 upstream 1b5f3ba415fe 7e7d7ed2 .config console log report ci-upstream-kasan-gce
2018/03/19 12:04 upstream c698ca527893 7e7d7ed2 .config console log report ci-upstream-kasan-gce
2018/03/19 04:57 upstream 9e1909b9da04 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 21:54 upstream 9e1909b9da04 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 17:30 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 15:27 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 10:24 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 02:37 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/18 00:06 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/17 15:07 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/17 14:56 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/17 14:40 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/17 11:09 upstream 8f5fd927c3a7 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/16 18:04 upstream df09348f78dc 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/16 14:02 upstream df09348f78dc 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/16 11:50 upstream df09348f78dc 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/16 11:32 upstream df09348f78dc 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/15 19:36 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/15 18:51 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/15 15:36 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/15 15:01 upstream 0aa3fdb8b3a6 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/15 06:30 upstream 3032f8c504d2 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/14 22:34 upstream 3032f8c504d2 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/14 10:22 upstream fc6eabbbf8ef 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/14 08:59 upstream fc6eabbbf8ef 08dacaa0 .config console log report ci-upstream-kasan-gce
2018/03/13 01:39 upstream fc6eabbbf8ef f505ca4b .config console log report ci-upstream-kasan-gce
2018/03/12 19:12 upstream 0c8efd610b58 f505ca4b .config console log report ci-upstream-kasan-gce
2018/03/12 13:14 upstream 0c8efd610b58 f505ca4b .config console log report ci-upstream-kasan-gce
2018/03/12 10:23 upstream 0c8efd610b58 f505ca4b .config console log report ci-upstream-kasan-gce
2018/03/11 23:59 upstream abeb75218aeb 36d1c454 .config console log report ci-upstream-kasan-gce
2018/03/07 19:30 upstream 86f84779d8e9 a5e76540 .config console log report ci-upstream-kasan-gce
2018/03/19 21:29 upstream c698ca527893 7e7d7ed2 .config console log report ci-upstream-kasan-gce-386
2018/03/19 16:39 upstream c698ca527893 7e7d7ed2 .config console log report ci-upstream-kasan-gce-386
2018/03/19 14:14 upstream c698ca527893 7e7d7ed2 .config console log report ci-upstream-kasan-gce-386
2018/03/16 14:21 upstream df09348f78dc 08dacaa0 .config console log report ci-upstream-kasan-gce-386
2018/03/16 03:23 upstream e2c15aff5f35 08dacaa0 .config console log report ci-upstream-kasan-gce-386
2018/03/15 00:04 upstream 3032f8c504d2 08dacaa0 .config console log report ci-upstream-kasan-gce-386
2018/03/14 04:18 upstream fc6eabbbf8ef 08dacaa0 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.