From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv2-f41.google.com (mail-qv2-f41.google.com [74.125.230.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4182547D455 for ; Fri, 2 Oct 2026 09:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.230.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790932698; cv=none; b=XHgwBixKj8PcGnTHssEQg+PfN0l2OpEjg/TgKJlSBTzOGuqKOK9krcOEJ5+5HFyobqjYG2dKcrLHMHt84lUJXP+fxn9CVeqteVJunEiL+FyeQB/UsDC8RPBHmAB44Riii0X/S5O1MizdTaIEmOEWtKMnQpJDOw0orw92RPMRJoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790932698; c=relaxed/simple; bh=Qfsjd4gOBk2R1cAVmxNn9b1xSjQOZ/MyAh0pURKAmQo=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=rvgN9UzKrpSSL/bkLMp7aat3RIfnjj3Txw0YPsIi+m3WgxNkSczethDLr/jlza6H4mx4M+i3QSysVk4yHqVUMilDwm+93q1RNArLvUxAXDiVh8GaJO6m+kWarO7WGHSniv7ww+avfF4C9ZVBH1cmpCxemgjCDrV7CpxFEoQu4Gc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C2HSWPlO; arc=none smtp.client-ip=74.125.230.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C2HSWPlO" Received: by mail-qv2-f41.google.com with SMTP id 6a1803df08f44-9178b9b7ecfso40719316d6.3 for ; Fri, 02 Oct 2026 02:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790932695; x=1791537495; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Qi9AutxC+YxaVYc+sgXQhd2bNMCFaltRc/nQQBHbNXo=; b=C2HSWPlOBODAEnXbDpuwl56cL4P+YrbZGRADpH5kpPpdv41r96qFVxMojhe+alWWwz 0h2yB1VQvIK2defDyTkcbtFsX57pasAF21csbbMSgK7CKg5JTSGjOahXBMwudFw4Tj0Q k9vLHNkpW8dxJHs9fQL/iYpRAZ281pepRmfGLWRGHB9iXlcHVWunhSa94RgxXGa9AhE+ yxDewJGzhEzrOtBDcOBeIwNnLft0/Cg6SERXowQ9Wt7+UYeFys9URt0oRonjWthWeOKw 5Gf92ZM+V/SpiOVUzTRd33dmOu4H36gtz1mhxFG4M4iueKfx4v/4wpG894/NW6xnDGHA Sslw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790932695; x=1791537495; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Qi9AutxC+YxaVYc+sgXQhd2bNMCFaltRc/nQQBHbNXo=; b=ozwA0CYIWZHNIgdHDmHfbrb2LblFdMFEen33XVfvMvTayETsJWu0zYheplt8DimUJv X3Su+g676YqOW08t1C/xr0U1+l3NAdZLIKBf2ikr9rKGdlNU++fpGE74T3wpepOe8FK/ Zd1w16k+XXsed/ynQLIlkdXbjEd3FnjcIsxDnT7j8q2pw07llpLr3fEyXuWXRNsZPWFL Q+IwVBZepg8H5SgU5HdPatt1odrTu+RgacadpmEJFGUVo8OeF80NU8sQn/hITPxTSXdx KXFdjgYIj6YlMoBastpLrOh2fKutgZjbJERAJOQ3yYtxLBSossTifep2enGk3DvPYAcy UVjA== X-Forwarded-Encrypted: i=1; AKwUvBzttSjqu9hQLCssEGzskhxVYXYey39cJVKAzZE8GL6lxjuRzLwSdkfWsF+fNGPhRF1JQHscUok0tFlr5iE=@vger.kernel.org X-Gm-Message-State: AFuF++lpZ+p70XstB6zzfUDIGO3HNcCYslOsxj+WQvxjKVEfblmXX2LS w6brNP79uwL9ik3IspPCupemwgWiUjiZdBorwigmel7i9cQk6z8USiyF X-Gm-Gg: AYBFou1iYKE9EMxuGVOAdZazxsg3nsyAUp44R0n0gsEju7zfdtKpW6ksh00bFB6bqal iXrRrC2mOR9+EjNRclRS34oJ8TmWOq2GQBHqFWAAWeZA42aI27gJgKtiWXFOLYJw2ysJjzgKkOF qMfmVpR/yaiN18agSyY8/wwmLU1FfYJZo/Ieq37ENUBYIW1ZrvX9HotDSSRGD5xDv4VQg8pWnf9 +b9J8dK8TFMpxb7xBiatGZMrxf+1QyrLeqi/hi8lN6PFH0pDYmsbwTs8oMQEROsfToqfXQtrvUr PP93Zb9+LLwvp9Rp1RCyJa9mFFKponwXxPWOXs9sS9fVouPE8D913C5V2seSIaLzBw4DuMwLahd Nv0p6SoyRaBkxurbslimwKLO4Mr9fyXiHbkNdJd+r0IoTVwJwh5bnmeFXBzYeQr5KxeSlemh0Pm /psYinEOdVR4zW87CShrTsVEYyRl9NZuDF41PcO6ufvchFWFENF4AMoDbDrT6y+nv/rW2OBQERY aU= X-Received: by 2002:a05:620a:1b9a:b0:93c:b47b:26f with SMTP id af79cd13be357-93cf178a668mr324269985a.49.1790932694960; Fri, 02 Oct 2026 02:18:14 -0700 (PDT) Received: from localhost ([2600:4040:9399:4000:e553:72e5:7d37:c7ef]) by smtp.gmail.com with ESMTPSA id af79cd13be357-93cca26dae0sm170607785a.33.2026.10.02.02.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Oct 2026 02:18:14 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 02 Oct 2026 05:18:13 -0400 Message-Id: Cc: , , , Subject: Re: [PATCH net-next v2 2/4] net: psp: require an established connection for association setup From: "Daniel Zahka" To: "Willem de Bruijn" , "Daniel Zahka" , "Andrew Lunn" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Shuah Khan" , "Simon Horman" , "Jonathan Corbet" , "Shuah Khan" , "Randy Dunlap" , "Kuniyuki Iwashima" , "Willem de Bruijn" X-Mailer: aerc 0.21.0-threadmapfix References: <20260930-psp-defeat-v2-0-f266e7447129@gmail.com> <20260930-psp-defeat-v2-2-f266e7447129@gmail.com> In-Reply-To: On Thu Oct 1, 2026 at 8:19 PM EDT, Willem de Bruijn wrote: > Daniel Zahka wrote: >> Check sk_state under the socket lock in both the rx-assoc and tx-assoc >> handlers, and only allow association setup on sockets in >> TCP_ESTABLISHED. Also, fail connect() when PSP assoc state is already >> present, and remove the dead PSP MSS adjustment from >> tcp_v[46]_connect(). >>=20 >> The net effect of this commit is: >> 1. PSP assoc state can never exist on a listen socket. >> 2. The upgrade to PSP must be done while the socket is in >> TCP_ESTABLISHED. >>=20 >> This change defeatures behavior that was previously allowed under the >> PSP uapi. My justification is: >>=20 >> Nothing useful can be done after association setup on closed or listen >> sockets today. Listen sockets could accept a PSP-encrypted TCP SYN, but >> the child socket will not inherit any PSP state. On the other side, >> establishing PSP state prior to connect() will result in a PSP-encrypted >> TCP SYN sent to a listening peer, which in turn has the aforementioned >> limitations. That implies that there cannot be any users of this >> feature, so it should be safe to remove it from the PSP uapi. >>=20 >> In theory, the check in the tx-assoc path is more restrictive than >> necessary. FIN_WAIT1/2, CLOSING, LAST_ACK and CLOSE_WAIT could be >> allowed, and the peer would accept PSP-encrypted ACKs in the >> post-FIN-sent states, or data in the half-close case, but it is simpler >> to disallow those states because they don't fit the upgrade model. > > And preferable to do so. While it could be allowed, there is no real > use case for it. Simpler state model allows simpler code. > >> The check in the tx-assoc path fixes a bug in commit 6b46ca260e22 ("net: >> psp: add socket security association code") where an unsynchronized >> write can be performed on an assoc shared with a timewait socket when >> the socket is in TCP_CLOSE after shutdown. This commit is not targeted >> at net because its premise of preventing listen sockets from holding >> assoc state depends on net-next commit 8cc3aef0cb19 ("tcp: Do not allow >> buggy transitions between ehash and lhash2.") >>=20 >> Signed-off-by: Daniel Zahka > > Reviewed-by: Willem de Bruijn > > Even if targeting to net-next, you could consider keeping the Fixes tag. > Importantly the prerequisite patch is mentioned. But is only one of two > mentioned here? Yes, sorry. I replied with the full Fixes info to the bot here: https://lore.kernel.org/netdev/DLTLF0VWT5UY.2WUPQRDZJQO3W@gmail.com/