Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C09881D1519 for ; Mon, 21 Oct 2024 20:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729541605; cv=none; b=UbvxixYssH3FXkKl+ok/oAu+UZQx/LDDgDcVvO9N31HSiC4ODngmVId8ixYx40UvHdHuu3LnMaox3jCHrHzTAAbffN9/0xWattAeV4Brt3X8ou73U0WZuQb7GlMzwOHj97Csi9+2uWDRwH9AnM0tS3pJDkjz6vmIx2uHPuY7fq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729541605; c=relaxed/simple; bh=xxWuVEAiMi+rY2noXHjS2uZJYMB5+8PgxiqVzS+wUBI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P/U7ZZVf7/1ZEcivaGmcArCHbay8HAQH4T1KMQuOm3Af3UEztWeQEg7pv7wh7SXwVHNuUE5cfcQtDVUBTRXEwWmsLAxBGxJzJOhjAda+D/RNvVeLA10p2VSUZU8pK5pyjcC0irwB7/h1/T4jdoR/md6h9icQWzZW2CQc+Q/TZBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f1IklX1a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f1IklX1a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11FD9C4CEC3; Mon, 21 Oct 2024 20:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729541605; bh=xxWuVEAiMi+rY2noXHjS2uZJYMB5+8PgxiqVzS+wUBI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=f1IklX1aAsiJS+ks3JwiXZ6eFJ7y0Y6Pyp3yae+/LHMQus70AFIEdwsZLXO6ynhcf c+grhgLk1HQzl9Lsk6Cfn+eHgK/uOmZ0dFvOFjokpeObC13x+6xknBYGeqYS1Kmnu2 bzPTISHpBGzxPHkFrN/0NAVabtY8sBUFnvbX9emk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49018: mptcp: fix sleep in atomic at close time Date: Mon, 21 Oct 2024 22:06:50 +0200 Message-ID: <2024102153-CVE-2022-49018-7ee3@gregkh> X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3853; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=xxWuVEAiMi+rY2noXHjS2uZJYMB5+8PgxiqVzS+wUBI=; b=owGbwMvMwCRo6H6F97bub03G02pJDOliWxRztpYm+dS/8FZS4Z+VzKfHcV7hgqzQs3mMjMePX 276bnCqI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACby7gjDgubWvX0nWr7u3NpR tXvN9rseOya17WeYZ3Ze7/ryGXc+vo2dIyu/KFq2dovHHgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: mptcp: fix sleep in atomic at close time Matt reported a splat at msk close time: BUG: sleeping function called from invalid context at net/mptcp/protocol.c:2877 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 155, name: packetdrill preempt_count: 201, expected: 0 RCU nest depth: 0, expected: 0 4 locks held by packetdrill/155: #0: ffff888001536990 (&sb->s_type->i_mutex_key#6){+.+.}-{3:3}, at: __sock_release (net/socket.c:650) #1: ffff88800b498130 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_close (net/mptcp/protocol.c:2973) #2: ffff88800b49a130 (sk_lock-AF_INET/1){+.+.}-{0:0}, at: __mptcp_close_ssk (net/mptcp/protocol.c:2363) #3: ffff88800b49a0b0 (slock-AF_INET){+...}-{2:2}, at: __lock_sock_fast (include/net/sock.h:1820) Preemption disabled at: 0x0 CPU: 1 PID: 155 Comm: packetdrill Not tainted 6.1.0-rc5 #365 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl (lib/dump_stack.c:107 (discriminator 4)) __might_resched.cold (kernel/sched/core.c:9891) __mptcp_destroy_sock (include/linux/kernel.h:110) __mptcp_close (net/mptcp/protocol.c:2959) mptcp_subflow_queue_clean (include/net/sock.h:1777) __mptcp_close_ssk (net/mptcp/protocol.c:2363) mptcp_destroy_common (net/mptcp/protocol.c:3170) mptcp_destroy (include/net/sock.h:1495) __mptcp_destroy_sock (net/mptcp/protocol.c:2886) __mptcp_close (net/mptcp/protocol.c:2959) mptcp_close (net/mptcp/protocol.c:2974) inet_release (net/ipv4/af_inet.c:432) __sock_release (net/socket.c:651) sock_close (net/socket.c:1367) __fput (fs/file_table.c:320) task_work_run (kernel/task_work.c:181 (discriminator 1)) exit_to_user_mode_prepare (include/linux/resume_user_mode.h:49) syscall_exit_to_user_mode (kernel/entry/common.c:130) do_syscall_64 (arch/x86/entry/common.c:87) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120) We can't call mptcp_close under the 'fast' socket lock variant, replace it with a sock_lock_nested() as the relevant code is already under the listening msk socket lock protection. The Linux kernel CVE team has assigned CVE-2022-49018 to this issue. Affected and fixed versions =========================== Issue introduced in 6.0 with commit 30e51b923e43 and fixed in 6.0.12 with commit d8e6c5500dbf Issue introduced in 6.0 with commit 30e51b923e43 and fixed in 6.1 with commit b4f166651d03 Issue introduced in 5.19.14 with commit b41808bfa049 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49018 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/mptcp/subflow.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/d8e6c5500dbf0f3e87aace90d4beba6ae928e866 https://git.kernel.org/stable/c/b4f166651d03b5484fa179817ba8ad4899a5a6ac