From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Hu Xinyao" <huxinyao@kylinsec.com.cn>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>
Cc: "Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Willem de Bruijn" <willemb@google.com>,
"Chris Mason" <mason@kernel.org>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf] bpf: Handle unset mac_header in bpf_skb_adjust_room() and bpf_skb_change_proto()
Date: Mon, 30 Nov 2026 05:28:06 +0000 [thread overview]
Message-ID: <DN8APJC61A66.1KO9ZDY5IPHWL@gmail.com> (raw)
In-Reply-To: <7917559651CE563A+1796014802.205272-1-huxinyao@kylinsec.com.cn>
On Sun, Nov 29, 2026 at 09:00 PM Hu Xinyao <huxinyao@kylinsec.com.cn> wrote:
> On L3 interfaces such as IFF_TUN and wireguard, ingress packets enter TC
> BPF programs with skb->mac_header unset (~0U) and skb->data at the
> network header.
No. Both drivers call skb_reset_mac_header() before the skb gets to tc:
driver where
--------- ------------------------------------------------
tun __virtio_net_hdr_to_skb(), from tun_get_user()
wireguard wg_reset_packet(), from wg_packet_rx_poll()
skb->data is at the network header at that point.
So skb_mac_header_len() returns 0 and both helpers work.
> Found during a GLM-5.4-assisted code audit and verified manually against
> mainline; compile-tested only (not triggered at runtime).
It cannot be triggered on tun or wireguard.
Pls don't send fixes for bugs that you didn't reproduce.
pw-bot: cr
prev parent reply other threads:[~2026-11-30 5:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 5:00 [PATCH bpf] bpf: Handle unset mac_header in bpf_skb_adjust_room() and bpf_skb_change_proto() Hu Xinyao
2026-11-30 5:28 ` Alexei Starovoitov [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=DN8APJC61A66.1KO9ZDY5IPHWL@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=huxinyao@kylinsec.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=willemb@google.com \
--cc=yonghong.song@linux.dev \
/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