Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
scsullivan12 opened this issue Jul 24, 2024 · 3 comments
Open

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

scsullivan12 opened this issue Jul 24, 2024 · 3 comments

Comments

@scsullivan12
Copy link

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.

@brb
Copy link
Member

brb commented Jul 25, 2024

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.

@scsullivan12
Copy link
Author

scsullivan12 commented Oct 24, 2024 via email

@brb
Copy link
Member

brb commented Oct 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants