🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13318

Re: [PATCH net v5] seg6: validate state in netfilter continuations

#13318
From: Andrea Mayer
Date: Mon, 09 Nov 2026 16:46
47 lines
11848 bytes
On Fri,  6 Nov 2026 11:30:19 +0800
Ren Wei <weir@nebusec.ai> wrote:

> From: Zixuan Chai <petalzu987@gmail.com>
>
> When nf_hooks_lwtunnel is enabled, End.DX4 sends decapsulated packets
> through NF_INET_PRE_ROUTING. If DNAT changes the inner destination,
> nf_nat_ipv4_pre_routing() drops skb_dst(), and the continuation then
> dereferences the missing dst's lwtstate. This causes a KASAN NULL
> pointer dereference and fatal exception panic.
>
> End.DX6 has the same issue with IPv6 DNAT. In seg6_iptunnel,
> POST_ROUTING SNAT with an outbound XFRM policy can replace the dst before
> the continuation resumes.
>
> Validate the current dst and expected lwtstate type in each NF_HOOK()
> continuation before calling the existing handler. Drop packets with
> missing or incompatible state while preserving direct no-hook paths.
> The helpers return bool because callers only need a validity check.
>
> Testing shows that the End.DX4 DNAT reproducer triggers a KASAN NULL
> pointer dereference without this change and no longer does so with the
> fix. The SNAT+ESP/XFRM reproducer also completes without the reported
> fault. The in-tree End.DX4 netfilter forwarding selftest passes all four
> bidirectional checks with nf_hooks_lwtunnel disabled and enabled.
>
> Fixes: 7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/patchset/20260720204430.1886091-1-xmei5@asu.edu
> Signed-off-by: Zixuan Chai <petalzu987@gmail.com>
> Signed-off-by: Ren Wei <weir@nebusec.ai>
> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

> [snip]

Hi,

thanks for the v5.

Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>

Thanks,
Andrea
Technical Details
Message-ID: <20261109174656.1c6267023862bf0a42b80465@uniroma2.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359460-linux-kernel-netdev=dewy.ru
References: <8574739acd6f5d9eb0a5640e893122619e9f79ef.1793726355.git.petalzu987@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359460-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5] seg6: validate state in netfilter continuations
Date: Mon, 9 Nov 2026 17:46:56 +0100
Organization: Usenet Network
Message-ID: <20261109174656.1c6267023862bf0a42b80465@uniroma2.it>
References: <8574739acd6f5d9eb0a5640e893122619e9f79ef.1793726355.git.petalzu987@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="404589"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SoYexT6hAOQEx6Q8KeTozt5cJX4= sha256:xGHoSbi1nNS4xOuzuaAzQtdMKDgbx06z2D9lP3m30GI=
	sha1:Wdgc7pYr+D1zthfpa2FFzpOkZu8= sha256:HUHTBRYbQNEje8zbv4GdsC97Xumt7Q4FiBSo+L8SbOw=
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 BF910113898; Mon,  9 Nov 2026 19:52:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -4.875
X-Spam-Status: No, score=-4.875 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,
	NICE_REPLY_A=-1.724, 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=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=uniroma2.it header.b=5F1LdMql; dkim=pass (2048-bit key)
	header.d=uniroma2.it header.b=eFqLqCOw
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 1pLsKmuGRY-3;
	Mon,  9 Nov 2026 19:52:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-359460-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=uniroma2.it
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 4972F113891; Mon,  9 Nov 2026 19:52:22 +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 8AC6F60B542; Mon,  9 Nov 2026 16:47:57 +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=1794242876;
	b=XUVPABFlnZcHs43KnesTykYRuy5GdweWo8Hn756IjRnHF05Op7zXQc5hIA/5MBXSo4Kr
	 dHXqBSaM9V6lImZSScuRsn/IHvZ64I7LeOaQURpg1HL73eV9Tj0zNgD72j1qvNNbn0mxR
	 iCDPWQramDqm2GOhKwrD2kM2DOmvpQmDPJCXMM6uTMC3e81b3Yen4fDk2TOy52Mm5peBG
	 MMKAHF9t3fHeYjIH51xMp8niQy8nEiNaQLADw6ai/5C7YQ31TVldqUOg42MsnGgrVkzru
	 8ruP7djMFgQfZo6m2WNdXMZfdfmXXo3A6kZ3iZ39U/gMZBBr52NmyILbG4yIEHEyfwQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794242876;
	h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
	 DKIM-Signature:Date:From:To:Cc:Subject:Message-Id:In-Reply-To:
	 References:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:Mime-Version:
	 Content-Type:Content-Transfer-Encoding:X-Virus-Scanned:
	 X-Virus-Status;
	bh=JyrVlOx5Pw/FngxAbjpQKaqtcPrR77mlf34YeVFjYvU=;
	b=IyW4une9hjhMkllgXSAzl4/Ek7qhIWAqq9CS7UCbXaJIjJIDbQgEC5VL48p1u7i3FxEc
	 YmQkqVwmwFv9WNg9ejr9jm7I1YViUm6ISN9no9dliXgd9nzzalsXDMFUAyij/5IUT8AbN
	 arYRVshPJlxZz22il5IKd0uWqUDq4ne2jyPvzpd8nDUsbg/iqt0TltYrofjZCiR+T7BiG
	 /xYmV2ufCmNNpEH6joae4WQ+/q1vgzerXRW1n+b1Xfcg00xC7bcqBxWNv03o3Nh9snd/C
	 UgdfWHAIR2Ib/HEw+M+qW/vSOki1V5E3emsUYCayZO8DWIzDW0UbCV4VL1ETwXIOLdA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=5F1LdMql;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=eFqLqCOw;
	dmarc=pass header.from=uniroma2.it;
	spf=pass smtp.mailfrom=uniroma2.it;
	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 D13F3606A332;
	Mon,  9 Nov 2026 16:47:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=5F1LdMql;
	dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=eFqLqCOw
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.33
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794242876;
	b=i1DRhzJKNal7Y9vtTs/KsHwLQ0Xluc74IKpjq0qYVacl0k5mYhj1FIAF+hG33/RHVdW0
	 9UlZZUm9uFiGCndGt9m/WqSefvgrEWfJ9bXEGwewaihjMUwYSKFX8xc5rdh1xp4HCiM6W
	 Ujw/jJYyGTDHJcfZEe6+ZnoKbDRWj2hjc9WKCqt67kzMt2BPFBKJP2+sFQBId7vMIxDVF
	 lzOlutXVH2pd0uMXFqtnA79tV/uXwY2qYCPe74Lw3Sx5kKIyJOZ0hJLVG1PUD0zJXj05e
	 KgRznV2xEO2OqQncs1kKJvFDJY7mdw6QDXB09njUUTc9sIKYEBWF2ZkFnpaamqgKcGw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794242876;
	h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:Date:
	 From:To:Cc:Subject:Message-Id:In-Reply-To:References:X-Mailer:
	 Mime-Version:Content-Type:Content-Transfer-Encoding:X-Virus-Scanned:
	 X-Virus-Status;
	bh=JyrVlOx5Pw/FngxAbjpQKaqtcPrR77mlf34YeVFjYvU=;
	b=e80X4cgQU2QIc7XqZLXK9EcgkNTkX/JiA9NN3/xNaEidWagg1d+auxI6GXqXP11SSWMv
	 VZHPX/v2lDkdW/h5STOtu1qrXtFMZE+1qvEfrYpG4AtK9dWGz1AaJOXF/7MvIA2APKByW
	 p7u4gVqTvZkdkmwX7f0QN/OH0i/tuG4pdNY/smEaxj2+VU1wfHnl5FaonhEox7MtccxXl
	 Az8c5IWtrd/4PHkzR/yZwgJPi2D55XCzBXfxdUfvF4wGJPFtdZ0EAAPnY1vdHINDz8DPm
	 3dmMGYj0Qq2ha7NHB1YuOLZ6/pmCUJ4XrLUJZdZ6xmbRPruXeAFvfvF8PFw4QUl4u6g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=uniroma2.it;
	spf=pass smtp.mailfrom=uniroma2.it;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=5F1LdMql;
	dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=eFqLqCOw;
	arc=none smtp.remote-ip=160.80.4.33
