๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23201

Re: [PATCH ipsec] xfrm: advance the route generation when policies are removed

#23201
From: Ralf Lici
Date: Thu, 26 Nov 2026 18:06
59 lines
11766 bytes
On Thu, 26 Nov 2026 15:54:36 +0100, Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Le 26/11/2026 ร  12:32, Ralf Lici a รฉcritย :> On Thu, 26 Nov 2026 11:18:44 +0000,
> netdev-bot+sinfo@kernel.org wrote:
> >> Hi!
> >>
> >> This is an automated message. This series looks like a fix, but its
> >> commit messages seem to be missing some information:
> >>
> >>  - Whether the issue was actually triggered, or is only theoretical
> >>    (e.g. found by LLM and not proven at runtime). If it was triggered
> >>    please include the symptoms, like the stack trace or kernel messages.
> >>
> > 
> > Yes, the policy removal cases were triggered at runtime, in a VM test
> > setup (not observed in production AFAIK).
> > 
> > There is no kernel message, the symptom is plaintext on the wire. A
> > connected UDP socket keeps sending unencrypted datagrams after the allow
> > policy that exempted its flow is removed, although the ESP policy below
> > it now matches.
> > 
> > This is roughly the setup, in a netns with a veth pair (IPv4 is the
> > same):
> > 
> >   ip xfrm state add src fd00::1 dst fd01::2 proto esp spi 0x1001 \
> >   	reqid 1 mode transport aead 'rfc4106(gcm(aes))' <key> 128
> >   ip xfrm policy add src fd00::1 dst fd01::2 dir out priority 100 \
> > 	tmpl src fd00::1 dst fd01::2 proto esp reqid 1 mode transport
> >   ip xfrm policy add src fd00::1 dst fd01::2 proto udp dport 5002 \
> > 	dir out priority 10 action allow
> > 
> > A UDP socket connected to [fd01::2]:5002 sends one datagram, the allow
> > policy is removed, then the socket sends 10 more, captured on the veth:
> > 
> >   removal               net-next             ipsec + this patch
> >   delete by selector    10 plain, 0 ESP      0 plain, 10 ESP
> >   delete by index       10 plain, 0 ESP      0 plain, 10 ESP
> >   hard time expiry      10 plain, 0 ESP      0 plain, 10 ESP
> >   flush                 10 plain             nothing sent
> > 
> > The flush case replaces the ESP policy with "ip xfrm policy setdefault
> > out block", so that nothing may be sent once the policies are flushed.
> > 
> > The xfrm_policy_insert ordering is a race between the insert and a
> > concurrent lookup, found by code reading. That I did not reproduce at
> > runtime.
> > 
> > I can share the reproducer script if useful.
> Maybe adding a selftest would be useful.
>

Sure, I'll turn my reproducer into a selftest and add it in v2.

Cheers!

