🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24995

Re: [PATCH ipsec 0/4] xfrm: Fix device state teardown races

#24995
From: Steffen Klassert
Date: Tue, 01 Dec 2026 06:34
40 lines
10990 bytes
On Wed, Nov 25, 2026 at 03:34:08AM +0200, Jianbo Liu wrote:
> Three fixes for the teardown of xfrm device offload state and one
> revert, for ipsec.
> 
> xfrm_dev_state_free() runs for the same state from the state GC, from
> the device flush and from xfrm_state_find(). Commit 89fefad9f971
> ("xfrm: serialize state GC with device state flush") serializes the
> first two with a mutex, but xfrm_state_find() runs under RCU and
> still races with the flush.
> 
> Let only one caller free the device state of an SA, hold a state
> reference in the flush and wait for an RCU grace period before the
> free. The mutex is not needed after that, so revert that commit.
> 
> 1. xfrm: Give GC list nodes their own storage
>    Stop sharing the GC list nodes with the bydst and bysrc hash nodes.
>    Patch 2 uses gclist on states that RCU readers may still walk.
> 
> 2. xfrm: Serialize device state teardown
>    Let only one caller free the device state of an SA.
> 
> 3. xfrm: Wait for an RCU grace period before freeing device state
>    Let RCU readers of the driver state finish before the free.
> 
> 4. Revert "xfrm: serialize state GC with device state flush"
>    Remove the mutex that the fixes above make redundant.
> 
> Jianbo Liu (4):
>   xfrm: Give GC list nodes their own storage
>   xfrm: Serialize device state teardown
>   xfrm: Wait for an RCU grace period before freeing device state
>   Revert "xfrm: serialize state GC with device state flush"
> 
>  include/net/xfrm.h     | 10 +++----
>  net/xfrm/xfrm_device.c |  4 +--
>  net/xfrm/xfrm_state.c  | 61 ++++++++++++++++++++++++++----------------
>  3 files changed, 44 insertions(+), 31 deletions(-)

Series applied, thanks a lot Jianbo!
Technical Details
Message-ID: <aw5qWhJOBLIZvq1F@gauss4>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374732-linux-kernel-netdev=dewy.ru
References: <20261125013412.1123866-1-jianbol@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374732-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH ipsec 0/4] xfrm: Fix device state teardown races
Date: Tue, 1 Dec 2026 07:34:02 +0100
Organization: Usenet Network
Message-ID: <aw5qWhJOBLIZvq1F@gauss4>
References: <20261125013412.1123866-1-jianbol@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Injection-Info: usenet.network;
	logging-data="1636122"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wi3MRDdSqkVM18cgedXU3QJw5LM= sha256:j5JPkDizBLvlySHkUmB7LK/SCKceG7EDpXMSX3zmgf4=
	sha1:2diz7rNiCXml6sxRnHwWkL2imUY= sha256:7MvHZB0JNdVBhpmJClhVfRoT6sn2UH2RIFda5qOyNEo=
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 392D411725D; Tue,  1 Dec 2026 09:34:40 +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 JnWuI75Gjg13;
	Tue,  1 Dec 2026 09:34:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374732-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 08A8B116DAC; Tue,  1 Dec 2026 09:34:28 +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 31BAA6010B4; Tue,  1 Dec 2026 06:34:27 +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=1796106864;
	b=qVYuplITJvj1TiwgVF6wIWXCbvjo6V0uqj6cP7Vkd7dXfV5TJYytURscdhc4hAe+bek2
	 XuZ1X4XP5pKkWMo2u6CK7S0CzOHDNgEJuiJhhlDK5polrD447ivDNwzwyl0Vc0R6AALkD
	 AcHdw//h5r9e7RwOTPCZBxiB817w0LrpM+sQb1T9d+TUYnIAWnFggp+aZ3iMRMCgMj9rj
	 dnRc2xOFuzsNIZiVUCxu8ml5OVuBHLiZD1mSThhOLJUL1IZ/K0WFmA1rv4aqJ3FJa0I0j
	 y0p2iYWadCnwgoc+t82/po5JHN3h6k28dFD1n9iPYWE1P46MIAxJLT/Cu1zIKw2Me+w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796106864;
	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=pyomz7cvIis/0SRS9dz/f13GNBmgxNCQ7sqOUFUNT0Q=;
	b=lBOw+GCFs+VzPu4709y8ItFbVvTCQVEm9k3GJ2VDuACCXitWHoCBiboJrL010FcqBo66
	 AUqG32wOr6SLLEwusbNPA9nkVON3qRnHxZMFBVTkd12bMX7n+5XUVX3IGXzjmkI9l1UiX
	 ezdiqitRxQtgOK+pyD5pL7IVJ2hWOt0pnWi3GxAedoY3lswvDBpT9jUtqohgi0zgSxEoe
	 E+feQu/fGy7mECJpNYKs2vhqaq/4HMmXufdDBmxayziwdUW26OoOwu6jPfyojk9Y5lj7V
	 2fydhT96fLlS8zzUgSW3w0qthhmOqlwY87ryalha2+378PUS1Sq+bhOqBqBXbbKB+iw==
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=H10IGVgl;
	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 CD151606A325;
	Tue,  1 Dec 2026 06:34:24 +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=H10IGVgl
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=1796106854;
	b=uKrCK5ht9Tb99osHZaHRO4YIDNbX1G9Hcl3E19AU49k2Aa5UB4ftPefIxvd6ADvMv+jK
	 PlnjCZvgS0p3qWLMMxOwB1w0rxoVIxy343JbTzq8bvKq47lL2x769sVj9AR2QM6StvqWy
	 szP7lcoHFVEgapY6zjdOIdbhbGuaKH9JBe91VI9m3GyVgIBJK6ZlY8UwpPqs5rWc+77CP
	 lQ9FG44OzJ04yw2mXs9rEXBLf9SXIukM6T5NB/AOfSrq7+S9GMDEqyIpwAQ2ENVWlAUK3
	 heBtQM+mPpMjHvvijbIpRTuqtWqgLQUIazNgN8FuBvl7xF0LkmU80erPhIdLjZHI1Bg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796106854;
	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=pyomz7cvIis/0SRS9dz/f13GNBmgxNCQ7sqOUFUNT0Q=;
	b=RmUsQULQ8Uc+juHqJ+YRU3F1uBLjl4i7/aeT42hDoHLbGqGRuyTyAd0tTDNgZxibwC/c
	 4RRN4R8ecDj/80Tk1mMYozrIeZNBvY9SadZ+wS0NqtT0WcBWNx9Lor/gxNoYykzPF2h+b
	 BhAvzQHnngurzYuxRSYgHtxV8FFhd/59Q5DR5dLlqWYA0ZcAvK2Entdud2/5OPARiG9Zz
	 Cz6YugABRj75WCZTXfueYL9UNFOkJ6kzKcS5qQWGNNbpcM2WMJh9WsSWBnToqsAISqlgz
	 Ohv5Ol0KfivJgic9aiZSDTvPZ4BdhiKApokoFGKrh8qfAt2v2+OhjEDvoY6ly+gYp3w==
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=H10IGVgl;
	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 A1350606A32A;
	Tue,  1 Dec 2026 06:34:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A1350606A32A
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 6F492207FC;
	Tue,  1 Dec 2026 07:34:04 +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 qqKPWc0TAs9X; Tue,  1 Dec 2026 07:34:03 +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 79F7920853;
	Tue,  1 Dec 2026 07:34:03 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 79F7920853
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1796106843;
	bh=pyomz7cvIis/0SRS9dz/f13GNBmgxNCQ7sqOUFUNT0Q=;
	h=Date:From:To:CC:Subject:References:In-Reply-To:From;
	b=H10IGVglwfsUJHONAb0qES4TZbB34TN1zDhTbwXWJHQh7RKskKavzIBdociAosUyj
	 vP+PnM43BIuEOW3RUXTdev+6mGoqwYg7TT3tsMxAiHeUK9MwYhJavcQJ+U/RrfU9Ak
	 jh5sDXpiOjDhx13C0PCGMSAD11Z7TXqj7BOFlGKOhIr4729lMi9lcp3HSOOyrsodHR
	 cencM/WmjAhR6iX7cJONiE+UnCBzpLbnmYzALZew2Wyyi3hd5nN8x5y3FlPcAkKpoi
	 bu9EKzSJJRFVxbtCjIUIsE3wvgd4xEpbWZ5jgLQVhAAukkugQXzhLzPSECHagmWfra
	 LDHj8czc2drcQ==
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; Tue, 1 Dec
 2026 07:34:03 +0100
X-Received: (nullmailer pid 778590 invoked by uid 1000);
	Tue, 01 Dec 2026 06:34:02 -0000
X-CC: <netdev@vger.kernel.org>, <ipsec@lists.linux.dev>, 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>, Florian Westphal
	<fw@strlen.de>, <linux-kernel@vger.kernel.org>
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: <20261125013412.1123866-1-jianbol@nvidia.com>
X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de
 (10.32.0.171)