syzbot


KASAN: use-after-free Read in __list_del_entry_valid (3)

Status: closed as dup on 2018/03/22 15:31
Reported-by: syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com
Fix commit: 7aa135fcf263 ANDROID: binder: prevent transactions into own process.
First crash: 1674d, last: 1661d
Duplicate of (1):
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: null-ptr-deref Write in rdma_resolve_addr C 66 1659d 1670d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __list_del_entry_valid (4) C done 16 966d 1654d 17/24 fixed on 2020/05/10 10:41
upstream KASAN: use-after-free Read in __list_del_entry_valid (2) C 11 1750d 1752d 3/24 fixed on 2018/01/11 01:23

Sample crash report:
audit: type=1400 audit(1521133204.939:7): avc:  denied  { map } for  pid=4096 comm="syzkaller144721" path="/root/syzkaller144721791" 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 __list_del_entry_valid+0x144/0x150 lib/list_debug.c:54
Read of size 8 at addr ffff8801d2435ce0 by task syzkaller144721/4121

CPU: 0 PID: 4121 Comm: syzkaller144721 Not tainted 4.16.0-rc5+ #354
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_del_entry_valid+0x144/0x150 lib/list_debug.c:54
 __list_del_entry include/linux/list.h:117 [inline]
 list_del include/linux/list.h:125 [inline]
 cma_cancel_listens drivers/infiniband/core/cma.c:1569 [inline]
 cma_cancel_operation+0x455/0xd60 drivers/infiniband/core/cma.c:1597
 rdma_destroy_id+0xff/0xda0 drivers/infiniband/core/cma.c:1661
 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
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446af9
RSP: 002b:00007fc143953da8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006e29fc RCX: 0000000000446af9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006e29fc
RBP: 00000000006e29f8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 006d635f616d6472
R13: 2f646e6162696e69 R14: 666e692f7665642f R15: 0000000000000005

Allocated by task 4121:
 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 4121:
 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
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d2435b00
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 480 bytes inside of
 1024-byte region [ffff8801d2435b00, ffff8801d2435f00)
The buggy address belongs to the page:
page:ffffea0007490d00 count:1 mapcount:0 mapping:ffff8801d2434000 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801d2434000 0000000000000000 0000000100000007
raw: ffffea000730eb20 ffff8801dac01848 ffff8801dac00ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d2435b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d2435c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801d2435c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8801d2435d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d2435d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (15):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2018/03/15 17:03 upstream 0aa3fdb8b3a6 08dacaa0 .config log report syz C
ci-upstream-kasan-gce-386 2018/03/15 17:18 upstream 0aa3fdb8b3a6 08dacaa0 .config log report syz
ci-upstream-kasan-gce-386 2018/03/10 10:30 upstream cdb06e9d8f52 36d1c454 .config log report syz
ci-upstream-kasan-gce 2018/03/18 21:39 upstream 9e1909b9da04 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/17 18:03 upstream 8f5fd927c3a7 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/17 17:14 upstream 8f5fd927c3a7 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/16 19:33 upstream df09348f78dc 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/16 16:17 upstream df09348f78dc 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/15 16:44 upstream 0aa3fdb8b3a6 08dacaa0 .config log report
ci-upstream-kasan-gce 2018/03/14 16:36 upstream fc6eabbbf8ef 08dacaa0 .config log report
ci-upstream-kasan-gce-386 2018/03/19 14:50 upstream c698ca527893 7e7d7ed2 .config log report
ci-upstream-kasan-gce-386 2018/03/10 10:12 upstream cdb06e9d8f52 36d1c454 .config log report
ci-upstream-kasan-gce-386 2018/03/08 04:07 upstream 851710a80961 d50edb7e .config log report
ci-upstream-kasan-gce-386 2018/03/07 14:56 upstream 86f84779d8e9 a5e76540 .config log report
ci-upstream-kasan-gce-386 2018/03/06 01:05 upstream 094b58e1040a aef0b792 .config log report
* Struck through repros no longer work on HEAD.