Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp118803imm; Tue, 12 Jun 2018 19:52:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLNDo8O+3/1rCQjdppfaiXWpM7gw0KYQkSUl6B8lpHhE5Bv0pHft2UBGh2rUCUC05P+Ur33 X-Received: by 2002:a17:902:bb8a:: with SMTP id m10-v6mr3153220pls.236.1528858358019; Tue, 12 Jun 2018 19:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528858357; cv=none; d=google.com; s=arc-20160816; b=GnZjWdaMCc09rMPZWMudKjVC826MYdxwB/DUeUiVMcU/+MbYrSmihoA5cycKJycmsz 8jDn8QhxGJGF7xb/DZbZGzTu4siV895wPM/pU1kaqSRkypkmEtdyLebzYxEX0qGTCZtQ +8KOPcArLIP1pB1J+VTddCZM/Bp4I/+gJ59QSU66v3Oa4/1Se8YvgWQM/k46VwgcRPDb Egq7UpxWBeTjrbIO1D/AKByRuTMaFP+8rRUYFmv7CD5HEA5EHfxviitEvlrb+I1qm7ue fyjArB1hFncoF7zA+1Sd1yQRBgAa19WNDnXub9VJz3rmeMaAc9NkqIh3XALvADON7DCA HVmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:from:subject:message-id:in-reply-to :date:mime-version:arc-authentication-results; bh=5ub7yknKvMW3i4+lq5sHzoTOWz90v2OSVyr4mUNZv9s=; b=RXdML04H4JUAV+p0qBxuLLMZUnnKIb1aEmfsGxqkZfxIhYxQnERcx3ojebvI+E+pFm 7uvgrVKKXX7Qw264my2+t4T2qnrU1gbR23qNV44mnyEon3BIGtCJYQPI/5/BxKzwkFTt FkjBSuWTYOqR7FbyViN1NoAguHWqe2FXsTaKbAjiirZK/pW4t63nDE4y64avX9Pz0vxs eD6rNIz++R1uD1B8D4fsBNDf/X0+ArF8ShPT0l7x5wtL8g9wIhNpRhWffj5FaLXIwy50 ODVKITvxcN8FH3Rzhiz0eIGC15f0+KFqyX39jzPsrTzEn2sziyOh+jY4BjPTMtOXrToF L6cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1-v6si1589835plt.183.2018.06.12.19.52.23; Tue, 12 Jun 2018 19:52:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933784AbeFMCvV (ORCPT + 99 others); Tue, 12 Jun 2018 22:51:21 -0400 Received: from mail-it0-f72.google.com ([209.85.214.72]:40172 "EHLO mail-it0-f72.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933226AbeFMCvD (ORCPT ); Tue, 12 Jun 2018 22:51:03 -0400 Received: by mail-it0-f72.google.com with SMTP id m131-v6so1305900itm.5 for ; Tue, 12 Jun 2018 19:51:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id:subject :from:to; bh=5ub7yknKvMW3i4+lq5sHzoTOWz90v2OSVyr4mUNZv9s=; b=SXba89oj/Ll12lDfcs7QwRTYsW0nEFbozkj1ku3kqltMCjBNU9+tCVToTlOhnMJ0Lc KGbCRmQN8+7PpDONN2pa87HuN4/cPVrVFkR1rEWonOsGJzZLpsDtsBZgbu/PA/vJxjs/ 2Y93inVIBGQWGcdKDazPot/EHulpDinSjKEKLtOwsnCqdOZXv3PpJPUScHz2fQMopixN YG5vxaArnHcMssvwNK/CnWejUdyHwtjJmPZ/oq7hM0/J/h8ci818morqkNIOpPBBs/WA 072y20wzqSayvAHrz3zvuWJanV2ucomphBiBCxw8czp44jZM9exI9iAqxN4/Mi2sDNmV +ZhA== X-Gm-Message-State: APt69E08js/7kWNVCRr9C/KXLO/GWovYZ9AZ1VuB1U7l9rYo8ifljKcN WIkgB1XPFogyENH2jTD2Wnif5NxbOsjhwY4KfSfkezxSEWcj MIME-Version: 1.0 X-Received: by 2002:a6b:b242:: with SMTP id b63-v6mr1398204iof.47.1528858262517; Tue, 12 Jun 2018 19:51:02 -0700 (PDT) Date: Tue, 12 Jun 2018 19:51:02 -0700 In-Reply-To: <089e08e548431cd0f90565c9f4e5@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000a643e4056e7d0db4@google.com> Subject: Re: KASAN: use-after-free Read in rds_cong_queue_updates From: syzbot To: davem@davemloft.net, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com, santosh.shilimkar@oracle.com, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syzbot has found a reproducer for the following crash on: HEAD commit: f0dc7f9c6dd9 Merge git://git.kernel.org/pub/scm/linux/kern.. git tree: net-next console output: https://syzkaller.appspot.com/x/log.txt?x=1461f03f800000 kernel config: https://syzkaller.appspot.com/x/.config?x=fa9c20c48788d1c1 dashboard link: https://syzkaller.appspot.com/bug?extid=4c20b3866171ce8441d2 compiler: gcc (GCC) 8.0.1 20180413 (experimental) syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=16cbfeaf800000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=165227f7800000 IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+4c20b3866171ce8441d2@syzkaller.appspotmail.com 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 ==================================================================