Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Slawomir Stepien <sst@poczta.fm>
To: netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net,
	hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	jiayuan.chen@linux.dev, phx0fer@gmail.com,
	maciej.fijalkowski@intel.com, tianyi@cloudflare.com,
	tavip@google.com, toke@redhat.com, aleksander.lobakin@intel.com,
	lorenzo@kernel.org, lorenzo.bianconi@oss.qualcomm.com,
	ihor.solodrai@linux.dev, andrew+netdev@lunn.ch,
	willemb@google.com, horms@kernel.org, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, jolsa@kernel.org, memxor@gmail.com,
	emil@etsalapatis.com, shuah@kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net v9 4/6] veth: use the page_pool mem type when running XDP on an skb
Date: Mon, 30 Nov 2026 13:52:11 +0100	[thread overview]
Message-ID: <aw1xezaRA0Mns_aP@nr200> (raw)
In-Reply-To: <179586023747.3135.10147454988994351806@kernel.org>

On lis 28, 2026 10:03, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
> 
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
> 
> - [Medium] In drivers/net/veth.c, veth_convert_skb_to_xdp_buff() now
>   always sets rxq->mem.type = MEM_TYPE_PAGE_POOL.

This is true, but with this condition:

> Take an skb that is unshared and unlocked, has enough headroom, and has
> nr_frags > 0 but data_len == 0 (all frags are zero-length). It skips
> skb_pp_cow_data() and keeps its original frag pages, which are not
> page_pool pages. It still gets XDP_FLAGS_HAS_FRAGS and runs with
> MEM_TYPE_PAGE_POOL.

I wonder how possible is this anyway?

I guess an easy prevention for this case, would be to also check for nr_frags in here:

        if (skb_shared(skb) || skb_head_is_locked(skb) ||
-           skb_is_nonlinear(skb) ||
+           skb_is_nonlinear(skb) || skb_shinfo(skb)->nr_frags ||
            skb_headroom(skb) < XDP_PACKET_HEADROOM) {
                if (skb_pp_cow_data(rq->page_pool, pskb, XDP_PACKET_HEADROOM))
                        goto drop;
                skb = *pskb;
        }

With this, the frags will not be copied when data_len == 0, so the output skb would have nr_frags ==
0, so the flag would not be set.

-- 
Slawomir Stepien

  reply	other threads:[~2026-11-30 12:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:01 [PATCH net v9 0/6] xdp: fix page_pool leaks Slawomir Stepien
2026-11-27 10:01 ` [PATCH net v9 1/6] xdp: run generic XDP on frags with a copy of the rxq info Slawomir Stepien
2026-11-27 10:01 ` [PATCH net v9 2/6] bpf: test_run: Set frag_size on " Slawomir Stepien
2026-11-27 10:01 ` [PATCH net v9 3/6] veth: use the frame mem type when running XDP on an xdp_frame Slawomir Stepien
2026-11-27 10:01 ` [PATCH net v9 4/6] veth: use the page_pool mem type when running XDP on an skb Slawomir Stepien
2026-11-28 10:03   ` netdev-bot+sashiko
2026-11-30 12:52     ` Slawomir Stepien [this message]
2026-11-27 10:01 ` [PATCH net v9 5/6] selftests/bpf: add xdp_shrink_frags Slawomir Stepien
2026-11-28 10:04   ` netdev-bot+sashiko
2026-11-27 10:01 ` [PATCH net v9 6/6] selftests/bpf: Grow test_run and generic XDP frags after a test run Slawomir Stepien

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=aw1xezaRA0Mns_aP@nr200 \
    --to=sst@poczta.fm \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=lorenzo@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phx0fer@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tavip@google.com \
    --cc=tianyi@cloudflare.com \
    --cc=toke@redhat.com \
    --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