Netdev List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Ren Wei" <weir@nebusec.ai>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>
Cc: <daniel@iogearbox.net>, <john.fastabend@gmail.com>,
	<sdf@fomichev.me>, <martin.lau@linux.dev>, <andrii@kernel.org>,
	<eddyz87@gmail.com>, <memxor@gmail.com>, <song@kernel.org>,
	<yonghong.song@linux.dev>, <jolsa@kernel.org>,
	<emil@etsalapatis.com>, <ihor.solodrai@linux.dev>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>, <m.xhonneux@gmail.com>,
	<dlebrun@google.com>, <vega@nebusec.ai>, <rakukuip@gmail.com>
Subject: Re: [PATCH 1/1] bpf: fix TOCTOU in IPv6 SRH encapsulation
Date: Thu, 17 Sep 2026 16:59:55 +0000	[thread overview]
Message-ID: <DLHR2X1P3BTT.HK3TEMB89P28@gmail.com> (raw)
In-Reply-To: <20260917163408.252431-1-weir@nebusec.ai>

On Fri, Sep 18, 2026 at 12:33 AM Ren Wei <weir@nebusec.ai> wrote:
> @@ -6706,16 +6706,22 @@ static const struct bpf_func_proto bpf_xdp_check_mtu_proto = {
>  #if IS_ENABLED(CONFIG_IPV6_SEG6_BPF)
>  static int bpf_push_seg6_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len)
>  {
> -	int err;
> -	struct ipv6_sr_hdr *srh = (struct ipv6_sr_hdr *)hdr;
> +	struct ipv6_sr_hdr *srh;
> +	int err = -EINVAL;
> +
> +	srh = kmemdup(hdr, len, GFP_ATOMIC);
> +	if (!srh)
> +		return -ENOMEM;
>
>  	if (!seg6_validate_srh(srh, len, false))
> -		return -EINVAL;
> +		goto out;

Sorry. This TOCTOU issue applies to everything.
Patching it in one spot doesn't help.

pw-bot: cr

      reply	other threads:[~2026-09-17 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 16:33 [PATCH 0/1] bpf: fix TOCTOU in IPv6 SRH encapsulation Ren Wei
2026-09-17 16:33 ` [PATCH 1/1] " Ren Wei
2026-09-17 16:59   ` 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=DLHR2X1P3BTT.HK3TEMB89P28@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dlebrun@google.com \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=emil@etsalapatis.com \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=m.xhonneux@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rakukuip@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=vega@nebusec.ai \
    --cc=weir@nebusec.ai \
    --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