netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fejes Ferenc <fejes@inf.elte.hu>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Error when loading BPF_CGROUP_INET_EGRESS program with bpftool
Date: Sat, 19 Oct 2019 15:10:25 +0000	[thread overview]
Message-ID: <CAAej5Na29DMoQmiXn1VThLH2e3hqvBWqXB8Ah5sPv0Cm-csarQ@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzZqj-kuFC0Jv-i3k-sSdZE6ThihvqXvnss5rDR7ZRYGzQ@mail.gmail.com>

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

      reply	other threads:[~2019-10-19 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12  8:57 Error when loading BPF_CGROUP_INET_EGRESS program with bpftool Fejes Ferenc
2019-08-12 18:27 ` Andrii Nakryiko
2019-08-12 20:48   ` Fejes Ferenc
2019-08-13 21:18     ` Andrii Nakryiko
2019-10-19 15:10       ` Fejes Ferenc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAej5Na29DMoQmiXn1VThLH2e3hqvBWqXB8Ah5sPv0Cm-csarQ@mail.gmail.com \
    --to=fejes@inf.elte.hu \
    --cc=andrii.nakryiko@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).