Closed pettai closed 1 year ago
Well, segfaults is the more correct term I guess...
# dmesg
…
[ 1139.024355] show_signal_msg: 21 callbacks suppressed
[ 1139.024359] xdpfw[6125]: segfault at ebb0 ip 000000000000ebb0 sp 00007ffd67094f48 error 14 in xdpfw[562cafcab000+c000]
[ 1139.024373] Code: Unable to access opcode bytes at RIP 0xeb86.
[ 1185.264171] xdpfw[6562]: segfault at ebb0 ip 000000000000ebb0 sp 00007ffe53199b68 error 14 in xdpfw[5603b2226000+c000]
[ 1185.264184] Code: Unable to access opcode bytes at RIP 0xeb86.
I just spun up a vanilla Ubuntu 22.04 VM and had the following error.
BPF program is too large. Processed 1000001 insn
processed 1000001 insns (limit 1000000) max_states_per_insn 213 total_states 32198 peak_states 4041 mark_read 324
-- END PROG LOAD LOG --
libbpf: prog 'xdp_prog_main': failed to load: -7
libbpf: failed to load object '/etc/xdpfw/xdpfw_kern.o'
libxdp: Falling back to loading single prog without dispatcher
This is due to the MAX_FILTERS
constant being too high for the BPF program. When I set it to 80, it works fine.
This has happened before, but what I don't understand is it works fine for a while beforehand and nothing in the code changes before it starts outputting this error. There must be something changing on the Linux kernel/BPF's side and the amount of insns allowed to be processed has always been one million. The limit can also be raised if you rebuild the kernel and I made public patches on another XDP program I made here for it.
I'll be making a commit soon and thank you for the report :smile:
Commit c12496a adjusts the MAX_FILTERS
constant to 80.
Can you try loading the firewall after pulling the newer commits via git pull
and rebuilding?
Good catch! After pulling your update & recompiling/reinstalling, it works 👍
(But I see crap output from libbpf still...
ubuntu@bygg-u2204:~/XDP-Firewall$ sudo /usr/bin/xdpfw
libbpf: elf: skipping unrecognized data section(7) .xdp_run_config
libbpf: elf: skipping unrecognized data section(8) xdp_metadata
libbpf: elf: skipping unrecognized data section(23) .eh_frame
libbpf: elf: skipping relo section(24) .rel.eh_frame for section(23) .eh_frame
libbpf: elf: skipping unrecognized data section(7) xdp_metadata
libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument
libbpf: prog 'xdp_pass': failed to load: -22
libbpf: failed to load object '/usr/local/lib/bpf/xdp-dispatcher.o'
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
Loaded XDP program on mode DRV/native.
Packets Allowed: 399 | Packets Dropped: 0Loaded XDP program on mode DRV/native.
^C
``` )
(Ok, now I also see the same error you mention then looking into journalctl -u xdpfw
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: BPF program is too large. Processed 1000001 insn
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: processed 1000001 insns (limit 1000000) max_states_per_insn 213 total_states 32198 peak>
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: -- END PROG LOAD LOG --
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: prog 'xdp_prog_main': failed to load: -7
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: failed to load object '/etc/xdpfw/xdpfw_kern.o'
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libxdp: Falling back to loading single prog without dispatcher
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: elf: skipping unrecognized data section(7) xdp_metadata
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: prog 'xdp_pass': failed to load: -22
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: failed to load object '/usr/local/lib/bpf/xdp-dispatcher.o'
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: Could not attach with mode DRV/native (Bad file descriptor) (9).
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: elf: skipping unrecognized data section(7) xdp_metadata
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: prog 'xdp_pass': failed to load: -22
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: failed to load object '/usr/local/lib/bpf/xdp-dispatcher.o'
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: libbpf: elf: skipping unrecognized data section(7) xdp_metadata
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: Could not attach with mode SKB/generic (Invalid argument) (22).
Oct 11 21:25:02 bygg-u2204 xdpfw[9738]: Error attaching XDP program.
I never got that on stdout/stderr in my terminal
)
it works now, so I'll close this now
Hi,
After successful build and installation on a vanilla Ubuntu 22.04, running
xdpfw
doesn't work as intended:Sys info:
Build info:
XDPFW info: