๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16048

Re: [PATCH net v7] kcm: reject TLS on attached TCP sockets

#16048
From: netdev-bot+sashiko
Date: Fri, 13 Nov 2026 23:25
81 lines
11060 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The Fixes: tag covers only one of the two defects the commit
  message says it fixes.

--

kcm: reject TLS on attached TCP sockets

This patch makes kcm_attach() reject TCP sockets that already have a ULP
installed. It also makes tls_init() reject sockets attached to KCM, using
a new kcm_attached flag in tcp_sock. The kcm_attach() type check now uses
sk_is_tcp(), so raw sockets created with IPPROTO_TCP are rejected.

Link: https://lore.kernel.org/netdev/3108e934-ec00-458b-8720-450554b35b55@linux.dev/

> KCM calls read_sock() from its receive callback in atomic context. With
> kTLS RX, this reaches tls_sw_read_sock(), which can sleep. KCM and TLS
> also replace socket callbacks, so detaching KCM can discard TLS handlers.

[ ... ]

> Fixes: 662fbcec32f4 ("net/tls: implement ->read_sock()")
> Cc: <stable@vger.kernel.org> # see backport requirement above

[Severity: Medium]

Does the Fixes: tag cover both of the problems described above?

662fbcec32f4 added tls_sw_read_sock() as the read_sock op, which explains
the sleep in atomic context. The callback replacement problem looks older.
In the parent of 662fbcec32f4, neither kcm_attach() nor tls_init() checked
for the other, so the two could already be stacked.

If KCM is attached first and TLS_RX is enabled afterwards,
tls_sw_strparser_arm() saves psock_data_ready and installs tls_data_ready:

net/tls/tls_sw.c:tls_sw_strparser_arm() {
    ...
	rx_ctx->saved_data_ready = sk->sk_data_ready;
	sk->sk_data_ready = tls_data_ready;
    ...
}

On SIOCKCMUNATTACH, kcm_unattach() then writes the pre-KCM callback back
over tls_data_ready:

net/kcm/kcmsock.c:kcm_unattach() {
    ...
	WRITE_ONCE(csk->sk_data_ready, psock->save_data_ready);
    ...
}

After that, TLS RX is no longer notified.

Before 662fbcec32f4 the TLS_SW proto_ops also inherited read_sock from
inet_stream_ops. So in either order, strp_read_sock() would call
tcp_read_sock(). KCM's strparser would then take raw TLS ciphertext from
the same receive queue that TLS parses.

This seems to go back to c46234ebb4d1 ("tls: RX path for ktls"). Stable
selection uses the Fixes: commit. Would LTS trees without 662fbcec32f4
(6.1, and 5.15/5.10 while they are still maintained) skip this patch? On
those trees an unprivileged user could still stack KCM and kTLS RX.

