syzbot


KASAN: use-after-free Read in memcmp

Status: auto-closed as invalid on 2019/02/22 10:34
Subsystems: rds
[Documentation on labels]
Reported-by: syzbot+9c2fa798948a23cdd3f0@syzkaller.appspotmail.com
First crash: 2280d, last: 2280d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in memcmp 0 (1) 2018/01/27 16:05

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcmp+0xe3/0x160 lib/string.c:861
Read of size 1 at addr ffff8801c026aae0 by task kworker/u4:10/7138

CPU: 1 PID: 7138 Comm: kworker/u4:10 Not tainted 4.15.0-rc9+ #210
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: krdsd rds_send_worker
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
 memcmp+0xe3/0x160 lib/string.c:861
 memcmp include/linux/string.h:385 [inline]
 rhashtable_compare include/linux/rhashtable.h:612 [inline]
 __rhashtable_lookup include/linux/rhashtable.h:634 [inline]
 rhashtable_lookup include/linux/rhashtable.h:666 [inline]
 rhashtable_lookup_fast include/linux/rhashtable.h:692 [inline]
 rds_find_bound+0x498/0xa10 net/rds/bind.c:63
 rds_recv_incoming+0x582/0x11d0 net/rds/recv.c:360
 rds_loop_xmit+0x149/0x320 net/rds/loop.c:82
 rds_send_xmit+0xa70/0x2480 net/rds/send.c:355
 rds_send_worker+0x115/0x2a0 net/rds/threads.c:199
 process_one_work+0xbbf/0x1b10 kernel/workqueue.c:2113
 worker_thread+0x223/0x1990 kernel/workqueue.c:2247
 kthread+0x33c/0x400 kernel/kthread.c:238
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:541

Allocated by task 11357:
 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:551
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544
 sk_prot_alloc+0x65/0x2a0 net/core/sock.c:1465
 sk_alloc+0x105/0x1440 net/core/sock.c:1525
 rds_create+0x11c/0x660 net/rds/af_rds.c:535
 __sock_create+0x4d4/0x850 net/socket.c:1285
 sock_create net/socket.c:1325 [inline]
 SYSC_socket net/socket.c:1355 [inline]
 SyS_socket+0xeb/0x1d0 net/socket.c:1335
 entry_SYSCALL_64_fastpath+0x29/0xa0

Freed by task 11357:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3488 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3746
 sk_prot_free net/core/sock.c:1506 [inline]
 __sk_destruct+0x628/0x920 net/core/sock.c:1590
 sk_destruct+0x47/0x80 net/core/sock.c:1598
 __sk_free+0xf1/0x2b0 net/core/sock.c:1609
 sk_free+0x2a/0x40 net/core/sock.c:1620
 sock_put include/net/sock.h:1658 [inline]
 rds_release+0x3a6/0x520 net/rds/af_rds.c:89
 sock_release+0x8d/0x1e0 net/socket.c:595
 sock_close+0x16/0x20 net/socket.c:1149
 __fput+0x327/0x7e0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x199/0x270 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x296/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264
 entry_SYSCALL_64_fastpath+0x9e/0xa0

The buggy address belongs to the object at ffff8801c026a680
 which belongs to the cache RDS of size 1472
The buggy address is located 1120 bytes inside of
 1472-byte region [ffff8801c026a680, ffff8801c026ac40)
The buggy address belongs to the page:
page:ffffea0007009a80 count:1 mapcount:0 mapping:ffff8801c026a040 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801c026a040 0000000000000000 0000000100000005
raw: ffffea0006fe95a0 ffffea0006f689a0 ffff8801d2d22200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c026a980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c026aa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801c026aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8801c026ab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c026ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/26 18:38 net-next-old 9515a2e082f9 1d18b112 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.