From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Octavian Purdila <tavip@google.com>, maciej.fijalkowski@intel.com
Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, kuniyu@google.com, aleksander.lobakin@intel.com,
toke@redhat.com, lorenzo@kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org,
syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com,
Kernel Team <kernel-team@meta.com>
Subject: Re: [PATCH net v2] xdp: update mem type when page pool is used for generic XDP
Date: Thu, 2 Oct 2025 11:32:59 -0700 [thread overview]
Message-ID: <19df5360-9fee-4ca4-ab66-85aeede3979e@linux.dev> (raw)
In-Reply-To: <CAGWr4cQ6g5xw_iJK2KbyTbSszsf2gacUZ9v0wKAVWnyBAYz9nA@mail.gmail.com>
On 10/1/25 6:02 PM, Octavian Purdila wrote:
> On Wed, Oct 1, 2025 at 1:26 PM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>>
>> Hi Octavian,
>>
>
> Hi Ihor,
>
>> This patch seems to be causing a null pointer dereference.
>> See a splat caught by BPF CI below.
>>
>> You might be able to reproduce with:
>>
>> cd tools/testing/selftests/bpf
>> make test_progs
>> # in kernel with this patch
>> ./test_progs -t xdp_veth
>>
>> Reverting this commit mitigates the failure:
>> https://github.com/linux-netdev/testing-bpf-ci/commit/9e1eab63cd1bcbe37e205856f7ff7d1ad49669f5
>>
>> Could you please take a look?
>>
>
> Thanks for the report, it looks like dev needs to be set in
> xdp_rxq_info. The following fix works me:
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 365c43ffc9c1..85b52c28660b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5449,7 +5449,9 @@ int do_xdp_generic(const struct bpf_prog
> *xdp_prog, struct sk_buff **pskb)
> struct bpf_net_context __bpf_net_ctx, *bpf_net_ctx;
>
> if (xdp_prog) {
> - struct xdp_rxq_info rxq = {};
> + struct xdp_rxq_info rxq = {
> + .dev = (*pskb)->dev,
> + };
> struct xdp_buff xdp = {
> .rxq = &rxq,
> };
>
> But probably Maciej approach is better.
Hi Octavian, Maciej,
I tested both diffs on BPF CI, no issues.
This patch + diff above assigning .dev:
* Revision: https://github.com/theihor/bpf/commits/refs/heads/netdev-fix-20251002.1/
* CI run: https://github.com/kernel-patches/bpf/actions/runs/18199837294
This patch reverted + Maciej's diff (pasted below):
* Revision: https://github.com/theihor/bpf/commits/refs/heads/netdev-fix-20251002.2/
* CI run: https://github.com/kernel-patches/bpf/actions/runs/18199860590
Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev>
I am going to add the revert diff as a temporary patch to CI for now.
Thanks!
diff --git a/net/core/dev.c b/net/core/dev.c
index 93a25d87b86b..7707a95ca8ed 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5269,6 +5269,9 @@ u32 bpf_prog_run_generic_xdp(struct sk_buff *skb, struct xdp_buff *xdp,
orig_bcast = is_multicast_ether_addr_64bits(eth->h_dest);
orig_eth_type = eth->h_proto;
+ xdp->rxq->mem.type = page_pool_page_is_pp(virt_to_page(xdp->data)) ?
+ MEM_TYPE_PAGE_POOL : MEM_TYPE_PAGE_SHARED;
+
act = bpf_prog_run_xdp(xdp_prog, xdp);
/* check if bpf_xdp_adjust_head was used */
prev parent reply other threads:[~2025-10-02 18:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 7:47 [PATCH net v2] xdp: update mem type when page pool is used for generic XDP Octavian Purdila
2025-10-01 14:42 ` Maciej Fijalkowski
2025-10-01 15:27 ` Jakub Kicinski
2025-10-01 19:06 ` Maciej Fijalkowski
2025-10-02 1:15 ` Octavian Purdila
2025-10-02 12:54 ` Maciej Fijalkowski
2025-10-02 16:57 ` Octavian Purdila
2025-10-01 20:26 ` Ihor Solodrai
2025-10-02 1:02 ` Octavian Purdila
2025-10-02 18:32 ` Ihor Solodrai [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=19df5360-9fee-4ca4-ab66-85aeede3979e@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=aleksander.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=lorenzo@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=syzbot+ff145014d6b0ce64a173@syzkaller.appspotmail.com \
--cc=tavip@google.com \
--cc=toke@redhat.com \
/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).