-- 
Ralf Lici
Mandelbit Srl
Technical Details
Message-ID: <20261126180608.1459401-1-ralf@mandelbit.com>
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-372267-linux-kernel-netdev=dewy.ru
References: <20261126111516.317545-1-ralf@mandelbit.com> <179569192472.3294.16207945676550617931@kernel.org> <20261126113216.337964-1-ralf@mandelbit.com> <f707be46-5332-4196-a9e0-5e6fb5ae8353@6wind.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-372267-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH ipsec] xfrm: advance the route generation when policies are removed
Date: Thu, 26 Nov 2026 19:06:05 +0100
Organization: Usenet Network
Message-ID: <20261126180608.1459401-1-ralf@mandelbit.com>
References: <20261126111516.317545-1-ralf@mandelbit.com> <179569192472.3294.16207945676550617931@kernel.org> <20261126113216.337964-1-ralf@mandelbit.com> <f707be46-5332-4196-a9e0-5e6fb5ae8353@6wind.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="528134"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NIg/tZT3FS49C6NFn13UrQ7Lr9s= sha256:9g+krrcs6LPNnPTIEij2A9+9WiSHsD7bxtvbas0kk+Y=
	sha1:3v7IyzlH5ChdKGGxmseFcBJqfd8= sha256:CPqqHgAs5sdxdqULVPK0P0l1OXWWy/VQkgPSptnOU5k=
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 D7AD8125EF2; Thu, 26 Nov 2026 21:06:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=mandelbit.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 uTGeCdQqj7kr;
	Thu, 26 Nov 2026 21:06:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-372267-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 9AFD7125EF1; Thu, 26 Nov 2026 21:06:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 2523324AC3; Thu, 26 Nov 2026 18:06:26 +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=1795716385;
	b=5foezvLV2Y3+aqUwFCLNfwgqeEJG/TTbgRUPDvrVFD/m8U/J75yXevvbBWMkoz+SJhZD
	 mimeajxLkJGPZV37+rjWY7wTnPajld1mlP3q5wL0c7TXK/xJ/PuDC5TCRPg8pcJRFd9XA
	 R/2E2kugJFGpC7A4wCIb9755Ir3QtpFZC6S1yAudcSjveNw5ptlmc/TtJ/RVbpmDSL2zd
	 JVwxyOo4t3Q8mYiu/F++RZWnCCVKNy7BCE1OhMNkzAioIpT4I8dQQlCQi57bqilpxVw+A
	 oMqkzHMPBsBhqGFNVJiZpcrFiqXjceZVDcDaNU42wvF2pOAzZ4yA6uaJoF+VPFii6Ag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795716385;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=ZFYiheXa78vwZkfk3QiwkXHEnKws8Sfv2V6CLNUXJgM=;
	b=OKDqDBtVuudxyaOKWPrOlWInJO5y+PhOKRRenB+KmjlgViUV+96uCcuujBCJVSSn0aTJ
	 Wc0eJr2C4zy8rOZJOBN2NNYg/GW5CTHkeEzRcZ2gdg0XniiL1Em2mNXk/mMkSggDByE5E
	 H6rjHxLuN+U/FJztPfdlOsorkRdfcHNr/LxxQDx2nIRhtV0B80oaW7xJ29fQCM7fZnbSo
	 MxZbgRcpZCeoj/JalNsCAJPkc1OvOpfEDIH3pmJwzgYeLlva93mrx3KMGWEu942wcH6qV
	 EAlj4FsgZKGpVSWFVU396Way3UkdX6HG3Un00H75Oj6Bz4xPa6YTumAiANlqt7gqxcg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=KQsLwA2y;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.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 4F9B9606A32A;
	Thu, 26 Nov 2026 18:06:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=KQsLwA2y
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.51
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795716384;
	b=vrNcvWjF+yqx67dmZ90tzvyuCXVcNR4SJzzxHPKhtUe10S/CR7WQ5Ijthg4wkTAOUgig
	 EsIrUmYn9OAJlAFFJoSASObP/0cEttNyRmQVb6BcD9LD/GtSwRgjHzSuGdVgmD7+MkA3o
	 QRKxsbKTRUcpTiOeCZqXHIaefJyE79oammJZTNTsIcSObrDaKuzDcxpWgzEXo5kLoFo0T
	 ZIuu8P+F4FSR+xIRGMdfdesUg0mtVD4oz0VzfjBw0rYdk79FdDgSZgR6y8m28qFEYnXmN
	 KuVPgxqCqV9zQFyixqIQzPjAGVsGDjDD35BrxE33OBEldqR1iS89fA5W7hpxM1r9m/Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795716384;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=ZFYiheXa78vwZkfk3QiwkXHEnKws8Sfv2V6CLNUXJgM=;
	b=3EZiEiFEP53N5RYZw1qRS4Pr5mW5joirdRwywRc9P9PUaceLbQ6c+/+AKqZSVeIg7Dxc
	 JxjKi11elnqiTNxwHoI6qtR9Zrxqj8YFPSLDAP1qMslid5chfWUWG1Oi/7eXQq/TfoL0X
	 VVUYbUPX2/vJigD1YORhc5Kz0AaQB3/CaC1aRLrvPxhJX+1hVuL+Iy+BIrnghpJZm1sT4
	 lMbKx92NozJzekfeDECbPPFc2C+am5+UiC22XkJx37zUWTYc9oapdF5uEfqS1+yegeYXE
	 yLfbx5drjlg3VPN4mGPO0Tvhxr5Kgghf5eIWvsTNlZD/Ad7v24tjpa/FZmZFOqkSw0A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=KQsLwA2y;
	arc=none smtp.remote-ip=195.10.208.51
X-Received: from mout-b-206.mailbox.org (mout-b-206.mailbox.org [195.10.208.51])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35C95606A31E;
	Thu, 26 Nov 2026 18:06:22 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 35C95606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-206.mailbox.org (Postfix) with ESMTPS id 4jb4HG1cMCzk3;
	Thu, 26 Nov 2026 19:06:18 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795716378;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=ZFYiheXa78vwZkfk3QiwkXHEnKws8Sfv2V6CLNUXJgM=;
	b=KQsLwA2yqIXpa+5Untqa12L/CG9nzfaW/eHsyUg4EjUmFYdGQsRwEiuKe9qMccj1d/eEdX
	DTvT927J1OjN2XDHl9uYilYItII3GmSsyPeCkroIn/S8jnOKdNcRJQ/gmFuOmcjEcZ33uv
	YrX+7N4+26VFzyOqjzkJ9dMykFrc90hf3lJL+P+uzPZblfb8AkqmBKlHUdDLkgfsBc8b2W
	f19w9Le7SrwC108U6NcdS2xG2h8oaEj5rfk9qk3rOLA+Isj0hSYiJrqshk+j+8Z9sTKGyQ
	0jKSxTXlh17BKgBMg/L5UbCjSZbGYUVg5jqxZ8IP/yOcKYXPBb3oM9K1rVYxLg==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: netdev-bot+sinfo@kernel.org,
	Steffen Klassert <steffen.klassert@secunet.com>,
	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>,
	Willem de Bruijn <willemb@google.com>,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <f707be46-5332-4196-a9e0-5e6fb5ae8353@6wind.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-Rspamd-Queue-Id: 4jb4HG1cMCzk3