From patchwork Mon Oct 5 20:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 1376860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XFAnarys; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C4sVQ6RcMz9sVX for ; Tue, 6 Oct 2020 07:23:10 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E732314B2CD0D; Mon, 5 Oct 2020 13:23:06 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=pabeni@redhat.com; receiver= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D0F8B14B2CD0B for ; Mon, 5 Oct 2020 13:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601929383; 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=smqPuln6+AlKsYdIl2xvj/7NZM+VjhVyu+3XfPP+3rQ=; b=XFAnarysjBfC1vS+FCwoyE4PVIygAjCQ/2dgy3u8K2of6GB/2HLLfcwrjOIQyqtyQ6a6ja waO494Y1FmE38deWXlxtH4nVtSdotQ6LnRIf2e+CQUhrDIJZd7PqfF5g0Zy/qCUfDt6BRW b4SQyXKOt4F1vOrU9aKOQYnCw1hB9/M= 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-57-aBpEp65nPr229bX4yh77jQ-1; Mon, 05 Oct 2020 16:23:01 -0400 X-MC-Unique: aBpEp65nPr229bX4yh77jQ-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 3A640107ACF9; Mon, 5 Oct 2020 20:23:00 +0000 (UTC) Received: from ovpn-112-73.ams2.redhat.com (ovpn-112-73.ams2.redhat.com [10.36.112.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF5175D9CD; Mon, 5 Oct 2020 20:22:58 +0000 (UTC) Message-ID: <003589e3dce1ed8d9b9970bbf8ed1661ced8d2cc.camel@redhat.com> From: Paolo Abeni To: syzbot , mptcp@lists.01.org, syzkaller-bugs@googlegroups.com Date: Mon, 05 Oct 2020 22:22:56 +0200 In-Reply-To: <00000000000009067705b0ef9cbd@google.com> References: <00000000000009067705b0ef9cbd@google.com> User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: FIKPBISJZPIOFUQYQFJZEJXYTFUC7YSE X-Message-ID-Hash: FIKPBISJZPIOFUQYQFJZEJXYTFUC7YSE X-MailFrom: pabeni@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] Re: INFO: task hung in lock_sock_nested (3) List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 2020-10-05 at 10:14 -0700, syzbot wrote: > Sending NMI from CPU 0 to CPUs 1: > NMI backtrace for cpu 1 > CPU: 1 PID: 2648 Comm: kworker/1:3 Not tainted 5.9.0-rc6-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > Workqueue: events mptcp_worker > RIP: 0010:check_memory_region+0x134/0x180 mm/kasan/generic.c:193 > Code: 85 d2 75 0b 48 89 da 48 29 c2 e9 55 ff ff ff 49 39 d2 75 17 49 0f be 02 41 83 e1 07 49 39 c1 7d 0a 5b b8 01 00 00 00 5d 41 5c 44 89 c2 e8 e3 ef ff ff 5b 83 f0 01 5d 41 5c c3 48 29 c3 48 89 > RSP: 0018:ffffc90008d4f868 EFLAGS: 00000046 > RAX: 0000000000000001 RBX: 0000000000000002 RCX: ffffffff815bc144 > RDX: fffffbfff1a21b52 RSI: 0000000000000008 RDI: ffffffff8d10da88 > RBP: ffff88809f3ee100 R08: 0000000000000000 R09: ffffffff8d10da8f > R10: fffffbfff1a21b51 R11: 0000000000000000 R12: 0000000000000579 > R13: 0000000000000004 R14: dffffc0000000000 R15: ffff88809f3eea08 > FS: 0000000000000000(0000) GS:ffff8880ae500000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 0000558030ecfd70 CR3: 0000000091828000 CR4: 00000000001506e0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > Call Trace: > instrument_atomic_read include/linux/instrumented.h:56 [inline] > test_bit include/asm-generic/bitops/instrumented-non-atomic.h:110 [inline] > hlock_class kernel/locking/lockdep.c:179 [inline] > check_wait_context kernel/locking/lockdep.c:4140 [inline] > __lock_acquire+0x704/0x5780 kernel/locking/lockdep.c:4391 > lock_acquire+0x1f3/0xaf0 kernel/locking/lockdep.c:5029 > __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] > _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175 > spin_lock_bh include/linux/spinlock.h:359 [inline] > lock_sock_nested+0x3b/0x110 net/core/sock.c:3041 > lock_sock include/net/sock.h:1581 [inline] > __mptcp_move_skbs+0x1fb/0x510 net/mptcp/protocol.c:1469 > mptcp_worker+0x19f/0x15b0 net/mptcp/protocol.c:1726 > process_one_work+0x94c/0x1670 kernel/workqueue.c:2269 > worker_thread+0x64c/0x1120 kernel/workqueue.c:2415 > kthread+0x3b5/0x4a0 kernel/kthread.c:292 > ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Looks like we are looping in __mptcp_move_skbs(), so let's try another attempt. #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f483eab0081a..42928db28351 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -471,8 +471,15 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, mptcp_subflow_get_map_offset(subflow); skb = skb_peek(&ssk->sk_receive_queue); - if (!skb) + if (!skb) { + /* if no data is found, a racing workqueue/recvmsg + * already processed the new data, stop here or we + * can enter an infinite loop + */ + if (!moved) + done = true; break; + } if (__mptcp_check_fallback(msk)) { /* if we are running under the workqueue, TCP could have