Re: eBPF verifier does not load libxdp dispatcher eBPF program

From: Marc Kleine-Budde
Date: Wed Feb 26 2025 - 11:07:32 EST


On 25.02.2025 23:57:47, Marc Kleine-Budde wrote:

[...]

> With the CONFIG_DEBUG_INFO_BTF=y kernel the verifier seems to be more
> happy. Now it fails with "-22":
>
> | sudo ./xdp_pass_user -d lan0
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument
> | libbpf: prog 'xdp_pass': -- BEGIN PROG LOAD LOG --
> | Extension programs should be JITed
> | processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
> | -- END PROG LOAD LOG --
> | libbpf: prog 'xdp_pass': failed to load: -22
> | libbpf: failed to load object 'xdp-dispatcher.o'
> | libxdp: Compatibility check for dispatcher program failed: Invalid argument
> | libxdp: Falling back to loading single prog without dispatcher
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | Success: Loading XDP prog name:xdp_prog_simple(id:20) on device:lan0(ifindex:4)
>
>
> After unloading and enabling the JIT...
>
> | ➜ (pts/0) frogger@riot:xdp-tutorial/basic01-xdp-pass (main✗) echo 1 |sudo tee /proc/sys/net/core/bpf_jit_enable
>
> ... the dispatcher fails to load with "524". Yes, the number is
> positive.
>
> | ➜ (pts/0) frogger@riot:xdp-tutorial/basic01-xdp-pass (main✗) sudo ./xdp_pass_user -d lan0 --unload-all
> | Success: Unloading XDP prog name: xdp_prog_simple
> | ➜ (pts/0) frogger@riot:xdp-tutorial/basic01-xdp-pass (main✗) sudo ./xdp_pass_user -d lan0
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | libxdp: Compatibility check for dispatcher program failed: Unknown error 524
> | libxdp: Falling back to loading single prog without dispatcher
> | libbpf: elf: skipping unrecognized data section(7) xdp_metadata
> | Success: Loading XDP prog name:xdp_prog_simple(id:48) on device:lan0(ifindex:4)
>
> strace indicates this syscalls fails:
>
> | bpf(BPF_RAW_TRACEPOINT_OPEN, {raw_tracepoint={name=NULL, prog_fd=17}}, 16) = -1 ENOTSUPP (Unknown error 524)
>
> I'm on a armv7l, i.e. a 32 bit ARM system. Maybe I'm missing some kernel
> option or BPF_RAW_TRACEPOINT_OPEN is not supported on armv7l. Will look
> deeper into the kernel config options tomorrow.

FTR: I figured out that the dispatcher needs eBPF trampoline support,
which doesn't exist on ARM.

| https://docs.ebpf.io/linux/concepts/trampolines/

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

Attachment: signature.asc
Description: PGP signature