X-Received: from smtp.uniroma2.it (smtp.uniroma2.it [160.80.4.33])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id DCB8A606A31C
	for <netdev@vger.kernel.org>; Mon,  9 Nov 2026 16:47:52 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DCB8A606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniroma2.it
X-Received: from smtpauth-2019-1.uniroma2.it (smtpauth.uniroma2.it [160.80.5.46])
	by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 6A9Gl3W4005821;
	Mon, 9 Nov 2026 17:47:08 +0100
X-Received: from lubuntu-18.04 (unknown [160.80.103.126])
	by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 36FEC122944;
	Mon,  9 Nov 2026 17:46:56 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
	s=ed201904; t=1794242816; h=from:from:sender: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=JyrVlOx5Pw/FngxAbjpQKaqtcPrR77mlf34YeVFjYvU=;
	b=5F1LdMqlYBzK4dYfy+9CEgiRlr86W3PLd9NUsQT6rP+I5zIi92pEmLq4JqCr4TjP9gZvq3
	3qNTecTOGxAjjoCw==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
	t=1794242816; h=from:from:sender: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=JyrVlOx5Pw/FngxAbjpQKaqtcPrR77mlf34YeVFjYvU=;
	b=eFqLqCOw3lkV2MY83uaTnOpfJrpv/3lBbyyAvoRIMUjJ2TITUOc8yFacE59SswzgEyEnqi
	NbL5DMYKVdPqijddGV2h4YdDS2zOW8RszAa2srWMNnX5ZmYdw2dLqH4Nd+UfjXdHzZyu98
	F52IG4opvGcqG10xYnohYJLgiESfDhxeZz0wmfnJ75bRtyyRmnxNwyrLRskcoEhqg6rKm/
	rD1zpPC7P0u/bZbd1sGrefQjf5RgPzUhgeYom6n+7j/cMJ41XUOMnx/4Mo9bq121dgiuXl
	gicea0YCNbw/yR1FxhhDzbIPh/00n4ZitjYK6IjzADq+bnoN/YJGxcWNw7xMsQ==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
        kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
        contact@proelbtn.com, pablo@netfilter.org, vega@nebusec.ai,
        sashiko-bot@kernel.org, petalzu987@gmail.com, liuhangbin@kylinos.cn,
        Hangbin Liu
 <hangbin.liu@linux.dev>,
        Stefano Salsano <stefano.salsano@uniroma2.it>,
        Andrea Mayer <andrea@common-net.org>,
        Andrea Mayer
 <andrea.mayer@uniroma2.it>
X-In-Reply-To: <8574739acd6f5d9eb0a5640e893122619e9f79ef.1793726355.git.petalzu987@gmail.com>
X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
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-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015
X-Virus-Status: Clean