Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Andrea Mayer
Mon, 09 Nov 2026 16:46
Re: [PATCH net v5] seg6: validate state in netfilter continuations
Author: Andrea Mayer
Date: Mon, 09 Nov 2026 16:46
Date: Mon, 09 Nov 2026 16:46
47 lines
11848 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads