🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19041

Re: [PATCH v2 ipsec-next] xfrm: check state validity under lock in xfrm_state_find()

#19041
From: Steffen Klassert
Date: Thu, 19 Nov 2026 08:23
21 lines
10229 bytes
On Fri, Oct 30, 2026 at 02:52:29PM +0000, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
> 
> The output-cache insertion path in xfrm_state_find() checks
> x->km.state == XFRM_STATE_VALID before acquiring xfrm_state_lock,
> then inserts the state into pol->state_cache_list under the lock.
> 
> While this insertion block is currently unreachable -- cached is set
> unconditionally at the cached: label, making the !cached guard
> always false -- the correct pattern is to perform the validity
> check under the lock, matching the fix in commit ddd3d01329203
> ("xfrm: Fix xfrm state cache insertion race") which addressed the
> same TOCTOU for the input cache path.
> 
> Move the XFRM_STATE_VALID check inside the critical section so the
> pattern is correct when the cache insertion becomes reachable.
> 
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>

Applied, thanks a lot!
Technical Details
Message-ID: <av6x7V11EyNhg00f@gauss4>
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-366846-linux-kernel-netdev=dewy.ru
References: <20261030145229.74412-1-tristmd@gmail.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-366846-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 ipsec-next] xfrm: check state validity under lock in
 xfrm_state_find()
Date: Thu, 19 Nov 2026 09:23:09 +0100
Organization: Usenet Network
Message-ID: <av6x7V11EyNhg00f@gauss4>
References: <20261030145229.74412-1-tristmd@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Injection-Info: usenet.network;
	logging-data="2827367"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:do37bEgJzsNLIV+5RjfDlxeAOsU= sha256:mOaLxK5t3qH8ij/QE7rbe0jeaj2BedJYoIRoJGSbL64=
	sha1:UHYToVL+fVgBOq9IX6Kacubv3qE= sha256:QVaprdEgXtZfLjxtNV5XlysnmMdZCu27Kr0AxwPGA+M=
Content-Disposition: inline
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 0F04C115560; Thu, 19 Nov 2026 11:23:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=secunet.com
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 dTXTiYl0FO4O;
	Thu, 19 Nov 2026 11:23:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366846-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 3FEF9115555; Thu, 19 Nov 2026 11:23:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 64E7361968C; Thu, 19 Nov 2026 08:23:16 +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=1795076594;
	b=vKVXBzmhDBYnv3n0Ib61C5xq+noeEae34h4Qav2yZrJSWA+CpjL8S+fXMJRkTaGaVeV3
	 4sMahhnD4SBykM/nQI74q5p8ubMmbMC8GTWxEvWvljvFbDHkonoZe7vi/OhdGe3W9j5RX
	 eSkFMPFrg0L0xJrwBhyLBUhJWvqNIiI4AjsD6kL8JPP+HlsCLTWXyZy7SK/ihpFIH2NUb
	 +MgeYnaeDKD8be/wIpE5sNSorca2Bf+8AGC8A5eOTwk3YBeExJSKZaNqehF0CtOR68Lvo
	 F6QUJbOncGDDxtTvWxJHiJiYdYnHTqbfghijvAST5dCN9FZSsV8qcMdNhBNZE2vCGeA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795076594;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned:
	 Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:Date:
	 From:To:CC:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:
	 X-ClientProxiedBy;
	bh=1Llotjc+vxRwsDCh0tNCx8AKlI0T8ZOBMb8uDykkROU=;
	b=H9IDIrRGMGSLw8TfQTwLzjt35xq3CMNP1pI/CHdU1Vr3WMWA1NhNGiWIyjSz86bnoFhV
	 LZlZZaPTe15a+yUg01UHAdld10QvASVvDvd1BKlz3maFPzWB78DualMAGCT3zopsp4R+G
	 5D0vrKRuCrKviWdUdF8staFwHaNAUYJgx/CJK4xHIfmy4dP6362+JYa5F5/fJHfLrmZqG
	 NjacuP65F72g19FJyjhFFqBFZO5TbHbBQOtWRu6NZuP3tJh760GnNKl+YC+7PdIUQ9F+W
	 c4H1ZLys/JYvmbzPPB8ZKD3uECcU3xssKLngIZCoEjsHPkNj3BmtrtsGrdxC+I22qew==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=G8RmQO9Y;
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	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 012E9606A331;
	Thu, 19 Nov 2026 08:23:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=G8RmQO9Y
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795076593;
	b=wtR3vIjB9noYn+YbsvYUy6gla7ID0iiuhT1o6LBbJ+TS5h/EzwSPPmS77TyRvraBnVs7
	 VRCw365RPRSP/CXr2M3UlGFjWpmw47qXCRMZ1Sgc0q+ctzvX+AbW03PRVW7XBhD0hrqcd
	 II7BxKoWckRqCHv+mbpAw0K1GgPaa/yXrl753nBSCYizG2KcCZD4QxLMQDsNfugxR6Xip
	 NKNVbm4zICw1chpkrCcKFSQox1Vj/SmnNWAg1+uDqMkQIstdYFWzOVRVbn+JTX4l/QMFD
	 QYBosrZC6hYffbxiHTrC1OhJ0BDCklRFAFLh3042o8OHiLhMiKPXh9jfHbYVNgH1osw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795076593;
	h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter:
	 DKIM-Signature:Received:Received:Date:From:To:CC:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:
	 X-ClientProxiedBy;
	bh=1Llotjc+vxRwsDCh0tNCx8AKlI0T8ZOBMb8uDykkROU=;
	b=33lMXSXdCnWBqxvqbrJBxRo0SBanYGAmcaDfFM14WLrTnsLOx2tGL+YJDDnXLw/HV2rk
	 x7lqHFfmC5Lgp3pWRRDpHEFF2DB6pdPC02mjaPVRSTS3TRVTerCdt3eGVbPLlYQM+1o3s
	 uwzP5tPV4Rn7qY9wlHU9E0w7NUqGYkOf32zK94u5xw7oaMqGP+hNA8GGeuq5r6jCmCcek
	 NXKz7tFDxA/+UFcUdo1T8+iIFEmwwo3WnqHZfkPxiKhy8qDOBagAZydjJ2AAe2yG2rDAu
	 iXzuARWuj/GFd0qOFrUF9Bx7LWm8Qhy5ZOlonqTZWJ8IHkGejz71/eGMHk+S7tk5fTA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=G8RmQO9Y;
	arc=none smtp.remote-ip=62.96.220.36
X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A843C606A325;
	Thu, 19 Nov 2026 08:23:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A843C606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com
X-Received: from localhost (localhost [127.0.0.1])
	by mx1.secunet.com (Postfix) with ESMTP id 3C854207A4;
	Thu, 19 Nov 2026 09:23:11 +0100 (CET)
X-Virus-Scanned: by secunet
X-Received: from mx1.secunet.com ([127.0.0.1])
 by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 8nlwCSEHTk_N; Thu, 19 Nov 2026 09:23:10 +0100 (CET)
X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mx1.secunet.com (Postfix) with ESMTPS id 8F97F20606;
	Thu, 19 Nov 2026 09:23:10 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 8F97F20606
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1795076590;
	bh=1Llotjc+vxRwsDCh0tNCx8AKlI0T8ZOBMb8uDykkROU=;
	h=Date:From:To:CC:Subject:References:In-Reply-To:From;
	b=G8RmQO9YXNMSc4wfYwNGQx3mmvAsTb5g8w+WI3CYSoSeiLt6UYJ0MEpVH7A7S1BBZ
	 6TKqtqr8PvhUhdxrUJxb40+9YwjAtT1ajSzY+bvk2r1w03XbNNL4OY6p2OyVKdskyz
	 VJQVXLZ7+Tuh9BNiN0UsZ/+/tl6KFDASTEAxQVJEl6nUY/Aa2xRgBixJYIbVrAVwlJ
	 Cdx4qVEybvCnwScrbKrfUH4ng1FA0FFAXoK9A9embeiv3KrpYU96gdnVK4Xkgw1Fst
	 HSg9032SZLRUbcISxhib9eK/Mf1e3c9d2SdyN0rT5Lkm9YfjnepFK8R3mU3kzhX1d2
	 n4uKNuNGSJCAg==
X-Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Thu, 19 Nov
 2026 09:23:09 +0100
X-Received: (nullmailer pid 297213 invoked by uid 1000);
	Thu, 19 Nov 2026 08:23:09 -0000
X-CC: Herbert Xu <herbert@gondor.apana.org.au>, "David S . Miller"
	<davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski
	<kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman
	<horms@kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Tristan Madani <tristan@talencesecurity.com>
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
X-In-Reply-To: <20261030145229.74412-1-tristmd@gmail.com>
X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de
 (10.32.0.171)