Am 23.01.25 um 17:38 schrieb Toke Høiland-Jørgensen:
Marcus Wichelmann <marcus.wichelmann@xxxxxxxxxxxxxxxx> 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.
Marcus