Sorry for the late reply. I have some time to try it again. I downloaded a fresh Ubuntu 19.10 image, which have bpftool included from the linux-tools-generic package. Then tried to load a program with 0 or 1 return code: both works. After that I tried to load the original program, with return code 2 or 3 and got the same error message.
> What was the error message you got after you provided correct program > attach type? sudo bpftool prog loadall hbm.o /sys/fs/bpf/hbm2 type cgroup_skb/egress libbpf: load bpf program failed: Invalid argument libbpf: -- BEGIN DUMP LOG --- libbpf: ; return ALLOW_PKT | REDUCE_CW; 0: (b7) r0 = 3 1: (95) exit At program exit the register R0 has value (0x3; 0x0) should have been in (0x0; 0x1) processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0 libbpf: -- END LOG -- libbpf: failed to load program 'cgroup_skb/egress' libbpf: failed to load object 'hbm.o' Error: failed to load object file Same command with strace: bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_CGROUP_SKB, insn_cnt=2, insns=0x558889b59ba0, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="hbm", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, ...}, 112) = -1 EINVAL (Invalid argument) bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_CGROUP_SKB, insn_cnt=2, insns=0x558889b59ba0, license="GPL", log_level=1, log_size=16777215, log_buf="", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="hbm", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, ...}, 112) = -1 EINVAL (Invalid argument) Strace error is the same, even if I manually set the type to cgroup_skb/egress: bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_CGROUP_SKB, insn_cnt=2, insns=0x55ae46296ba0, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="hbm", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, ...}, 112) = -1 EINVAL (Invalid argument) bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_CGROUP_SKB, insn_cnt=2, insns=0x55ae46296ba0, license="GPL", log_level=1, log_size=16777215, log_buf="", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="hbm", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, ...}, 112) = -1 EINVAL (Invalid argument) I noticed you did a major restructuring in libbpf, I will try out whether my problem still exist with the new version. Ferenc