From: Ido Schimmel <idosch@nvidia.com>
To: Ren Wei <enjou1224z@gmail.com>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
kuniyu@google.com, jlayton@kernel.org, runyu.xiao@seu.edu.cn,
kees@kernel.org, michael.bommarito@gmail.com,
gustavoars@kernel.org, willemb@google.com, lirongqing@baidu.com,
vega@nebusec.ai, zhilinz@nebusec.ai
Subject: Re: [PATCH net 0/1] net: reject IP sends with excessive headroom
Date: Thu, 30 Jul 2026 11:09:57 +0300 [thread overview]
Message-ID: <20260730080957.GA1551985@shredder> (raw)
In-Reply-To: <cover.1785054561.git.zhilinz@nebusec.ai>
On Tue, Jul 28, 2026 at 02:03:05AM +0800, Ren Wei wrote:
> From: Zhiling Zou <zhilinz@nebusec.ai>
> Bug details:
>
> IPv4 and IPv6 output paths reserve LL_RESERVED_SPACE(dev) before recording skb
> network and transport header offsets. Those offsets are stored in 16-bit skb
> fields.
>
> A namespace-local stack of tunnel devices can make hard_header_len plus
> needed_headroom exceed the range of those fields. In rawv6_send_hdrinc(), the
> wrapped skb->network_header makes ipv6_hdr(skb) point back into headroom
> instead of the packet area just reserved by skb_put(). The user-supplied IPv6
> packet is copied to that wrapped header pointer while the actual packet data
> remains stale. Later IPv6 output and error handling can operate on invalid
> headers and crash, as seen in __skb_flow_dissect().
>
> The same root cause is present in the ordinary IPv4 and IPv6 append/cork
> paths, which reserve device headroom and then store network_header plus
> fragheaderlen in skb->transport_header. IPv4 raw HDRINCL also adds the
> user-provided ihl to skb->transport_header after parsing the header.
>
> The fix rejects IPv4 and IPv6 sends before the affected header offsets are
> stored if the largest offset for that path cannot be encoded in the skb header
> fields.
Instead of sprinkling checks in the data path, why not make sure that
net devices don't advertise bogus needed_headroom / hard_header_len
values in the control path? Commit 5ae1e9922bbd ("net: ip_tunnel:
prevent perpetual headroom growth") chose a value of 512, so maybe we
can use that.
AFAICT, the bug can only happen when stacking IP tunnels or when
creating a netkit device with a bogus headroom using
IFLA_NETKIT_HEADROOM.
prev parent reply other threads:[~2026-07-30 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 18:03 [PATCH net 0/1] net: reject IP sends with excessive headroom Ren Wei
2026-07-27 18:03 ` [PATCH net 1/1] " Ren Wei
2026-07-30 8:09 ` Ido Schimmel [this message]
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=20260730080957.GA1551985@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=enjou1224z@gmail.com \
--cc=gustavoars@kernel.org \
--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=vega@nebusec.ai \
--cc=willemb@google.com \
--cc=zhilinz@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