syzbot


KASAN: use-after-free Read in rds_cong_queue_updates

Status: fixed on 2018/07/09 18:05
Subsystems: rds
[Documentation on labels]
Reported-by: syzbot+4c20b3866171ce8441d2@syzkaller.appspotmail.com
Fix commit: f1693c63ab13 rds: avoid unenecessary cong_update in loop transport c809195f5523 rds: clean up loopback rds_connections on netns deletion
First crash: 2420d, last: 2287d
Duplicate bugs (4)
duplicates (4):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: use-after-free Read in rds_queue_reconnect rds 19 2377d 2406d 0/28 closed as dup on 2018/03/07 13:54
KASAN: use-after-free Read in inet_create net 445 2328d 2493d 0/28 closed as dup on 2018/04/09 01:05
KASAN: out-of-bounds Read in rds_cong_queue_updates (2) rds 3 2309d 2308d 0/28 closed as dup on 2018/06/13 07:52
KASAN: slab-out-of-bounds Read in rds_cong_queue_updates rds 16908 2288d 2418d 0/28 closed as dup on 2018/03/19 06:29
Discussions (11)
Title Replies (including bot) Last reply
[PATCH 4.4 00/31] 4.4.143-stable review 37 (37) 2018/09/12 18:54
[PATCH 4.17 000/324] 4.17.19-stable review 308 (308) 2018/08/24 05:10
KASAN: use-after-free Read in rds_cong_queue_updates (2) 1 (2) 2018/07/23 17:38
[PATCH 3.18 00/29] 3.18.116-stable review 32 (32) 2018/07/22 11:42
[PATCH 4.17 000/101] 4.17.9-stable review 100 (101) 2018/07/22 11:42
[PATCH 4.14 00/92] 4.14.57-stable review 91 (92) 2018/07/21 13:41
[PATCH 4.9 00/66] 4.9.114-stable review 69 (69) 2018/07/21 13:40
KASAN: slab-out-of-bounds Read in rds_cong_queue_updates (2) 1 (2) 2018/07/11 21:00
[PATCH net-next] rds: clean up loopback rds_connections on netns deletion 12 (12) 2018/06/27 01:12
[PATCH] rds: avoid unenecessary cong_update in loop transport 2 (2) 2018/06/15 02:02
Re: KASAN: use-after-free Read in rds_cong_queue_updates 2 (2) 2018/06/13 07:54
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in rds_cong_queue_updates (2) rds 257 2015d 2267d 0/28 auto-closed as invalid on 2019/09/29 03:19

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:42 [inline]
BUG: KASAN: use-after-free in check_net include/net/net_namespace.h:236 [inline]
BUG: KASAN: use-after-free in rds_destroy_pending net/rds/rds.h:897 [inline]
BUG: KASAN: use-after-free in rds_cong_queue_updates+0x255/0x590 net/rds/cong.c:226
Read of size 4 at addr ffff8801ab180044 by task syz-executor199/4800

CPU: 1 PID: 4800 Comm: syz-executor199 Not tainted 4.17.0+ #84
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+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 kasan_check_read+0x11/0x20 mm/kasan/kasan.c:272
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 refcount_read include/linux/refcount.h:42 [inline]
 check_net include/net/net_namespace.h:236 [inline]
 rds_destroy_pending net/rds/rds.h:897 [inline]
 rds_cong_queue_updates+0x255/0x590 net/rds/cong.c:226
 rds_recv_rcvbuf_delta.part.3+0x211/0x350 net/rds/recv.c:126
 rds_recv_rcvbuf_delta net/rds/recv.c:735 [inline]
 rds_clear_recv_queue+0x2f0/0x4c0 net/rds/recv.c:735
 rds_release+0x15c/0x550 net/rds/af_rds.c:72
 __sock_release+0xd7/0x260 net/socket.c:603
 sock_close+0x19/0x20 net/socket.c:1186
 __fput+0x353/0x890 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 get_signal+0x886/0x1960 kernel/signal.c:2468
 do_signal+0x9c/0x21c0 arch/x86/kernel/signal.c:816
 exit_to_usermode_loop+0x2cf/0x360 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6ac/0x800 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x44f439
Code: e8 ac be 02 00 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 5b ff fb ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007fc65567dcf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006edadc RCX: 000000000044f439
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006edadc
RBP: 00000000006edad8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff3df31b1f R14: 00007fc65567e9c0 R15: 0000000000000061

Allocated by task 4800:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
 kmem_cache_zalloc include/linux/slab.h:696 [inline]
 net_alloc net/core/net_namespace.c:383 [inline]
 copy_net_ns+0x159/0x4c0 net/core/net_namespace.c:423
 create_new_namespaces+0x69d/0x8f0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xc3/0x1f0 kernel/nsproxy.c:206
 ksys_unshare+0x708/0xf90 kernel/fork.c:2411
 __do_sys_unshare kernel/fork.c:2479 [inline]
 __se_sys_unshare kernel/fork.c:2477 [inline]
 __x64_sys_unshare+0x31/0x40 kernel/fork.c:2477
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 746:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 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+0x86/0x2d0 mm/slab.c:3756
 net_free net/core/net_namespace.c:399 [inline]
 net_drop_ns.part.14+0x11a/0x130 net/core/net_namespace.c:406
 net_drop_ns net/core/net_namespace.c:405 [inline]
 cleanup_net+0x6a1/0xb20 net/core/net_namespace.c:541
 process_one_work+0xc64/0x1b70 kernel/workqueue.c:2153
 worker_thread+0x181/0x13a0 kernel/workqueue.c:2296
 kthread+0x345/0x410 kernel/kthread.c:240
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412

The buggy address belongs to the object at ffff8801ab180040
 which belongs to the cache net_namespace(17:syz0) of size 8896
The buggy address is located 4 bytes inside of
 8896-byte region [ffff8801ab180040, ffff8801ab182300)
The buggy address belongs to the page:
page:ffffea0006ac6000 count:1 mapcount:0 mapping:ffff8801aeaa0080 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801d3827048 ffff8801d3827048 ffff8801aeaa0080
raw: 0000000000000000 ffff8801ab180040 0000000100000001 ffff8801ab7cae40
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801ab7cae40

Memory state around the buggy address:
 ffff8801ab17ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8801ab17ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8801ab180000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8801ab180080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ab180100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (18168):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/06/13 02:50 net-next-old f0dc7f9c6dd9 6dcbc435 .config console log report syz C ci-upstream-net-kasan-gce
2018/07/04 02:59 upstream 410da1e12ffe 317fc8ea .config console log report ci-upstream-kasan-gce
2018/07/03 01:47 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce
2018/07/03 00:46 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce
2018/07/02 23:24 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce-root
2018/07/02 20:11 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce-root
2018/07/02 19:07 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce
2018/07/02 18:06 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce-root
2018/07/02 17:00 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce
2018/07/02 16:00 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce-root
2018/07/02 14:56 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce
2018/07/02 13:35 upstream 021c91791a5e dba0b50e .config console log report ci-upstream-kasan-gce
2018/07/02 12:20 upstream d3bc0e67f852 dba0b50e .config console log report ci-upstream-kasan-gce
2018/07/02 11:17 upstream d3bc0e67f852 dba0b50e .config console log report ci-upstream-kasan-gce
2018/07/02 10:08 upstream d3bc0e67f852 dba0b50e .config console log report ci-upstream-kasan-gce
2018/07/02 09:00 upstream d3bc0e67f852 dba0b50e .config console log report ci-upstream-kasan-gce
2018/07/02 07:30 upstream d3bc0e67f852 dba0b50e .config console log report ci-upstream-kasan-gce
2018/06/16 02:06 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/16 00:47 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/15 23:41 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/15 23:04 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/15 21:32 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/15 20:31 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce-root
2018/06/15 19:06 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/06/15 18:01 upstream 4c5e8fc62d6a 27c5f59f .config console log report ci-upstream-kasan-gce
2018/02/21 20:27 upstream af3e79d29555 04cbdbd1 .config console log report ci-upstream-kasan-gce
2018/07/02 21:14 upstream 021c91791a5e 574780b0 .config console log report ci-upstream-kasan-gce-386
2018/02/20 20:11 upstream 79c0ef3e85c0 5abac192 .config console log report ci-upstream-kasan-gce-386
2018/06/21 17:16 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/21 15:20 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/21 10:17 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/21 08:01 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/21 05:34 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/20 19:30 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/20 17:02 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/20 13:10 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/20 03:47 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/19 15:17 net-next-old f0dc7f9c6dd9 732e4256 .config console log report ci-upstream-net-kasan-gce
2018/06/19 11:46 net-next-old f0dc7f9c6dd9 732e4256 .config console log report ci-upstream-net-kasan-gce
2018/06/18 20:55 net-next-old f0dc7f9c6dd9 45c54f75 .config console log report ci-upstream-net-kasan-gce
2018/06/18 17:16 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
2018/06/17 21:38 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
2018/06/17 06:26 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
2018/06/16 19:09 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
2018/06/16 13:21 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.