From: Ido Schimmel <idosch@nvidia.com>
To: Zihan Xi <zihanx@nebusec.ai>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
kuniyu@google.com, gustavoars@kernel.org, runyu.xiao@seu.edu.cn,
jlayton@kernel.org, michael.bommarito@gmail.com, kees@kernel.org,
willemb@google.com, lirongqing@baidu.com, vega@nebusec.ai
Subject: Re: [PATCH net v3 1/1] net: ip_tunnel: reject excessive tunnel stacking headroom
Date: Tue, 4 Aug 2026 15:07:53 +0300 [thread overview]
Message-ID: <20260804120753.GA1073788@shredder> (raw)
In-Reply-To: <a25901403c69929d6f72ba802b3ab912f2adbe63.1785691607.git.zihanx@nebusec.ai>
On Sun, Aug 02, 2026 at 06:49:17PM +0000, Zihan Xi wrote:
> raw_send_hdrinc() and rawv6_send_hdrinc() reserve LL headroom before
> storing skb header offsets in 16-bit fields. If an egress device has a
> very large LL_RESERVED_SPACE(), skb_reset_network_header() stores a
> truncated network_header offset and the hdrincl path can later copy the
> user header to the wrong location.
>
> The reproducer creates a very deep gretap stack. Each new tunnel derives
> its needed_headroom from the lower device, so the stack can grow the
> resulting LL headroom beyond what skb header offsets can represent.
>
> Reject IPv4 tunnel configurations when the computed headroom would make
> LL_RESERVED_SPACE() exceed the skb header offset range needed by raw
> IPv4 hdrincl. This rejects the bad tunnel stack at configuration time
> instead of checking every packet in later hot paths. Keep small raw IPv4
> and IPv6 hdrincl guards as a final bound check for devices that are not
> created through the IPv4 tunnel control path.
>
> Fixes: 1a37e412a022 ("net: Use 16bits for *_headers fields of struct skbuff")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Assisted-by: Codex:gpt-5.4
> Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
> ---
> changes in v3:
> - Rework the fix to reject excessive IPv4 tunnel headroom at
> configuration time, following Willem de Bruijn's feedback.
> - Drop the broad skb/XFRM/GSO/ESP/IPTFS runtime checked-helper changes
> from v2.
> - Keep only small raw hdrincl guards as a final bound check.
> - v2 Link: https://lore.kernel.org/all/cover.1785529351.git.zihanx@nebusec.ai/
> changes in v2:
> - Keep skb_segment() default error code after successful checked skb offset
> updates to avoid returning ERR_PTR(0), as reported by the kernel test
> robot.
> - Extend the checked update coverage to XFRM, ESP offload, and IPTFS
> transport-header recomputation paths instead of relying on raw hdrincl
> entry guards alone.
> - v1 Link: https://lore.kernel.org/all/cover.1785346409.git.zihanx@nebusec.ai/
> ---
> include/net/ip_tunnels.h | 5 +-
> net/ipv4/ip_gre.c | 8 +--
> net/ipv4/ip_tunnel.c | 138 ++++++++++++++++++++++++++-------------
> net/ipv4/ip_vti.c | 4 +-
> net/ipv4/ipip.c | 4 +-
> net/ipv4/raw.c | 3 +
> net/ipv6/raw.c | 4 ++
> 7 files changed, 111 insertions(+), 55 deletions(-)
The patch conflicts with another patch from nebusec.ai:
https://lore.kernel.org/netdev/0ae4aa29223b89049727aec4d36f144bad41537e.1785476387.git.zhilinz@nebusec.ai/
nebusec.ai cannot send conflicting patches and make it our problem to
sort it out. I think we should proceed with the patch I mentioned and
drop this one. The current patch doesn't handle IPv6 tunnels.
Related, please make sure the team is aware of:
https://lore.kernel.org/all/83360de7addb13a3b5f4d5e722148f248fdb2ae0.1784884817.git.pabeni@redhat.com/
Thanks
next prev parent reply other threads:[~2026-08-04 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 18:49 [PATCH net v3 0/1] net: ip_tunnel: reject excessive tunnel stacking headroom Zihan Xi
2026-08-02 18:49 ` [PATCH net v3 1/1] " Zihan Xi
2026-08-03 15:28 ` Willem de Bruijn
2026-08-04 12:07 ` Ido Schimmel [this message]
2026-08-04 12:29 ` zihan xi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804120753.GA1073788@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gustavoars@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=jlayton@kernel.org \
--cc=kees@kernel.org \
--cc=kuniyu@google.com \
--cc=lirongqing@baidu.com \
--cc=michael.bommarito@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=runyu.xiao@seu.edu.cn \
--cc=steffen.klassert@secunet.com \
--cc=vega@nebusec.ai \
--cc=willemb@google.com \
--cc=zihanx@nebusec.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).