facebookincubator / katran

A high performance layer 4 load balancer
GNU General Public License v2.0
4.75k stars 504 forks source link

Load balancer_kern.o error:Prog section 'xdp-balancer' rejected: Permission denied (13)! #149

Closed qingfenghanghua closed 2 years ago

qingfenghanghua commented 2 years ago

Load balancer_kern.o by iproute2: ip link set dev enp178s0 xdp obj balancer_kern.o sec xdp-balancer The output is as follows: BTF debug data section '.BTF' rejected: Invalid argument (22)!

magic: 0xeb9f version: 1 flags: 0x0 hdr_len: 24 type_off: 0 type_len: 2476 str_off: 2476 str_len: 9025 btf_total_size: 11525 ... [20] STRUCT (anon) size=40 vlen=5 type type_id=1 bits_offset=0 key type_id=5 bits_offset=64 value type_id=8 bits_offset=128 max_entries type_id=16 bits_offset=192 map_flags type_id=18 bits_offset=256 [21] Invalid kind:14

Prog section 'xdp-balancer' rejected: Permission denied (13)!

Verifier analysis: ... 549: (bf) r2 = r10 550: (07) r2 += -96 551: (18) r1 = 0x0 553: (85) call bpf_map_lookup_elem#1 R1 type=inv expected=map_ptr

Error fetching program/map!

uname -r 4.18.16-1.el7.elrepo.x86_64

I amn't sure if there is something wrong with my environment

yonghong-song commented 2 years ago

First, for btf error: [21] Invalid kind:14 the kind 14 is BTF_KIND_VAR and the kernel 4.18 doesn't support it so BTF will be ignored and it seems okay for katran.

But the real failure is:

549: (bf) r2 = r10
550: (07) r2 += -96
551: (18) r1 = 0x0
553: (85) call bpf_map_lookup_elem#1
R1 type=inv expected=map_ptr

the first argument is supposed to be a map pointer, but it is 'r1 = 0' which is clearly wrong.

I am wondering whether this is due to use iproute2 command ip link set dev enp178s0 xdp obj balancer_kern.o sec xdp-balancer

where its loader recognizes map format might be different from libbpf.

qingfenghanghua commented 2 years ago

You mean I should use command like this? ./build/example_grpc/katran_server_grpc -balancer_prog ./deps/bpfprog/bpf/balancer_kern.o -default_mac 52:54:00:12:35:02 -forwarding_cores=0 -healthchecker_prog ./deps/bpfprog/bpf/healthchecking_ipip.o -intf=enp0s3 -ipip_intf=ipip0 -ipip6_intf=ipip60 -lru_size=10000

yonghong-song commented 2 years ago

Sorry. I am not really familiar with katran_server_grpc. But to use loader in katran itself sounds right.

qingfenghanghua commented 2 years ago

But it seems doesn't work.Errors are as follows: I1225 14:47:12.381088 2059 KatranGrpcService.cpp:67] Starting Katran libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(16) .eh_frame libbpf: elf: skipping relo section(17) .rel.eh_frame for section(16) .eh_frame E1225 14:47:12.827745 2059 BpfAdapter.cpp:219] Error receiving netlink message: Invalid argument [22] terminate called after throwing an instance of 'std::invalid_argument' what(): can't attach main bpf prog to main inteface, error: Invalid argument

qingfenghanghua commented 2 years ago

But it seems doesn't work.Errors are as follows: I1225 14:47:12.381088 2059 KatranGrpcService.cpp:67] Starting Katran libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(16) .eh_frame libbpf: elf: skipping relo section(17) .rel.eh_frame for section(16) .eh_frame E1225 14:47:12.827745 2059 BpfAdapter.cpp:219] Error receiving netlink message: Invalid argument [22] terminate called after throwing an instance of 'std::invalid_argument' what(): can't attach main bpf prog to main inteface, error: Invalid argument

I started it on physical machine

frankfeir commented 2 years ago

But it seems doesn't work.Errors are as follows: I1225 14:47:12.381088 2059 KatranGrpcService.cpp:67] Starting Katran libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(17) .eh_frame libbpf: elf: skipping relo section(18) .rel.eh_frame for section(17) .eh_frame libbpf: elf: skipping unrecognized data section(16) .eh_frame libbpf: elf: skipping relo section(17) .rel.eh_frame for section(16) .eh_frame E1225 14:47:12.827745 2059 BpfAdapter.cpp:219] Error receiving netlink message: Invalid argument [22] terminate called after throwing an instance of 'std::invalid_argument' what(): can't attach main bpf prog to main inteface, error: Invalid argument

I started it on physical machine

Hi, @qingfenghanghua, haven't seen any update since you tried to "start it on physical machine". Are you still seeing any problem? Could you please share the latest? Thanks