syzbot


KASAN: use-after-free Read in rds_inc_put

Status: auto-closed as invalid on 2019/12/01 05:58
Subsystems: rds
[Documentation on labels]
Reported-by: syzbot+322126673a98080e677f@syzkaller.appspotmail.com
First crash: 1667d, last: 1667d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in rds_inc_put 0 (1) 2019/10/03 06:18
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in rds_inc_put (2) rds 1 1562d 1562d 0/26 auto-closed as invalid on 2020/05/14 12:36
linux-4.19 KASAN: use-after-free Read in rds_inc_put 1 1679d 1679d 0/1 auto-closed as invalid on 2020/01/18 05:12

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rds_inc_put+0x141/0x150 net/rds/recv.c:82
Read of size 8 at addr ffff88806f5371b0 by task syz-executor.0/18418

CPU: 1 PID: 18418 Comm: syz-executor.0 Not tainted 5.4.0-rc1-next-20191002 #0
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:634
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 rds_inc_put+0x141/0x150 net/rds/recv.c:82
 rds_clear_recv_queue+0x157/0x380 net/rds/recv.c:770
 rds_release+0x117/0x3d0 net/rds/af_rds.c:73
 __sock_release+0xce/0x280 net/socket.c:591
 sock_close+0x1e/0x30 net/socket.c:1269
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x904/0x2e60 kernel/exit.c:817
 do_group_exit+0x135/0x360 kernel/exit.c:921
 get_signal+0x47c/0x2500 kernel/signal.c:2734
 do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
 do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a29
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f4088663cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000075bf28 RCX: 0000000000459a29
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000075bf28
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000075bf2c
R13: 00007ffe10e1ad8f R14: 00007f40886649c0 R15: 000000000075bf2c

Allocated by task 12004:
 save_stack+0x23/0x90 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc mm/kasan/common.c:510 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:483
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:518
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc mm/slab.c:3319 [inline]
 kmem_cache_alloc+0x121/0x710 mm/slab.c:3483
 kmem_cache_zalloc include/linux/slab.h:680 [inline]
 __rds_conn_create+0x63f/0x20b0 net/rds/connection.c:193
 rds_conn_create_outgoing+0x4b/0x60 net/rds/connection.c:351
 rds_sendmsg+0x19a4/0x35b0 net/rds/send.c:1294
 sock_sendmsg_nosec net/socket.c:638 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:658
 __sys_sendto+0x262/0x380 net/socket.c:1953
 __do_sys_sendto net/socket.c:1965 [inline]
 __se_sys_sendto net/socket.c:1961 [inline]
 __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1961
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9330:
 save_stack+0x23/0x90 mm/kasan/common.c:69
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:471
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
 __cache_free mm/slab.c:3425 [inline]
 kmem_cache_free+0x86/0x320 mm/slab.c:3693
 rds_conn_destroy+0x61f/0x880 net/rds/connection.c:501
 rds_loop_kill_conns net/rds/loop.c:213 [inline]
 rds_loop_exit_net+0x2fc/0x4a0 net/rds/loop.c:219
 ops_exit_list.isra.0+0xaa/0x150 net/core/net_namespace.c:172
 cleanup_net+0x4e2/0xa60 net/core/net_namespace.c:594
 process_one_work+0x9af/0x1740 kernel/workqueue.c:2269
 worker_thread+0x98/0xe40 kernel/workqueue.c:2415
 kthread+0x361/0x430 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff88806f537168
 which belongs to the cache rds_connection of size 232
The buggy address is located 72 bytes inside of
 232-byte region [ffff88806f537168, ffff88806f537250)
The buggy address belongs to the page:
page:ffffea0001bd4dc0 refcount:1 mapcount:0 mapping:ffff88809bcbd1c0 index:0xffff88806f537608
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffff88809bcfb338 ffffea00026b0248 ffff88809bcbd1c0
raw: ffff88806f537608 ffff88806f537040 0000000100000005 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88806f537080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88806f537100: 00 00 00 00 00 fc fc fc fc fc fc fc fc fb fb fb
>ffff88806f537180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff88806f537200: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
 ffff88806f537280: fc fc 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
2019/10/02 05:57 linux-next a32db7e11724 b7a87a83 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.