pwru icon indicating copy to clipboard operation
pwru copied to clipboard

--filter-trace-tc not working with p4-ebpf program

Open scsullivan12 opened this issue 1 year ago • 3 comments
trafficstars

See below error when trying to run pwru with a p4-ebpf program.

root@nikss-vm-5:~# pwru --filter-trace-tc 'dst host 10.0.1.21' --output-meta –output-tuple
2024/07/23 22:55:26 Attaching tc-bpf progs...
2024/07/23 22:55:26 failed to trace TC progs: failed to trace bpf progs: failed to load objects: Verifier error: load program: permission denied:
        func#0 @0
        func#1 @50
        func#2 @1034
        func#3 @1115
        R1 type=ctx expected=fp
        0: R1=ctx(id=0,off=0,imm=0) R10=fp0
        ; int BPF_PROG(fentry_tc, struct sk_buff *skb) {
        0: (bf) r2 = r1
        1: R1=ctx(id=0,off=0,imm=0) R2_w=ctx(id=0,off=0,imm=0) R10=fp0
        ; int BPF_PROG(fentry_tc, struct sk_buff *skb) {
        1: (79) r6 = *(u64 *)(r2 +0)
        func 'map_initializer' doesn't have 1-th argument
        invalid bpf_context access off=0 size=8
        processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

program fentry_tc: load program: permission denied: func 'map_initializer' doesn't have 1-th argument: invalid bpf_context access off=0 size=8 (12 line(s) omitted)
root@nikss-vm-2:/home/ubuntu/scripts# uname -a
Linux nikss-vm-2 5.4.0-177-generic #197-Ubuntu SMP Thu Mar 28 22:45:47 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I brought this up a while back with the p4lang folks - issue here. There is an brief explanation of what map_initializer does, which will likely be helpful.

scsullivan12 avatar Jul 24 '24 00:07 scsullivan12

Thanks for the issue. To fix this, before loading we could inspect target BPF prog's BTF to see whether the first param is sk_buff/xdp_buff.

brb avatar Jul 25 '24 09:07 brb

Revisiting this issue. Are there plans to implement your proposed solution or evaluate other options?

On Thu, Jul 25, 2024 at 2:42 AM Martynas Pumputis @.***> wrote:

Thanks for the issue. To fix this, before loading we could inspect target BPF prog's BTF to see whether the first param is sk_buff/xdp_buff.

— Reply to this email directly, view it on GitHub https://github.com/cilium/pwru/issues/404#issuecomment-2249913943, or unsubscribe https://github.com/notifications/unsubscribe-auth/BE3ZCYLD32EEP45WPVCAMOTZODB7ZAVCNFSM6AAAAABLLNAUB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZHEYTGOJUGM . You are receiving this because you authored the thread.Message ID: @.***>

scsullivan12 avatar Oct 24 '24 17:10 scsullivan12

Unfortunately, at the moment I am short with cycles, but I am happy to help anyone who wants to implement it.

brb avatar Oct 25 '24 04:10 brb