syzbot


KASAN: use-after-free Read in __rhashtable_lookup (2)

Status: fixed on 2018/09/26 21:51
Subsystems: rds
[Documentation on labels]
Reported-by: syzbot+8967084bcac563795dc6@syzkaller.appspotmail.com
Fix commit: cc4dfb7f70a3 rds: fix two RCU related problems
First crash: 2130d, last: 2108d
Discussions (6)
Title Replies (including bot) Last reply
[PATCH 4.18 000/235] 4.18.10-stable review 261 (261) 2018/10/09 15:15
[PATCH 4.14 000/173] 4.14.72-stable review 186 (186) 2018/09/26 09:48
[PATCH 4.9 000/111] 4.9.129-stable review 121 (121) 2018/09/25 20:42
[Patch net v2] rds: fix two RCU related problems 3 (3) 2018/09/12 07:10
[Patch net] rds: mark bound socket with SOCK_RCU_FREE 13 (13) 2018/09/11 00:59
KASAN: use-after-free Read in __rhashtable_lookup (2) 4 (8) 2018/09/08 22:07
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __rhashtable_lookup (3) net 1 1318d 1318d 0/27 auto-closed as invalid on 2021/02/08 22:50
upstream KASAN: use-after-free Read in __rhashtable_lookup (6) net 1 1033d 1033d 0/27 auto-closed as invalid on 2021/11/20 20:36
upstream KASAN: use-after-free Read in __rhashtable_lookup (5) net 1 1128d 1128d 0/27 auto-closed as invalid on 2021/08/17 13:23
upstream KASAN: use-after-free Read in __rhashtable_lookup (8) net 1 881d 881d 0/27 auto-closed as invalid on 2022/04/22 11:27
upstream KASAN: use-after-free Read in __rhashtable_lookup (7) net 1 935d 935d 0/27 closed as invalid on 2022/01/07 18:56
upstream KASAN: use-after-free Read in __rhashtable_lookup (4) net 1 1221d 1217d 0/27 auto-closed as invalid on 2021/05/16 18:04
upstream KASAN: use-after-free Read in __rhashtable_lookup rds 1 2148d 2144d 0/27 closed as dup on 2018/08/08 09:26

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcmp+0xe3/0x160 lib/string.c:861
Read of size 1 at addr ffff8801c83595f0 by task syz-executor851/6230

CPU: 1 PID: 6230 Comm: syz-executor851 Not tainted 4.19.0-rc3+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 memcmp+0xe3/0x160 lib/string.c:861
 memcmp include/linux/string.h:386 [inline]
 rhashtable_compare include/linux/rhashtable.h:462 [inline]
 __rhashtable_lookup.isra.8.constprop.20+0x73a/0xd00 include/linux/rhashtable.h:484
 rhashtable_lookup include/linux/rhashtable.h:516 [inline]
 rhashtable_lookup_fast include/linux/rhashtable.h:542 [inline]
 rds_add_bound net/rds/bind.c:117 [inline]
 rds_bind+0x7d2/0x1520 net/rds/bind.c:238
 __sys_bind+0x331/0x440 net/socket.c:1481
 __do_sys_bind net/socket.c:1492 [inline]
 __se_sys_bind net/socket.c:1490 [inline]
 __x64_sys_bind+0x73/0xb0 net/socket.c:1490
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440fa9
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 0b 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffcaeabe5e8 EFLAGS: 00000217 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000440fa9
RDX: 0000000000000010 RSI: 00000000200002c0 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000217 R12: 0000000000061872
R13: 0000000000401ed0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6228:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554
 sk_prot_alloc+0x69/0x2e0 net/core/sock.c:1462
 sk_alloc+0x10d/0x1690 net/core/sock.c:1522
 rds_create+0x14f/0x740 net/rds/af_rds.c:666
 __sock_create+0x536/0x930 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 __sys_socket+0x106/0x260 net/socket.c:1345
 __do_sys_socket net/socket.c:1354 [inline]
 __se_sys_socket net/socket.c:1352 [inline]
 __x64_sys_socket+0x73/0xb0 net/socket.c:1352
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6228:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x83/0x290 mm/slab.c:3756
 sk_prot_free net/core/sock.c:1503 [inline]
 __sk_destruct+0x766/0xbd0 net/core/sock.c:1587
 sk_destruct+0x78/0x90 net/core/sock.c:1595
 __sk_free+0xcf/0x300 net/core/sock.c:1606
 sk_free+0x42/0x50 net/core/sock.c:1617
 sock_put include/net/sock.h:1691 [inline]
 rds_release+0x3e8/0x570 net/rds/af_rds.c:91
 __sock_release+0xd7/0x250 net/socket.c:579
 sock_close+0x19/0x20 net/socket.c:1139
 __fput+0x385/0xa30 fs/file_table.c:278
 ____fput+0x15/0x20 fs/file_table.c:309
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801c8359180
 which belongs to the cache RDS of size 1608
The buggy address is located 1136 bytes inside of
 1608-byte region [ffff8801c8359180, ffff8801c83597c8)
The buggy address belongs to the page:
page:ffffea000720d640 count:1 mapcount:0 mapping:ffff8801cac47800 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0007063848 ffffea0007045c48 ffff8801cac47800
raw: 0000000000000000 ffff8801c8359180 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c8359480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c8359500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801c8359580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8801c8359600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c8359680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/10 19:21 upstream 11da3a7f84f1 f167cb6b .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/09/09 11:09 upstream f8f65382c98a 6b5120a4 .config console log report syz C ci-upstream-kasan-gce
2018/09/08 22:06 upstream d7b686ebf704 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-root
2018/09/09 01:51 upstream d7b686ebf704 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-386
2018/09/09 12:29 linux-next f2b6e66e9885 6b5120a4 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/09/12 17:06 upstream 5e335542de83 71907daf .config console log report ci-upstream-kasan-gce-smack-root
2018/09/11 03:11 upstream 11da3a7f84f1 8c88323f .config console log report ci-upstream-kasan-gce-smack-root
2018/09/10 15:34 upstream 11da3a7f84f1 f167cb6b .config console log report ci-upstream-kasan-gce
2018/09/10 15:03 upstream 11da3a7f84f1 f167cb6b .config console log report ci-upstream-kasan-gce
2018/09/10 03:03 upstream 9a5682765a2e 6b5120a4 .config console log report ci-upstream-kasan-gce
2018/09/09 18:39 upstream 9a5682765a2e 6b5120a4 .config console log report ci-upstream-kasan-gce
2018/09/09 15:23 upstream f8f65382c98a 6b5120a4 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/09 04:47 upstream f8f65382c98a 6b5120a4 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/09 04:31 upstream f8f65382c98a 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/09/08 22:09 upstream d7b686ebf704 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/09/08 21:13 upstream d7b686ebf704 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/08/29 03:09 upstream 3f16503b7d22 b771b17e .config console log report ci-upstream-kasan-gce
2018/08/22 11:35 upstream ad1d69735878 95b5c82b .config console log report ci-upstream-kasan-gce
2018/09/12 10:47 upstream 5e335542de83 3c88136c .config console log report ci-upstream-kasan-gce-386
2018/09/12 04:09 upstream 5e335542de83 3c88136c .config console log report ci-upstream-kasan-gce-386
2018/09/11 15:42 upstream 11da3a7f84f1 4ae17b1f .config console log report ci-upstream-kasan-gce-386
2018/08/28 01:50 linux-next 18b8bfa7c63b 7ef1de9e .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.