bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eelco Chaudron" <echaudro@redhat.com>
To: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
Cc: Xdp <xdp-newbies@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: Trying the bpf trace a bpf xdp program
Date: Fri, 29 Nov 2019 17:30:27 +0100	[thread overview]
Message-ID: <4BBF99E4-9554-44F7-8505-D4B8416554C4@redhat.com> (raw)
In-Reply-To: <CAADnVQJKSnoMVpQ3F86zBhFyo8WQ0vi65Z4QDtopLRrpK4yB8Q@mail.gmail.com>



On 28 Nov 2019, at 20:47, Alexei Starovoitov wrote:

> On Thu, Nov 28, 2019 at 11:16 AM Eelco Chaudron <echaudro@redhat.com> 
> wrote:
>>
>>
>>
>> On 28 Nov 2019, at 19:18, Alexei Starovoitov wrote:
>>
>>> On Thu, Nov 28, 2019 at 9:20 AM Eelco Chaudron <echaudro@redhat.com>
>>> wrote:
>>>>
>>>> Trying out the BPF trace to trace a BPF program, but I’m already
>>>> getting stuck loading the object with the fexit  :(
>>>
>>> I can take a look after holidays.
>>
>> Enjoy the Holidays!! I figured out my auto kernel install script 
>> failed
>> whiteout me noticing, and I was running an old kernel :(
>>
>> I will try tomorrow with the correct kernel…
>
> Please also check that you have the latest llvm and pahole.
> pahole version should be >= 1.13.
> clang ideally from master.
> If all that is working then downgrade one by one and bisect whether 
> the bug is.
>

I tried it with the latest kernel loaded but still I got some errors on 
bpf_object__load_xattr():

$ sudo ./xdp_sample_fentry_fexit_user
libbpf: Cannot find bpf_func_info for main program sec 
fexit/xdp_prog_simple. Ignore all bpf_func_info.
libbpf: load bpf program failed: Operation not permitted
libbpf: failed to load program 'fexit/xdp_prog_simple'
libbpf: failed to load object './xdp_sample_fentry_fexit_kern.o'
ERROR: Failed to load object file: Operation not permitted


With strace:

[vagrant@xdp-tutorial tracing05-xdp-fentry]$ sudo 
/home/vagrant/strace/strace -e bpf ./xdp_sample_fentry_fexit_user
bpf(BPF_PROG_GET_FD_BY_ID, {prog_id=36, next_id=0, open_flags=0}, 120) = 
3
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=2, 
insns=0x7ffcaedfd4f0, license="GPL", log_level=0, log_size=0, 
log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, 
prog_name="", prog_ifindex=0, 
expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, 
func_info_rec_size=0, func_info=NULL, func_info_cnt=0, 
line_info_rec_size=0, line_info=NULL, line_info_cnt=0}, 120) = 5
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=2, 
insns=0x7ffcaedfd4f0, license="GPL", log_level=0, log_size=0, 
log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, 
prog_name="test", prog_ifindex=0, 
expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, 
func_info_rec_size=0, func_info=NULL, func_info_cnt=0, 
line_info_rec_size=0, line_info=NULL, line_info_cnt=0}, 120) = 5
bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, 
value_size=32, max_entries=1, map_flags=0, inner_map_fd=0, map_name="", 
map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 120) = 
5
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=5, 
insns=0x7ffcaedfd490, license="GPL", log_level=0, log_size=0, 
log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, 
prog_name="", prog_ifindex=0, 
expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, 
func_info_rec_size=0, func_info=NULL, func_info_cnt=0, 
line_info_rec_size=0, line_info=NULL, line_info_cnt=0}, 120) = 6
bpf(BPF_BTF_LOAD, 
{btf="\237\353\1\0\30\0\0\0\0\0\0\0000\0\0\0000\0\0\0\t\0\0\0\1\0\0\0\0\0\0\1"..., 
btf_log_buf=NULL, btf_size=81, btf_log_size=0, btf_log_level=0}, 120) = 
5
bpf(BPF_BTF_LOAD, 
{btf="\237\353\1\0\30\0\0\0\0\0\0\08\0\0\08\0\0\0\t\0\0\0\0\0\0\0\0\0\0\1"..., 
btf_log_buf=NULL, btf_size=89, btf_log_size=0, btf_log_level=0}, 120) = 
5
bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, 
value_size=4, max_entries=1, map_flags=0x400 /* BPF_F_??? */, 
inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=0, btf_key_type_id=0, 
btf_value_type_id=0}, 120) = -1 EPERM (Operation not permitted)
bpf(BPF_BTF_LOAD, 
{btf="\237\353\1\0\30\0\0\0\0\0\0\0`\1\0\0`\1\0\0\236\0\0\0\0\0\0\0\0\0\0\3"..., 
btf_log_buf=NULL, btf_size=534, btf_log_size=0, btf_log_level=0}, 120) = 
5
bpf(BPF_OBJ_GET_INFO_BY_FD, {info={bpf_fd=3, info_len=208, 
info=0x7ffcaedfd4a0}}, 120) = 0
bpf(BPF_OBJ_GET_INFO_BY_FD, {info={bpf_fd=3, info_len=208, 
info=0x2018c30}}, 120) = 0
bpf(BPF_BTF_GET_FD_BY_ID, {btf_id=3}, 120) = 4
bpf(BPF_OBJ_GET_INFO_BY_FD, {info={bpf_fd=4, info_len=16, 
info=0x7ffcaedfd5a0}}, 120) = 0
libbpf: Cannot find bpf_func_info for main program sec 
fexit/xdp_prog_simple. Ignore all bpf_func_info.
bpf(BPF_PROG_LOAD, {prog_type=0x1a /* BPF_PROG_TYPE_??? */, insn_cnt=30, 
insns=0x20191f0, license="GPL", log_level=7, log_size=16777215, 
log_buf="", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, 
prog_name="trace_on_exit", prog_ifindex=0, expected_attach_type=0x19 /* 
BPF_??? */, prog_btf_fd=5, func_info_rec_size=0, func_info=NULL, 
func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, 
...}, 120) = -1 EPERM (Operation not permitted)
libbpf: load bpf program failed: Operation not permitted
libbpf: failed to load program 'fexit/xdp_prog_simple'
libbpf: failed to load object './xdp_sample_fentry_fexit_kern.o'
ERROR: Failed to load object file: Operation not permitted
+++ exited with 0 +++

