From mboxrd@z Thu Jan 1 00:00:00 1970 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 A2E74215F4B for ; Wed, 26 Feb 2025 02:13:33 +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=1740536013; cv=none; b=XfBZ0w+omMaeZivcIZUpuFZmeGFsSZWhpPXkgFQ6Ep/hYm0V8qarwhHlJ9GjOvYQcnoE6/Ol/8siRWfqs17bh21B02u6wR9sm+JEyJ8IAD9WW4TfeMbXIVOVNPJf7YfBrgSYyxvOuKM3vApw+pi2OcuBPzNyDWV6/DDyEq9d5K8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536013; c=relaxed/simple; bh=Ds7BFLAP3oPzBLrbJoYeNzivdZfoAu5Q5SX/ijZafm0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VSSgjgK7gicCqIok8NuQkaaWjTEddrP5Ltm/XPWIeo4VI7dLO3y9jdQ6pcScxb617FEOJDWu+fArDCAYp7D2S7X5ASEfErvskj8Re1QDoANyiWACmHNNpIW6PK6d/dnz18AZpMUW2yFwZEh+BkGGhx0JA6MHu7cIA0q5DGjCs9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Bvr5e+WN; 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="Bvr5e+WN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A1CEC4CEDD; Wed, 26 Feb 2025 02:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536013; bh=Ds7BFLAP3oPzBLrbJoYeNzivdZfoAu5Q5SX/ijZafm0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Bvr5e+WNTQ9PdlQetfEJufRq8XFaY1lo3HE5SjUs+dFVJU9Gi04BQvYl+Rn2ANjZR RMO4+aRtKfPUynoyrxKb9FgS5ZbhI4YO6mvVcSf8cPq7O9Hi5C5q9QlajLt2RUtHFm UJYlpVBSn6LWDvC3OpikNd09x0AKMboHFsEcJ4XY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49372: tcp: tcp_rtx_synack() can be called from process context Date: Wed, 26 Feb 2025 03:10:46 +0100 Message-ID: <2025022646-CVE-2022-49372-45e1@gregkh> X-Mailer: git-send-email 2.48.1 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=5301; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Ds7BFLAP3oPzBLrbJoYeNzivdZfoAu5Q5SX/ijZafm0=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7yl952PhPldkZm9lZ1R+9c8etn57MjA99t+o1HTtkr ZgbeSq0I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTAC4SzzCHN678R9dEs+8XJC8E a3lbfdsflZTLsODKTIvGHR/X7TpxfJF8gOyU+1n//TgB 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: tcp: tcp_rtx_synack() can be called from process context Laurent reported the enclosed report [1] This bug triggers with following coditions: 0) Kernel built with CONFIG_DEBUG_PREEMPT=y 1) A new passive FastOpen TCP socket is created. This FO socket waits for an ACK coming from client to be a complete ESTABLISHED one. 2) A socket operation on this socket goes through lock_sock() release_sock() dance. 3) While the socket is owned by the user in step 2), a retransmit of the SYN is received and stored in socket backlog. 4) At release_sock() time, the socket backlog is processed while in process context. 5) A SYNACK packet is cooked in response of the SYN retransmit. 6) -> tcp_rtx_synack() is called in process context. Before blamed commit, tcp_rtx_synack() was always called from BH handler, from a timer handler. Fix this by using TCP_INC_STATS() & NET_INC_STATS() which do not assume caller is in non preemptible context. [1] BUG: using __this_cpu_add() in preemptible [00000000] code: epollpep/2180 caller is tcp_rtx_synack.part.0+0x36/0xc0 CPU: 10 PID: 2180 Comm: epollpep Tainted: G OE 5.16.0-0.bpo.4-amd64 #1 Debian 5.16.12-1~bpo11+1 Hardware name: Supermicro SYS-5039MC-H8TRF/X11SCD-F, BIOS 1.7 11/23/2021 Call Trace: dump_stack_lvl+0x48/0x5e check_preemption_disabled+0xde/0xe0 tcp_rtx_synack.part.0+0x36/0xc0 tcp_rtx_synack+0x8d/0xa0 ? kmem_cache_alloc+0x2e0/0x3e0 ? apparmor_file_alloc_security+0x3b/0x1f0 inet_rtx_syn_ack+0x16/0x30 tcp_check_req+0x367/0x610 tcp_rcv_state_process+0x91/0xf60 ? get_nohz_timer_target+0x18/0x1a0 ? lock_timer_base+0x61/0x80 ? preempt_count_add+0x68/0xa0 tcp_v4_do_rcv+0xbd/0x270 __release_sock+0x6d/0xb0 release_sock+0x2b/0x90 sock_setsockopt+0x138/0x1140 ? __sys_getsockname+0x7e/0xc0 ? aa_sk_perm+0x3e/0x1a0 __sys_setsockopt+0x198/0x1e0 __x64_sys_setsockopt+0x21/0x30 do_syscall_64+0x38/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae The Linux kernel CVE team has assigned CVE-2022-49372 to this issue. Affected and fixed versions =========================== Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 4.9.318 with commit 3db889f883e65bbd3b1401279bfc1e9ed255c481 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 4.14.283 with commit c348b0f8d035fc4bdc040796889beec7218bd1b8 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 4.19.247 with commit 58bd38cbc961fd799842b7be8c5222310f04b908 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.4.198 with commit d05c2fdf8e10528bb6751bd95243e862d5402a9b Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.10.122 with commit 0a0f7f84148445c9f02f226928803a870139d820 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.15.47 with commit 88cd232146207ff1d41dededed5e77c0d4438113 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.17.15 with commit bdc28a8fb43cc476e33b11519235adb816ce00e8 Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.18.4 with commit d8e1bc6029acac796293310aacef7b7336f35b6a Issue introduced in 3.7 with commit 168a8f58059a22feb9e9a2dcc1b8053dbbbc12ef and fixed in 5.19 with commit 0a375c822497ed6ad6b5da0792a12a6f1af10c0b 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-49372 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/ipv4/tcp_output.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/3db889f883e65bbd3b1401279bfc1e9ed255c481 https://git.kernel.org/stable/c/c348b0f8d035fc4bdc040796889beec7218bd1b8 https://git.kernel.org/stable/c/58bd38cbc961fd799842b7be8c5222310f04b908 https://git.kernel.org/stable/c/d05c2fdf8e10528bb6751bd95243e862d5402a9b https://git.kernel.org/stable/c/0a0f7f84148445c9f02f226928803a870139d820 https://git.kernel.org/stable/c/88cd232146207ff1d41dededed5e77c0d4438113 https://git.kernel.org/stable/c/bdc28a8fb43cc476e33b11519235adb816ce00e8 https://git.kernel.org/stable/c/d8e1bc6029acac796293310aacef7b7336f35b6a https://git.kernel.org/stable/c/0a375c822497ed6ad6b5da0792a12a6f1af10c0b