BPF List
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Marcus Wichelmann <marcus.wichelmann@hetzner-cloud.de>
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>, bpf@vger.kernel.org
Subject: Re: RX metadata kfuncs cause kernel panic with XDP generic mode
Date: Thu, 23 Jan 2025 11:51:33 -0800	[thread overview]
Message-ID: <Z5KdxTHVFSJSw5FQ@mini-arch> (raw)
In-Reply-To: <74f949dc-7921-4f06-88e1-5b3686839b65@hetzner-cloud.de>

On 01/23, Marcus Wichelmann wrote:
> 
> Am 23.01.25 um 17:38 schrieb Toke Høiland-Jørgensen:
> > Marcus Wichelmann <marcus.wichelmann@hetzner-cloud.de> writes:
> > 
> > > There is probably a check missing somewhere that prevents the use of
> > > these kfuncs in the scope of do_xdp_generic?
> > 
> > Heh, yeah, we should definitely block device-bound programs from being
> > attached in generic mode. Something like the below, I guess. Care to
> > test that out?
> > 
> > -Toke
> > 
> Ah, thanks for the quick patch. ;)
> 
> I have tested your patch with the 6.12 branch I'm currently working with and this does the job.
> 
>   # bpftool prog load crash.o /sys/fs/bpf/crash xdpmeta_dev mlx5-conx5-1
>   # bpftool net attach xdpgeneric pinned /sys/fs/bpf/crash dev mlx5-conx5-1
>   libbpf: Kernel error message: Can't attach device-bound programs in generic mode
>   Error: interface xdpgeneric attach failed: Invalid argument
> 
> The do_xdp_generic is also used by the tun driver as a fallback in some cases, so, to my understanding,
> even programs attached in driver-mode may take the generic XDP path. How can this be handled there?

[..]

> Currently, it's not an issue, because the tun driver does not implement the xdp_metadata_ops yet, but
> it may become one in the future.

We can solve it if/when we add metadata_ops to the tun driver, right?
Not sure we need any immediate action right now.

  reply	other threads:[~2025-01-23 19:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 16:02 RX metadata kfuncs cause kernel panic with XDP generic mode Marcus Wichelmann
2025-01-23 16:38 ` Toke Høiland-Jørgensen
2025-01-23 17:59   ` Marcus Wichelmann
2025-01-23 19:51     ` Stanislav Fomichev [this message]
2025-01-23 20:21       ` Marcus Wichelmann
2025-01-23 19:13   ` Stanislav Fomichev
2025-01-23 19:34     ` Toke Høiland-Jørgensen

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=Z5KdxTHVFSJSw5FQ@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=marcus.wichelmann@hetzner-cloud.de \
    --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