All of lore.kernel.org
 help / color / mirror / Atom feed
* fentry/fexit trace to BPF_PROG_TYPE_EXT BPF program not working
@ 2020-04-29 11:51 Eelco Chaudron
  2020-05-06  1:45 ` Alexei Starovoitov
  0 siblings, 1 reply; 6+ messages in thread
From: Eelco Chaudron @ 2020-04-29 11:51 UTC (permalink / raw)
  To: Alexei Starovoitov, Xdp; +Cc: Toke Høiland-Jørgensen

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-28  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 11:51 fentry/fexit trace to BPF_PROG_TYPE_EXT BPF program not working Eelco Chaudron
2020-05-06  1:45 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.