Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6770116pxb; Wed, 17 Feb 2021 12:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZC+uKcnNVaMT2g5mPaKAESfs5Z7uCMEsRVHE1UwO38pPq2io2F9LCXvmKqJaCUTC3dbHq X-Received: by 2002:a17:906:5043:: with SMTP id e3mr816437ejk.260.1613595560509; Wed, 17 Feb 2021 12:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613595560; cv=none; d=google.com; s=arc-20160816; b=Zx5HxVj4wIaxUCtLEJRd8GMFXIGCi2F/Ybkt2TwMGxuJ8IxJD4ntH/mUAUOvAeyPgV h7179xcmUhy5GZd6pnbivXU9z0Z91N2mjWo9Qqj9JsVH2pnM4ltrNpD6MJkzKXYOsS62 NufRewBUT40UQ+b6Z+tfks7DDfWqDuTDtmVagIWvYr6+A9JP1a+wGNFYqgccvp4Vj8bM WST2u46q7ZZOvFGEB4xSmTi34Vv8pZc2rfR8uxIQfsfyMw5asUA2u/176C99MV+oZlJm yOiIAVRC3J7jUGb1KVPbDqnOk3Q66+EuBDX3YTwUKUovvnXbcYKEpDQs+F7s14S7J3RJ Dpjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id :dkim-signature; bh=Dl8x4+wFVVURHKDXzzceJJdbMGUykA8qXliYXfk5Wlg=; b=DR2Qb/CGA73jukXdhqMcCdU9DhhqPV5KuozqkkvHDCYKW+MpBFHW1nH1o8cVZG9mD5 lgJHl4awVcW1SwQ5gMSdWMOifrAUg9TkrdPEF9tT8Wy9awkQV3KA4AkBHySOt8YuzmVJ XEJ6zKgWc2fy02QN0QxjLabwYek/K/FoWgLtPeOSHy8EziTyFw7PGznbAVPfmi5DmY6z pUIQvNLjQQeh0AMdrfQGbUKdAKis7TleT2fqpePjgqH2Q6zWV+ITsVa/pX13sr/F+Sn1 oAFORQeVJmnlxdyraID0um0/M3Doc7zP/w4g7k/O5s06daCjRxjvooQz3gOy2juO0BY9 sZmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YvAxw4Zw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji19si2033235ejc.358.2021.02.17.12.58.56; Wed, 17 Feb 2021 12:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YvAxw4Zw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234907AbhBQSlI (ORCPT + 99 others); Wed, 17 Feb 2021 13:41:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37383 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbhBQSlH (ORCPT ); Wed, 17 Feb 2021 13:41:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613587180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dl8x4+wFVVURHKDXzzceJJdbMGUykA8qXliYXfk5Wlg=; b=YvAxw4Zwv7XHPoxsUvbMockrwf7WHCqYi86+Puff5qFvVyAsGKDCnWA2CoUcfAnzbSCuAi 3odaNKQYun4kMXUQeRePl0gxck+xUOEC7LQRjyGLwkQi+SlvUSAcci3dNCkBzd9VPPtVai /gHid/Ao9xaNpVTnMxelzhpwwHaAm5w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-534-eIye0K15NH66gAmDF3Dwtg-1; Wed, 17 Feb 2021 13:39:37 -0500 X-MC-Unique: eIye0K15NH66gAmDF3Dwtg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AD29107ACF9; Wed, 17 Feb 2021 18:39:35 +0000 (UTC) Received: from ovpn-114-40.ams2.redhat.com (ovpn-114-40.ams2.redhat.com [10.36.114.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 030425D9C2; Wed, 17 Feb 2021 18:39:32 +0000 (UTC) Message-ID: <2ff81838f3f141da3b238e913115a98f44f9b7d2.camel@redhat.com> Subject: Re: [MPTCP] KASAN: use-after-free Read in mptcp_established_options From: Paolo Abeni To: syzbot , davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, mathew.j.martineau@linux.intel.com, matthieu.baerts@tessares.net, mptcp@lists.01.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com Date: Wed, 17 Feb 2021 19:39:31 +0100 In-Reply-To: <000000000000ea934b05bb8b92cf@google.com> References: <000000000000ea934b05bb8b92cf@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-02-17 at 09:30 -0800, syzbot wrote: > syzbot found the following issue on: > > HEAD commit: 966df6de lan743x: sync only the received area of an rx rin.. > git tree: net-next > console output: https://syzkaller.appspot.com/x/log.txt?x=11afe082d00000 > kernel config: https://syzkaller.appspot.com/x/.config?x=dbc1ca9e55dc1f9f > dashboard link: https://syzkaller.appspot.com/bug?extid=3c1e5ab4997849b69807 > > Unfortunately, I don't have any reproducer for this issue yet. > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+3c1e5ab4997849b69807@syzkaller.appspotmail.com > > ================================================================== > BUG: KASAN: use-after-free in mptcp_check_fallback net/mptcp/protocol.h:745 [inline] > BUG: KASAN: use-after-free in mptcp_established_options+0x22cf/0x2780 net/mptcp/options.c:724 > Read of size 8 at addr ffff88802bea10a0 by task syz-executor.1/11042 > > CPU: 1 PID: 11042 Comm: syz-executor.1 Not tainted 5.11.0-rc7-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > Call Trace: > __dump_stack lib/dump_stack.c:79 [inline] > dump_stack+0x107/0x163 lib/dump_stack.c:120 > print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:230 > __kasan_report mm/kasan/report.c:396 [inline] > kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413 > mptcp_check_fallback net/mptcp/protocol.h:745 [inline] > mptcp_established_options+0x22cf/0x2780 net/mptcp/options.c:724 > tcp_established_options+0x4ed/0x700 net/ipv4/tcp_output.c:953 > tcp_current_mss+0x1d2/0x360 net/ipv4/tcp_output.c:1840 > tcp_send_mss+0x28/0x2b0 net/ipv4/tcp.c:943 > mptcp_sendmsg_frag+0x13b/0x1220 net/mptcp/protocol.c:1266 > mptcp_push_pending+0x2cc/0x650 net/mptcp/protocol.c:1477 > mptcp_sendmsg+0xde4/0x2830 net/mptcp/protocol.c:1685 > inet6_sendmsg+0x99/0xe0 net/ipv6/af_inet6.c:642 > sock_sendmsg_nosec net/socket.c:652 [inline] > sock_sendmsg+0xcf/0x120 net/socket.c:672 > sock_write_iter+0x289/0x3c0 net/socket.c:999 > call_write_iter include/linux/fs.h:1901 [inline] > new_sync_write+0x426/0x650 fs/read_write.c:518 > vfs_write+0x791/0xa30 fs/read_write.c:605 > ksys_write+0x1ee/0x250 fs/read_write.c:658 > do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > RIP: 0033:0x465d99 > Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 > RSP: 002b:00007ff231ccc188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 > RAX: ffffffffffffffda RBX: 000000000056c008 RCX: 0000000000465d99 > RDX: 000000000003f9b4 RSI: 0000000020000000 RDI: 0000000000000004 > RBP: 00000000004bcf27 R08: 0000000000000000 R09: 0000000000000000 > R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c008 > R13: 00007ffeaa2da27f R14: 00007ff231ccc300 R15: 0000000000022000 > > Allocated by task 11017: > kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 > kasan_set_track mm/kasan/common.c:46 [inline] > set_alloc_info mm/kasan/common.c:401 [inline] > ____kasan_kmalloc.constprop.0+0x82/0xa0 mm/kasan/common.c:429 > kmalloc include/linux/slab.h:552 [inline] > kzalloc include/linux/slab.h:682 [inline] > subflow_create_ctx+0x82/0x230 net/mptcp/subflow.c:1378 > subflow_ulp_init+0x62/0x370 net/mptcp/subflow.c:1459 > __tcp_set_ulp net/ipv4/tcp_ulp.c:139 [inline] > tcp_set_ulp+0x27c/0x610 net/ipv4/tcp_ulp.c:160 > mptcp_subflow_create_socket+0x5bf/0xe20 net/mptcp/subflow.c:1343 > __mptcp_socket_create net/mptcp/protocol.c:110 [inline] > mptcp_init_sock net/mptcp/protocol.c:2365 [inline] > mptcp_init_sock+0x140/0x830 net/mptcp/protocol.c:2350 > inet6_create net/ipv6/af_inet6.c:256 [inline] > inet6_create+0xa15/0x1010 net/ipv6/af_inet6.c:110 > __sock_create+0x3de/0x780 net/socket.c:1406 > sock_create net/socket.c:1457 [inline] > __sys_socket+0xef/0x200 net/socket.c:1499 > __do_sys_socket net/socket.c:1508 [inline] > __se_sys_socket net/socket.c:1506 [inline] > __x64_sys_socket+0x6f/0xb0 net/socket.c:1506 > do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > Freed by task 10650: > kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 > kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 > kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:356 > ____kasan_slab_free+0xe1/0x110 mm/kasan/common.c:362 > kasan_slab_free include/linux/kasan.h:192 [inline] > slab_free_hook mm/slub.c:1547 [inline] > slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1580 > slab_free mm/slub.c:3143 [inline] > kmem_cache_free_bulk mm/slub.c:3269 [inline] > kmem_cache_free_bulk+0x253/0xc80 mm/slub.c:3256 > kfree_bulk include/linux/slab.h:409 [inline] > kfree_rcu_work+0x4cd/0x860 kernel/rcu/tree.c:3226 > process_one_work+0x98d/0x15f0 kernel/workqueue.c:2275 > worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 > kthread+0x3b1/0x4a0 kernel/kthread.c:292 > ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 > > The buggy address belongs to the object at ffff88802bea1000 > which belongs to the cache kmalloc-256 of size 256 > The buggy address is located 160 bytes inside of > 256-byte region [ffff88802bea1000, ffff88802bea1100) > The buggy address belongs to the page: > page:0000000026103328 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2bea0 > head:0000000026103328 order:1 compound_mapcount:0 > flags: 0xfff00000010200(slab|head) > raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010c413c0 > raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 > page dumped because: kasan: bad access detected > > Memory state around the buggy address: > ffff88802bea0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc > ffff88802bea1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > > ffff88802bea1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > ^ > ffff88802bea1100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc > ffff88802bea1180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc > ================================================================== very likely #syz dup: WARNING in dst_release (same root cause, we need to clear msk->first when the relevant subflow is disposed by the workqueue) /P