Skip to content
New issue

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

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

Already on GitHub? # to your account

Tcprtt fails verification when given an address #5090

Open
e-dant opened this issue Aug 24, 2024 · 5 comments
Open

Tcprtt fails verification when given an address #5090

e-dant opened this issue Aug 24, 2024 · 5 comments

Comments

@e-dant
Copy link

e-dant commented Aug 24, 2024

$ tcprtt -a 192.168.1.1
libbpf: prog 'tcp_rcv': BPF program load failed: Permission denied
libbpf: prog 'tcp_rcv': -- BEGIN PROG LOAD LOG --
reg type unsupported for arg#0 function tcp_rcv#20
0: R1=ctx(off=0,imm=0) R10=fp0
; int BPF_PROG(tcp_rcv, struct sock *sk)
0: (79) r6 = *(u64 *)(r1 +0)
func 'tcp_rcv_established' arg0 has btf_id 806 type STRUCT 'sock'
1: R1=ctx(off=0,imm=0) R6_w=ptr_sock(off=0,imm=0)
; if (targ_sport && targ_sport != inet->inet_sport)
1: (18) r1 = 0xffffaa7640163004       ; R1_w=map_value(off=4,ks=4,vs=17,imm=0)
3: (69) r2 = *(u16 *)(r1 +0)          ; R1_w=map_value(off=4,ks=4,vs=17,imm=0) R2_w=0
; if (targ_sport && targ_sport != inet->inet_sport)
4: (15) if r2 == 0x0 goto pc+3        ; R2_w=0
; if (targ_dport && targ_dport != sk->__sk_common.skc_dport)
8: (18) r1 = 0xffffaa7640163006       ; R1_w=map_value(off=6,ks=4,vs=17,imm=0)
10: (69) r2 = *(u16 *)(r1 +0)         ; R1_w=map_value(off=6,ks=4,vs=17,imm=0) R2_w=0
; if (targ_dport && targ_dport != sk->__sk_common.skc_dport)
11: (15) if r2 == 0x0 goto pc+3       ; R2_w=0
; if (targ_saddr && targ_saddr != inet->inet_saddr)
15: (18) r1 = 0xffffaa7640163008      ; R1_w=map_value(off=8,ks=4,vs=17,imm=0)
17: (61) r2 = *(u32 *)(r1 +0)         ; R1_w=map_value(off=8,ks=4,vs=17,imm=0) R2_w=16885952
; if (targ_saddr && targ_saddr != inet->inet_saddr)
18: (15) if r2 == 0x0 goto pc+3       ; R2_w=16885952
; if (targ_saddr && targ_saddr != inet->inet_saddr)
19: (61) r1 = *(u32 *)(r1 +0)         ; R1_w=16885952
; if (targ_saddr && targ_saddr != inet->inet_saddr)
20: (61) r2 = *(u32 *)(r6 +784)
access beyond struct sock at off 784 size 4
processed 12 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1
-- END PROG LOAD LOG --
libbpf: prog 'tcp_rcv': failed to load: -13
libbpf: failed to load object 'tcprtt_bpf'
libbpf: failed to load BPF skeleton 'tcprtt_bpf': -13
failed to load BPF object: -13
@e-dant e-dant changed the title Tcprtt tool fails verification when given an address Tcprtt fails verification when given an address Aug 24, 2024
@ZhangYet
Copy link
Contributor

Could you provide the kernel, os, and the bcc version?

@e-dant
Copy link
Author

e-dant commented Aug 26, 2024

libbpf-tools version: Version: 0.26.0+ds-1 (via apt)

$ uname -v    
#1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15)

Stuff from os-release

NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"

@yonghong-song
Copy link
Collaborator

The error message:
access beyond struct sock at off 784 size 4

Are you using correct header files for bcc?

@e-dant
Copy link
Author

e-dant commented Sep 4, 2024

I'm not sure which headers are being used. They're from whatever Debian is packaging -- I didn't compile this program

If time allows I can see if things work as expected after compiling from source here

@e-dant
Copy link
Author

e-dant commented Sep 4, 2024

The current master branch doesn't have this issue (git pull && cd libbpf-tools && make && sudo ./tcprtt -a 192.168.1.1 works ok)

Is this a Debian packaging issue?

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

No branches or pull requests

3 participants