From: "Eelco Chaudron" <echaudro@redhat.com>
To: Alexei Starovoitov <ast@kernel.org>, Xdp <xdp-newbies@vger.kernel.org>
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: fentry/fexit trace to BPF_PROG_TYPE_EXT BPF program not working
Date: Wed, 29 Apr 2020 13:51:15 +0200 [thread overview]
Message-ID: <666CF27B-18B4-420B-A0FC-29947DB1682D@redhat.com> (raw)
Hi Alexie at al.
I was trying to attach a fentry/fexit trace to BPF_PROG_TYPE_EXT BPF
program but I'm getting a verifier error, and not sure why. Is this
supported?
This is the error:
libbpf: -- BEGIN DUMP LOG ---
libbpf:
arg#0 type is not a struct
Unrecognized arg#0 type PTR
; int BPF_PROG(trace_on_entry, struct xdp_md *xdp)
0: (79) r1 = *(u64 *)(r1 +0)
invalid bpf_context access off=0 size=8
processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0
peak_states 0 mark_read 0
libbpf: -- END LOG --
This is the actual fentry code using the BPF_PROG macro from
tools/lib/bpf/bpf_tracing.h:
SEC("fentry/func")
int BPF_PROG(trace_on_entry, struct xdp_md *xdp)
{
trace_to_perf_buffer(xdp, false, 0);
return 0;
}
And some more details from bpftool on the program I try to attach to:
# bpftool prog show id 165
165: ext name xdp_test_I tag b5a46c6e9935298c gpl
loaded_at 2020-04-28T13:41:00+0000 uid 0
xlated 136B jited 108B memlock 4096B
btf_id 432
# bpftool prog dump xlated id 165
int xdp_test_I(struct xdp_md * ctx):
; int xdp_test_I(struct xdp_md *ctx)
0: (b7) r2 = 10
; bpf_debug("PASS[1]: prog %u\n", ctx->ingress_ifindex);
1: (6b) *(u16 *)(r10 -8) = r2
2: (18) r2 = 0x752520676f727020
4: (7b) *(u64 *)(r10 -16) = r2
5: (18) r2 = 0x3a5d315b53534150
7: (7b) *(u64 *)(r10 -24) = r2
8: (79) r3 = *(u64 *)(r1 +40)
9: (79) r3 = *(u64 *)(r3 +0)
10: (61) r3 = *(u32 *)(r3 +256)
11: (bf) r1 = r10
;
12: (07) r1 += -24
; bpf_debug("PASS[1]: prog %u\n", ctx->ingress_ifindex);
13: (b7) r2 = 18
14: (85) call bpf_trace_printk#-54752
; return XDP_PASS;
15: (b7) r0 = 2
16: (95) exit
Thanks in advance...
//Eelco
next reply other threads:[~2020-04-29 11:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 11:51 Eelco Chaudron [this message]
2020-05-06 1:45 ` fentry/fexit trace to BPF_PROG_TYPE_EXT BPF program not working Alexei Starovoitov
2020-05-13 14:58 ` Eelco Chaudron
2020-05-14 11:56 ` Eelco Chaudron
2020-05-27 16:54 ` Eelco Chaudron
2020-05-28 9:10 ` Eelco Chaudron
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=666CF27B-18B4-420B-A0FC-29947DB1682D@redhat.com \
--to=echaudro@redhat.com \
--cc=ast@kernel.org \
--cc=toke@redhat.com \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).