Could the Fixes: tag point at c46234ebb4d1, or could the Cc: stable note
say whether pre-6.6 trees are affected? Right now the note only mentions
the 8cc3aef0cb198 dependency.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112232444.2865382-1-rjethwani%40purestorage.com
Technical Details
Message-ID: <179461232334.2199510.12258955725199996955@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362977-linux-kernel-netdev=dewy.ru
References: <20261112232444.2865382-1-rjethwani@purestorage.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362977-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v7] kcm: reject TLS on attached TCP sockets
Date: Fri, 13 Nov 2026 23:25:23 +0000
Organization: Usenet Network
Message-ID: <179461232334.2199510.12258955725199996955@kernel.org>
References: <20261112232444.2865382-1-rjethwani@purestorage.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1465207"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:F6kYf6GDAPPrNj75C6bjY9UMUYE= sha256:HOFw9zZ3ezR/O7BXzL1J+V47DOv7hNpZ9Srwav7eUwU=
	sha1:R2ROv8rgbOJuGTBh4TmHuAFiGbE= sha256:qJaGk0y6dF6iIkVlk7SapnxJZXAM1SvYSFh30DGe1GY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 717CE1146DE; Sat, 14 Nov 2026 02:25:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Ytbw_DItyTzo;
	Sat, 14 Nov 2026 02:25:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-362977-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A513111467D; Sat, 14 Nov 2026 02:25:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 7B8756573D; Fri, 13 Nov 2026 23:25:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794612326;
	b=dvZqe7aXDPwbh4+W40fpSCHVbooC9nZjk61jZqd8Dls1fZzKEnJPVBf28BBHaXDJuW0G
	 Fp81oXXErkI3jaUWvH3NIZ2CXjAINj4p6mvSjlHvlR6wFD9QMUal7tdmCdn/YYjP+udcy
	 eT9/VpqYfXealwwYi5hrqZxpv1vWevaPjQNRNJwPYOZfMmg5kQcAZFxwR5ceo6Wd+KWXZ
	 g1CWGaQ1w30RYyjCVqpCvnD2txbaC+WIoCSZaC9Iy10/eRXFtQNkRkbCuOvYrqNUO0gC6
	 OjA2wZFcMi7M8zguyM3cxJLS0ZKHrLebspZuLenXVJByKfzEp1JW7Jep8xWB+w5nGQA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794612326;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=+ZI3gexBXpVYPbFMrALtqufJPetOQv+G/61FGO1yoek=;
	b=d79IGs9+0XNihvjljcxX7Pm9Petz7ePI+f2S3Cqux6AS0VRxzHeae5rxW5itVgiLlbyz
	 /+Ch/qKbdSulm4gt10nQYR151zNVA74jLX6Rrn0Cxm/fntiir62RgAcI85l9xLKLrEaq6
	 AvcPNyR2fUvoMK5DAGWDBVS2sC145WO2GPUwyFf3+Olbe+51+UDqV8joApify7bYaNI+X
	 B5kViQCGwn/LR29uoLEkzPUdEAAAf1ZAdhqSehzgvuE4fFg+CYoHbT9OJGVyoD+j2N/k7
	 IBCrS1Ow+Wjv9KtZ6cKWTThRqkK87DC4hm5kL5lV+S2OpLGShc2FYn3VKma79iKjsYw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SNrcmbeS;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 026D3606A899;
	Fri, 13 Nov 2026 23:25:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SNrcmbeS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794612325;
	b=jgSTl+qQ4GDtoWdBKPzPqpficx3P7twPoEz6BoACKB/12ryFfarepFbUPopgqYELgi2J
	 xnuYw1tCtGraoJ/xpDilbwTJXzpN+tIh3YpcOienJcqWoZvEwN9QCOw6SLHRC7IxyzYgm
	 25uBNrTOyzpWze8dDy98IVRfGZ22nclDk6LtexJX9JDjs0K28a9WPGX9YZJgHoYWIX3Qo
	 iE/HGJ3ywD8stt4wxtAt5sWB3Fyp++Y0Qe65AGGFmoJVljXdETsw0GRzElvDNrg0eZV9b
	 NZakjE349EUhbJkicXXj/zFmV6jPM+hVCvjGsuJSlFi8QwrCgc6wOfxzt9JxppLSBsw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794612325;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=+ZI3gexBXpVYPbFMrALtqufJPetOQv+G/61FGO1yoek=;
	b=lcxRNf14pNGWL8RtNlFid8jrsH506szgafXu+10V9qTlcth9fBdIhuT+tfW35iyIy9ru
	 LUfZWdA8OhXww+DygWFyFJrVAVRtMI2pPeMrRPkPK39S01ENS6OhHykRTUzet4iIbhk6W
	 T+bgLVfCGs9qtKIa+YFaBbNYuz7hpp38qtsBp6iZDrIDEj1vDEsvQR8MUhLY7CEbgDZxN
	 HTj73LdJaetbK5wYdM1tGiR4npnxlHE1zPIpvFM2NTA3ZVoE7DnUCKrDh68c3LR5NzDXH
	 Hnj1OK11bKJUYVXT99piqHEOlfY8u+NSwUVo0a+qWyDwf0V8tbr6wD0lLiD2521cmHQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SNrcmbeS;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21ED5606A88C;
	Fri, 13 Nov 2026 23:25:24 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1D771F000C4;
	Fri, 13 Nov 2026 23:25:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794612324;
	bh=+ZI3gexBXpVYPbFMrALtqufJPetOQv+G/61FGO1yoek=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=SNrcmbeSPbiBQQGlnAhoi4gcr1VPkhuaO8OU0bwsBCc9kslSU7A2to+s+YfMUxSUl
	 I+cyOxIeqis9su0hFfaYll20UkyYLHOCdAMGgnHE6gAtc8XheMoqcSUAgRTsNtPmaQ
	 RLpgqE0h47XOZCVw3TlQKdI3pMUg0f61GJOP3gfSVAXbkWF7rFk6jkS8jfufaCkgyX
	 D6c14QdmZyyC1Z+2kGHLrSM73A0j1cNImU9zqyFFpPXHdaufgpIZ6c2lvZtbs5/5oh
	 q498Y2Po4G74wnwU1IBd8vAkRMGJxCI7kFgA4pzaySbpMnMT9BD6XtzoiYKROh6KbN
	 7Q/YLuFVmeNCw==
X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
 ncardwell@google.com, kuniyu@google.com, john.fastabend@gmail.com,
 sd@queasysnail.net, sagi@grimberg.me, hare@suse.de, linux-doc@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261112232444.2865382-1-rjethwani@purestorage.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list