And with full libbpf print debugging:

libbpf: loading ./xdp_sample_fentry_fexit_kern.o
libbpf: section(1) .strtab, size 250, link 0, flags 0, type=3
libbpf: skip section(1) .strtab
libbpf: section(2) .text, size 0, link 0, flags 6, type=1
libbpf: skip section(2) .text
libbpf: section(3) fexit/xdp_prog_simple, size 240, link 0, flags 6, 
type=1
libbpf: found program fexit/xdp_prog_simple
libbpf: section(4) license, size 4, link 0, flags 3, type=1
libbpf: license of ./xdp_sample_fentry_fexit_kern.o is GPL
libbpf: section(5) .rodata.str1.1, size 52, link 0, flags 32, type=1
libbpf: skip section(5) .rodata.str1.1
libbpf: section(6) .debug_str, size 344, link 0, flags 30, type=1
libbpf: skip section(6) .debug_str
libbpf: section(7) .debug_loc, size 70, link 0, flags 0, type=1
libbpf: skip section(7) .debug_loc
libbpf: section(8) .debug_abbrev, size 297, link 0, flags 0, type=1
libbpf: skip section(8) .debug_abbrev
libbpf: section(9) .debug_info, size 403, link 0, flags 0, type=1
libbpf: skip section(9) .debug_info
libbpf: section(10) .rel.debug_info, size 528, link 21, flags 0, type=9
libbpf: skip relo .rel.debug_info(10) for section(9)
libbpf: section(11) .debug_ranges, size 96, link 0, flags 0, type=1
libbpf: skip section(11) .debug_ranges
libbpf: section(12) .debug_macinfo, size 1, link 0, flags 0, type=1
libbpf: skip section(12) .debug_macinfo
libbpf: section(13) .BTF, size 534, link 0, flags 0, type=1
libbpf: section(14) .rel.BTF, size 16, link 21, flags 0, type=9
libbpf: skip relo .rel.BTF(14) for section(13)
libbpf: section(15) .BTF.ext, size 152, link 0, flags 0, type=1
libbpf: section(16) .rel.BTF.ext, size 96, link 21, flags 0, type=9
libbpf: skip relo .rel.BTF.ext(16) for section(15)
libbpf: section(17) .debug_frame, size 40, link 0, flags 0, type=1
libbpf: skip section(17) .debug_frame
libbpf: section(18) .rel.debug_frame, size 32, link 21, flags 0, type=9
libbpf: skip relo .rel.debug_frame(18) for section(17)
libbpf: section(19) .debug_line, size 206, link 0, flags 0, type=1
libbpf: skip section(19) .debug_line
libbpf: section(20) .rel.debug_line, size 16, link 21, flags 0, type=9
libbpf: skip relo .rel.debug_line(20) for section(19)
libbpf: section(21) .symtab, size 792, link 1, flags 0, type=2
libbpf: Cannot find bpf_func_info for main program sec 
fexit/xdp_prog_simple. Ignore all bpf_func_info.
libbpf: load bpf program failed: Operation not permitted
libbpf: failed to load program 'fexit/xdp_prog_simple'
libbpf: failed to load object './xdp_sample_fentry_fexit_kern.o'
ERROR: Failed to load object file: Operation not permitted

I’m using the latest pahole, but standard llvm 9.0.0 from Fedora.

So I decided to at least run the self-test and see if this passes, and 
work my way from there.
But it’s failing to build with errors like “use of unknown builtin 
'__builtin_preserve_field_info’”, so I’m assuming my clang9 needs 
upgrading…

I quickly tried doing this while working on other stuff, but I failed to 
multitask, so will continue with this next week.

Any ideas are welcome…

Cheers,


Eelco


  reply	other threads:[~2019-11-29 16:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E53E0693-1C3A-4B47-B205-DC8E5DAF3619@redhat.com>
2019-11-28 18:18 ` Trying the bpf trace a bpf xdp program Alexei Starovoitov
2019-11-28 19:16   ` Eelco Chaudron
2019-11-28 19:47     ` Alexei Starovoitov
2019-11-29 16:30       ` Eelco Chaudron [this message]
2019-11-29 16:52         ` Yonghong Song
2019-12-02 16:34           ` Eelco Chaudron
2019-12-02 16:48             ` Yonghong Song
2019-12-04 13:19               ` Eelco Chaudron
2019-12-04 14:58                 ` Yonghong Song
2019-12-04 18:01                   ` Yonghong Song
2019-12-04 18:52                     ` Eelco Chaudron
2019-12-05 12:40                       ` Eelco Chaudron
2019-12-05 17:35                         ` Y Song
2019-12-06 13:04                           ` Eelco Chaudron
2019-12-07 16:51                             ` Alexei Starovoitov
2019-12-19 11:06                               ` Eelco Chaudron
2019-12-04 16:31                 ` Andrii Nakryiko
2019-12-04 18:03                   ` John Fastabend
2019-12-04 21:19                     ` Andrii Nakryiko

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=4BBF99E4-9554-44F7-8505-D4B8416554C4@redhat.com \
    --to=echaudro@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=xdp-newbies@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).