Open jeromemarchand opened 4 years ago
The following patch fixes the issue:
From 80e1c1365c38d3a99c5f88793443771233b3228b Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Thu, 19 Mar 2020 14:40:15 +0100
Subject: [PATCH] tools: fix alignment of ipv6_key_t in tcptop
Fixes the following error on aarch64:
bpf: Failed to load program: Permission denied
; struct sock *sk = ctx->regs[0]; int copied = ctx->regs[1];
0: (79) r8 = *(u64 *)(r1 +8)
...
; struct ipv6_key_t ipv6_key = {.pid = pid};
79: (63) *(u32 *)(r10 -48) = r7
; struct ipv6_key_t ipv6_key = {.pid = pid};
80: (7b) *(u64 *)(r10 +8) = r9
invalid stack off=8 size=8
processed 96 insns (limit 1000000) max_states_per_insn 0 total_states 7 peak_states 7 mark_read 4
---
tools/tcptop.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/tcptop.py b/tools/tcptop.py
index 2d4b7572..43fe8382 100755
--- a/tools/tcptop.py
+++ b/tools/tcptop.py
@@ -88,9 +88,9 @@ BPF_HASH(ipv4_send_bytes, struct ipv4_key_t);
BPF_HASH(ipv4_recv_bytes, struct ipv4_key_t);
struct ipv6_key_t {
- u32 pid;
unsigned __int128 saddr;
unsigned __int128 daddr;
+ u32 pid;
u16 lport;
u16 dport;
};
--
2.25.1
The code
80: (7b) *(u64 *)(r10 +8) = r9
invalid stack off=8 size=8
does not sound right. Looks like a compiler issue. We cannot have a positive offset for the frame pointer.
Which clang version you are using? Can you tried a recent compiler (e.g., clang10) to see whether it fixed the problem or not?
The code you proposed will have less awkward padding. But the root cause is the compiler generated bad code for it. On my system, I am using clang10 on x64 and code generated is sane.
It's clang v9.0.1. The same clang version works on x86_64. I'll try to compile it it with a more recent clang version.
arch64:
bpf: Failed to load program: Permission denied
; struct sock *sk = ctx->regs[0]; int copied = ctx->regs[1];
0: (79) r8 = *(u64 *)(r1 +8)
; struct sock *sk = ctx->regs[0]; int copied = ctx->regs[1];
1: (79) r6 = *(u64 *)(r1 +0)
; u32 pid = bpf_get_current_pid_tgid() >> 32;
2: (85) call bpf_get_current_pid_tgid#14
3: (bf) r7 = r0
4: (b7) r1 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
5: (6b) *(u16 *)(r10 -48) = r1
last_idx 5 first_idx 0
regs=2 stack=0 before 4: (b7) r1 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
6: (bf) r3 = r6
7: (07) r3 += 16
8: (bf) r1 = r10
;
9: (07) r1 += -48
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
10: (b7) r2 = 2
11: (85) call bpf_probe_read#4
last_idx 11 first_idx 0
regs=4 stack=0 before 10: (b7) r2 = 2
; struct sock *sk = ctx->regs[0]; int copied = ctx->regs[1];
12: (bf) r1 = r8
13: (67) r1 <<= 32
14: (c7) r1 s>>= 32
15: (b7) r2 = 1
; if (copied <= 0)
16: (6d) if r2 s> r1 goto pc+145
R0=inv(id=0) R1_w=inv(id=0,umin_value=1,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R2_w=inv1 R6=inv(id=0) R7=inv(id=0) R8=inv(id=0) R10=fp0 fp-48=??????mm
;
17: (77) r7 >>= 32
18: (69) r1 = *(u16 *)(r10 -48)
; if (family == AF_INET) {
19: (15) if r1 == 0xa goto pc+57
R0=inv(id=0) R1_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm
20: (55) if r1 != 0x2 goto pc+141
R0=inv(id=0) R1=inv2 R2=inv1 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm
21: (b7) r1 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
22: (63) *(u32 *)(r10 -48) = r1
last_idx 22 first_idx 20
regs=2 stack=0 before 21: (b7) r1 = 0
23: (b7) r9 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
24: (bf) r3 = r6
25: (07) r3 += 4
26: (bf) r1 = r10
;
27: (07) r1 += -48
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
28: (b7) r2 = 4
29: (85) call bpf_probe_read#4
last_idx 29 first_idx 20
regs=4 stack=0 before 28: (b7) r2 = 4
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
30: (61) r1 = *(u32 *)(r10 -48)
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
31: (7b) *(u64 *)(r10 -112) = r1
32: (63) *(u32 *)(r10 -48) = r9
last_idx 32 first_idx 30
regs=200 stack=0 before 31: (7b) *(u64 *)(r10 -112) = r1
regs=200 stack=0 before 30: (61) r1 = *(u32 *)(r10 -48)
R0_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9_rw=invP0 R10=fp0 fp-48_r=????mmmm
parent didn't have regs=200 stack=0 marks
last_idx 29 first_idx 20
regs=200 stack=0 before 29: (85) call bpf_probe_read#4
regs=200 stack=0 before 28: (b7) r2 = 4
regs=200 stack=0 before 27: (07) r1 += -48
regs=200 stack=0 before 26: (bf) r1 = r10
regs=200 stack=0 before 25: (07) r3 += 4
regs=200 stack=0 before 24: (bf) r3 = r6
regs=200 stack=0 before 23: (b7) r9 = 0
33: (bf) r1 = r10
;
34: (07) r1 += -48
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
35: (b7) r2 = 4
36: (bf) r3 = r6
37: (85) call bpf_probe_read#4
last_idx 37 first_idx 30
regs=4 stack=0 before 36: (bf) r3 = r6
regs=4 stack=0 before 35: (b7) r2 = 4
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
38: (61) r1 = *(u32 *)(r10 -48)
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
39: (7b) *(u64 *)(r10 -120) = r1
40: (6b) *(u16 *)(r10 -48) = r9
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
41: (bf) r3 = r6
42: (07) r3 += 14
43: (bf) r1 = r10
;
44: (07) r1 += -48
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
45: (b7) r2 = 2
46: (85) call bpf_probe_read#4
last_idx 46 first_idx 30
regs=4 stack=0 before 45: (b7) r2 = 2
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
47: (69) r9 = *(u16 *)(r10 -48)
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
48: (b7) r1 = 0
49: (6b) *(u16 *)(r10 -48) = r1
last_idx 49 first_idx 47
regs=2 stack=0 before 48: (b7) r1 = 0
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
50: (07) r6 += 12
51: (bf) r1 = r10
;
52: (07) r1 += -48
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
53: (b7) r2 = 2
54: (bf) r3 = r6
55: (85) call bpf_probe_read#4
last_idx 55 first_idx 47
regs=4 stack=0 before 54: (bf) r3 = r6
regs=4 stack=0 before 53: (b7) r2 = 2
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
56: (69) r1 = *(u16 *)(r10 -48)
; ipv4_key.dport = ntohs(dport);
57: (dc) r1 = be16 r1
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
58: (6b) *(u16 *)(r10 -34) = r1
59: (6b) *(u16 *)(r10 -36) = r9
60: (79) r1 = *(u64 *)(r10 -120)
61: (63) *(u32 *)(r10 -40) = r1
62: (79) r1 = *(u64 *)(r10 -112)
63: (63) *(u32 *)(r10 -44) = r1
64: (63) *(u32 *)(r10 -48) = r7
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
65: (18) r1 = 0xffffd26eed293400
67: (bf) r2 = r10
;
68: (07) r2 += -48
; return bpf_map_lookup_elem((void *)map, key);
69: (85) call bpf_map_lookup_elem#1
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
70: (15) if r0 == 0x0 goto pc+70
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm
;
71: (67) r8 <<= 32
72: (c7) r8 s>>= 32
73: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm
74: (0f) r1 += r8
75: (7b) *(u64 *)(r0 +0) = r1
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R1_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm
76: (05) goto pc+85
; }
162: (b7) r0 = 0
163: (95) exit
from 70 to 141: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
141: (67) r8 <<= 32
142: (c7) r8 s>>= 32
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
143: (7b) *(u64 *)(r10 -96) = r8
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
144: (18) r1 = 0xffffd26eed293400
146: (bf) r2 = r10
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
147: (07) r2 += -48
148: (bf) r3 = r10
149: (07) r3 += -96
150: (05) goto pc+9
;
160: (b7) r4 = 1
161: (85) call bpf_map_update_elem#2
; }
162: (b7) r0 = 0
163: (95) exit
from 20 to 162: safe
from 19 to 77: R0=inv(id=0) R1_w=inv10 R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm
;
77: (b7) r9 = 0
; struct ipv6_key_t ipv6_key = {.pid = pid};
78: (7b) *(u64 *)(r10 -48) = r9
last_idx 78 first_idx 12
regs=200 stack=0 before 77: (b7) r9 = 0
; struct ipv6_key_t ipv6_key = {.pid = pid};
79: (63) *(u32 *)(r10 -48) = r7
; struct ipv6_key_t ipv6_key = {.pid = pid};
80: (7b) *(u64 *)(r10 +8) = r9
invalid stack off=8 size=8
processed 96 insns (limit 1000000) max_states_per_insn 0 total_states 7 peak_states 7 mark_read 4
Traceback (most recent call last):
File "/usr/share/bcc/tools/tcptop", line 230, in <module>
b = BPF(text=bpf_text)
File "/usr/lib/python3.8/site-packages/bcc/__init__.py", line 364, in __init__
self._trace_autoload()
File "/usr/lib/python3.8/site-packages/bcc/__init__.py", line 1178, in _trace_autoload
fn = self.load_func(func_name, BPF.KPROBE)
File "/usr/lib/python3.8/site-packages/bcc/__init__.py", line 403, in load_func
raise Exception("Failed to load BPF program %s: %s" %
Exception: Failed to load BPF program b'kprobe__tcp_cleanup_rbuf': Permission denied
x86_64:
; struct sock *sk = ctx->di; int copied = ctx->si;
0: (79) r8 = *(u64 *)(r1 +104)
; struct sock *sk = ctx->di; int copied = ctx->si;
1: (79) r6 = *(u64 *)(r1 +112)
; u32 pid = bpf_get_current_pid_tgid() >> 32;
2: (85) call bpf_get_current_pid_tgid#14
3: (bf) r7 = r0
4: (b7) r1 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
5: (6b) *(u16 *)(r10 -64) = r1
last_idx 5 first_idx 0
regs=2 stack=0 before 4: (b7) r1 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
6: (bf) r3 = r6
7: (07) r3 += 16
8: (bf) r1 = r10
;
9: (07) r1 += -64
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
10: (b7) r2 = 2
11: (85) call bpf_probe_read#4
last_idx 11 first_idx 0
regs=4 stack=0 before 10: (b7) r2 = 2
; struct sock *sk = ctx->di; int copied = ctx->si;
12: (bf) r1 = r8
13: (67) r1 <<= 32
14: (c7) r1 s>>= 32
15: (b7) r2 = 1
; if (copied <= 0)
16: (6d) if r2 s> r1 goto pc+145
R0=inv(id=0) R1_w=inv(id=0,umin_value=1,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R2_w=inv1 R6=inv(id=0) R7=inv(id=0) R8=inv(id=0) R10=fp0 fp-64=??????mm
;
17: (77) r7 >>= 32
18: (69) r1 = *(u16 *)(r10 -64)
; if (family == AF_INET) {
19: (15) if r1 == 0xa goto pc+57
R0=inv(id=0) R1_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-64=??????mm
20: (55) if r1 != 0x2 goto pc+141
R0=inv(id=0) R1=inv2 R2=inv1 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-64=??????mm
21: (b7) r1 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
22: (63) *(u32 *)(r10 -64) = r1
last_idx 22 first_idx 20
regs=2 stack=0 before 21: (b7) r1 = 0
23: (b7) r9 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
24: (bf) r3 = r6
25: (07) r3 += 4
26: (bf) r1 = r10
;
27: (07) r1 += -64
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
28: (b7) r2 = 4
29: (85) call bpf_probe_read#4
last_idx 29 first_idx 20
regs=4 stack=0 before 28: (b7) r2 = 4
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
30: (61) r1 = *(u32 *)(r10 -64)
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
31: (7b) *(u64 *)(r10 -144) = r1
32: (63) *(u32 *)(r10 -64) = r9
last_idx 32 first_idx 30
regs=200 stack=0 before 31: (7b) *(u64 *)(r10 -144) = r1
regs=200 stack=0 before 30: (61) r1 = *(u32 *)(r10 -64)
R0_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9_rw=invP0 R10=fp0 fp-64_r=????mmmm
parent didn't have regs=200 stack=0 marks
last_idx 29 first_idx 20
regs=200 stack=0 before 29: (85) call bpf_probe_read#4
regs=200 stack=0 before 28: (b7) r2 = 4
regs=200 stack=0 before 27: (07) r1 += -64
regs=200 stack=0 before 26: (bf) r1 = r10
regs=200 stack=0 before 25: (07) r3 += 4
regs=200 stack=0 before 24: (bf) r3 = r6
regs=200 stack=0 before 23: (b7) r9 = 0
33: (bf) r1 = r10
;
34: (07) r1 += -64
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
35: (b7) r2 = 4
36: (bf) r3 = r6
37: (85) call bpf_probe_read#4
last_idx 37 first_idx 30
regs=4 stack=0 before 36: (bf) r3 = r6
regs=4 stack=0 before 35: (b7) r2 = 4
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
38: (61) r1 = *(u32 *)(r10 -64)
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
39: (7b) *(u64 *)(r10 -152) = r1
40: (6b) *(u16 *)(r10 -64) = r9
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
41: (bf) r3 = r6
42: (07) r3 += 14
43: (bf) r1 = r10
;
44: (07) r1 += -64
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
45: (b7) r2 = 2
46: (85) call bpf_probe_read#4
last_idx 46 first_idx 30
regs=4 stack=0 before 45: (b7) r2 = 2
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
47: (69) r9 = *(u16 *)(r10 -64)
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
48: (b7) r1 = 0
49: (6b) *(u16 *)(r10 -64) = r1
last_idx 49 first_idx 47
regs=2 stack=0 before 48: (b7) r1 = 0
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
50: (07) r6 += 12
51: (bf) r1 = r10
;
52: (07) r1 += -64
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
53: (b7) r2 = 2
54: (bf) r3 = r6
55: (85) call bpf_probe_read#4
last_idx 55 first_idx 47
regs=4 stack=0 before 54: (bf) r3 = r6
regs=4 stack=0 before 53: (b7) r2 = 2
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
56: (69) r1 = *(u16 *)(r10 -64)
; ipv4_key.dport = ntohs(dport);
57: (dc) r1 = be16 r1
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
58: (6b) *(u16 *)(r10 -50) = r1
59: (6b) *(u16 *)(r10 -52) = r9
60: (79) r1 = *(u64 *)(r10 -152)
61: (63) *(u32 *)(r10 -56) = r1
62: (79) r1 = *(u64 *)(r10 -144)
63: (63) *(u32 *)(r10 -60) = r1
64: (63) *(u32 *)(r10 -64) = r7
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
65: (18) r1 = 0xffff9b2c6c53e000
67: (bf) r2 = r10
;
68: (07) r2 += -64
; return bpf_map_lookup_elem((void *)map, key);
69: (85) call bpf_map_lookup_elem#1
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
70: (15) if r0 == 0x0 goto pc+70
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm
;
71: (67) r8 <<= 32
72: (c7) r8 s>>= 32
73: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm
74: (0f) r1 += r8
75: (7b) *(u64 *)(r0 +0) = r1
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R1_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm
76: (05) goto pc+85
; }
162: (b7) r0 = 0
163: (95) exit
from 70 to 141: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
141: (67) r8 <<= 32
142: (c7) r8 s>>= 32
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
143: (7b) *(u64 *)(r10 -128) = r8
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
144: (18) r1 = 0xffff9b2c6c53e000
146: (bf) r2 = r10
; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } });
147: (07) r2 += -64
148: (bf) r3 = r10
149: (07) r3 += -128
150: (05) goto pc+9
;
160: (b7) r4 = 1
161: (85) call bpf_map_update_elem#2
; }
162: (b7) r0 = 0
163: (95) exit
from 20 to 162: safe
from 19 to 77: R0=inv(id=0) R1_w=inv10 R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-64=??????mm
;
77: (b7) r9 = 0
; struct ipv6_key_t ipv6_key = {.pid = pid};
78: (7b) *(u64 *)(r10 -64) = r9
last_idx 78 first_idx 12
regs=200 stack=0 before 77: (b7) r9 = 0
; struct ipv6_key_t ipv6_key = {.pid = pid};
79: (63) *(u32 *)(r10 -64) = r7
; struct ipv6_key_t ipv6_key = {.pid = pid};
80: (7b) *(u64 *)(r10 -8) = r9
81: (7b) *(u64 *)(r10 -16) = r9
82: (7b) *(u64 *)(r10 -24) = r9
83: (7b) *(u64 *)(r10 -32) = r9
84: (7b) *(u64 *)(r10 -40) = r9
85: (7b) *(u64 *)(r10 -48) = r9
86: (7b) *(u64 *)(r10 -56) = r9
; &sk->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32);
87: (bf) r3 = r6
88: (07) r3 += 72
; struct ipv6_key_t ipv6_key = {.pid = pid};
89: (bf) r1 = r10
90: (07) r1 += -48
; bpf_probe_read(&ipv6_key.saddr, sizeof(ipv6_key.saddr),
91: (b7) r2 = 16
92: (85) call bpf_probe_read#4
last_idx 92 first_idx 12
regs=4 stack=0 before 91: (b7) r2 = 16
; &sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32);
93: (bf) r3 = r6
94: (07) r3 += 56
; struct ipv6_key_t ipv6_key = {.pid = pid};
95: (bf) r1 = r10
96: (07) r1 += -32
; bpf_probe_read(&ipv6_key.daddr, sizeof(ipv6_key.daddr),
97: (b7) r2 = 16
98: (85) call bpf_probe_read#4
last_idx 98 first_idx 93
regs=4 stack=0 before 97: (b7) r2 = 16
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
99: (6b) *(u16 *)(r10 -128) = r9
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
100: (bf) r3 = r6
101: (07) r3 += 14
102: (bf) r1 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
103: (07) r1 += -128
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
104: (b7) r2 = 2
105: (85) call bpf_probe_read#4
last_idx 105 first_idx 93
regs=4 stack=0 before 104: (b7) r2 = 2
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
106: (69) r1 = *(u16 *)(r10 -128)
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
107: (6b) *(u16 *)(r10 -16) = r1
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
108: (6b) *(u16 *)(r10 -128) = r9
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
109: (07) r6 += 12
110: (bf) r1 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
111: (07) r1 += -128
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
112: (b7) r2 = 2
113: (bf) r3 = r6
114: (85) call bpf_probe_read#4
last_idx 114 first_idx 106
regs=4 stack=0 before 113: (bf) r3 = r6
regs=4 stack=0 before 112: (b7) r2 = 2
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
115: (69) r1 = *(u16 *)(r10 -128)
; ipv6_key.dport = ntohs(dport);
116: (dc) r1 = be16 r1
; ipv6_key.dport = ntohs(dport);
117: (6b) *(u16 *)(r10 -14) = r1
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
118: (79) r1 = *(u64 *)(r10 -8)
119: (7b) *(u64 *)(r10 -72) = r1
120: (79) r1 = *(u64 *)(r10 -16)
121: (7b) *(u64 *)(r10 -80) = r1
122: (79) r1 = *(u64 *)(r10 -24)
123: (7b) *(u64 *)(r10 -88) = r1
124: (79) r1 = *(u64 *)(r10 -32)
125: (7b) *(u64 *)(r10 -96) = r1
126: (79) r1 = *(u64 *)(r10 -40)
127: (7b) *(u64 *)(r10 -104) = r1
128: (79) r1 = *(u64 *)(r10 -48)
129: (7b) *(u64 *)(r10 -112) = r1
130: (79) r1 = *(u64 *)(r10 -56)
131: (7b) *(u64 *)(r10 -120) = r1
132: (79) r1 = *(u64 *)(r10 -64)
133: (7b) *(u64 *)(r10 -128) = r1
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
134: (18) r1 = 0xffff9b2c6bfffc00
136: (bf) r2 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
137: (07) r2 += -128
; return bpf_map_lookup_elem((void *)map, key);
138: (85) call bpf_map_lookup_elem#1
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
139: (15) if r0 == 0x0 goto pc+11
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
140: (05) goto pc-70
;
71: (67) r8 <<= 32
72: (c7) r8 s>>= 32
73: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
74: (0f) r1 += r8
75: (7b) *(u64 *)(r0 +0) = r1
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R1_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
76: (05) goto pc+85
162: safe
from 139 to 151: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
151: (67) r8 <<= 32
152: (c7) r8 s>>= 32
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
153: (7b) *(u64 *)(r10 -136) = r8
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
154: (18) r1 = 0xffff9b2c6bfffc00
156: (bf) r2 = r10
; ({ typeof(ipv6_recv_bytes.key) _key = ipv6_key; typeof(ipv6_recv_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -4), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv6_recv_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_update_elem_(bpf_pseudo_fd(1, -4), &_key, &_zleaf, BPF_NOEXIST); } });
157: (07) r2 += -128
158: (bf) r3 = r10
159: (07) r3 += -136
;
160: (b7) r4 = 1
161: (85) call bpf_map_update_elem#2
162: safe
from 16 to 162: safe
processed 174 insns (limit 1000000) max_states_per_insn 0 total_states 11 peak_states 11 mark_read 4
; struct sock *sk = ctx->di; struct msghdr *msg = ctx->si; size_t size = ctx->dx;
0: (79) r8 = *(u64 *)(r1 +96)
; struct sock *sk = ctx->di; struct msghdr *msg = ctx->si; size_t size = ctx->dx;
1: (79) r6 = *(u64 *)(r1 +112)
; u32 pid = bpf_get_current_pid_tgid() >> 32;
2: (85) call bpf_get_current_pid_tgid#14
3: (bf) r7 = r0
4: (b7) r9 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
5: (6b) *(u16 *)(r10 -64) = r9
last_idx 5 first_idx 0
regs=200 stack=0 before 4: (b7) r9 = 0
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
6: (bf) r3 = r6
7: (07) r3 += 16
8: (bf) r1 = r10
;
9: (07) r1 += -64
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
10: (b7) r2 = 2
11: (85) call bpf_probe_read#4
last_idx 11 first_idx 0
regs=4 stack=0 before 10: (b7) r2 = 2
; u32 pid = bpf_get_current_pid_tgid() >> 32;
12: (77) r7 >>= 32
; u16 dport = 0, family = ({ typeof(unsigned short) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; });
13: (69) r1 = *(u16 *)(r10 -64)
; if (family == AF_INET) {
14: (15) if r1 == 0xa goto pc+55
R0=inv(id=0) R1_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-64=??????mm
15: (55) if r1 != 0x2 goto pc+138
R0=inv(id=0) R1_w=inv2 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-64=??????mm
16: (7b) *(u64 *)(r10 -144) = r8
17: (b7) r8 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
18: (63) *(u32 *)(r10 -64) = r8
last_idx 18 first_idx 12
regs=100 stack=0 before 17: (b7) r8 = 0
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
19: (bf) r3 = r6
20: (07) r3 += 4
21: (bf) r1 = r10
;
22: (07) r1 += -64
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
23: (b7) r2 = 4
24: (85) call bpf_probe_read#4
last_idx 24 first_idx 12
regs=4 stack=0 before 23: (b7) r2 = 4
; ipv4_key.saddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; });
25: (61) r1 = *(u32 *)(r10 -64)
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
26: (7b) *(u64 *)(r10 -152) = r1
27: (63) *(u32 *)(r10 -64) = r8
28: (bf) r1 = r10
;
29: (07) r1 += -64
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
30: (b7) r2 = 4
31: (bf) r3 = r6
32: (85) call bpf_probe_read#4
last_idx 32 first_idx 25
regs=4 stack=0 before 31: (bf) r3 = r6
regs=4 stack=0 before 30: (b7) r2 = 4
; ipv4_key.daddr = ({ typeof(__be32) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; });
33: (61) r1 = *(u32 *)(r10 -64)
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
34: (7b) *(u64 *)(r10 -160) = r1
35: (6b) *(u16 *)(r10 -64) = r8
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
36: (bf) r3 = r6
37: (07) r3 += 14
38: (bf) r1 = r10
;
39: (07) r1 += -64
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
40: (b7) r2 = 2
41: (85) call bpf_probe_read#4
last_idx 41 first_idx 25
regs=4 stack=0 before 40: (b7) r2 = 2
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
42: (69) r9 = *(u16 *)(r10 -64)
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
43: (6b) *(u16 *)(r10 -64) = r8
; ipv4_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
44: (07) r6 += 12
45: (bf) r1 = r10
;
46: (07) r1 += -64
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
47: (b7) r2 = 2
48: (bf) r3 = r6
49: (85) call bpf_probe_read#4
last_idx 49 first_idx 42
regs=4 stack=0 before 48: (bf) r3 = r6
regs=4 stack=0 before 47: (b7) r2 = 2
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
50: (69) r1 = *(u16 *)(r10 -64)
; ipv4_key.dport = ntohs(dport);
51: (dc) r1 = be16 r1
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
52: (6b) *(u16 *)(r10 -50) = r1
53: (6b) *(u16 *)(r10 -52) = r9
54: (79) r1 = *(u64 *)(r10 -160)
55: (63) *(u32 *)(r10 -56) = r1
56: (79) r1 = *(u64 *)(r10 -152)
57: (63) *(u32 *)(r10 -60) = r1
58: (63) *(u32 *)(r10 -64) = r7
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
59: (18) r1 = 0xffff9b2c2c217000
61: (bf) r2 = r10
;
62: (07) r2 += -64
; return bpf_map_lookup_elem((void *)map, key);
63: (85) call bpf_map_lookup_elem#1
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
64: (15) if r0 == 0x0 goto pc+71
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=invP0 R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm fp-160=mmmmmmmm
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
65: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=invP0 R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm fp-160=mmmmmmmm
66: (79) r2 = *(u64 *)(r10 -144)
67: (0f) r1 += r2
68: (7b) *(u64 *)(r0 +0) = r1
R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R1_w=inv(id=0) R2_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=invP0 R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm fp-160=mmmmmmmm
69: (05) goto pc+84
; return 0;
154: (b7) r0 = 0
155: (95) exit
from 64 to 136: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=invP0 R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-56=mmmmmmmm fp-64=mmmmmmmm fp-144=mmmmmmmm fp-152=mmmmmmmm fp-160=mmmmmmmm
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
136: (79) r1 = *(u64 *)(r10 -144)
137: (7b) *(u64 *)(r10 -128) = r1
; ({ typeof(ipv4_send_bytes.key) _key = ipv4_key; typeof(ipv4_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -1), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv4_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -1), &_key, &_zleaf, BPF_NOEXIST); } });
138: (18) r1 = 0xffff9b2c2c217000
140: (bf) r2 = r10
;
141: (07) r2 += -64
142: (bf) r3 = r10
143: (07) r3 += -128
144: (05) goto pc+7
;
152: (b7) r4 = 1
153: (85) call bpf_map_update_elem#2
; return 0;
154: (b7) r0 = 0
155: (95) exit
from 15 to 154: safe
from 14 to 70: R0=inv(id=0) R1_w=inv10 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-64=??????mm
; struct ipv6_key_t ipv6_key = {.pid = pid};
70: (7b) *(u64 *)(r10 -64) = r9
; struct ipv6_key_t ipv6_key = {.pid = pid};
71: (63) *(u32 *)(r10 -64) = r7
; struct ipv6_key_t ipv6_key = {.pid = pid};
72: (7b) *(u64 *)(r10 -8) = r9
73: (7b) *(u64 *)(r10 -16) = r9
74: (7b) *(u64 *)(r10 -24) = r9
75: (7b) *(u64 *)(r10 -32) = r9
76: (7b) *(u64 *)(r10 -40) = r9
77: (7b) *(u64 *)(r10 -48) = r9
78: (7b) *(u64 *)(r10 -56) = r9
; &sk->__sk_common.skc_v6_rcv_saddr.in6_u.u6_addr32);
79: (bf) r3 = r6
80: (07) r3 += 72
; struct ipv6_key_t ipv6_key = {.pid = pid};
81: (bf) r1 = r10
82: (07) r1 += -48
; bpf_probe_read(&ipv6_key.saddr, sizeof(ipv6_key.saddr),
83: (b7) r2 = 16
84: (85) call bpf_probe_read#4
last_idx 84 first_idx 12
regs=4 stack=0 before 83: (b7) r2 = 16
; &sk->__sk_common.skc_v6_daddr.in6_u.u6_addr32);
85: (bf) r3 = r6
86: (07) r3 += 56
; struct ipv6_key_t ipv6_key = {.pid = pid};
87: (bf) r1 = r10
88: (07) r1 += -32
; bpf_probe_read(&ipv6_key.daddr, sizeof(ipv6_key.daddr),
89: (b7) r2 = 16
90: (85) call bpf_probe_read#4
last_idx 90 first_idx 85
regs=4 stack=0 before 89: (b7) r2 = 16
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
91: (6b) *(u16 *)(r10 -128) = r9
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
92: (bf) r3 = r6
93: (07) r3 += 14
94: (bf) r1 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
95: (07) r1 += -128
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
96: (b7) r2 = 2
97: (85) call bpf_probe_read#4
last_idx 97 first_idx 85
regs=4 stack=0 before 96: (b7) r2 = 2
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
98: (69) r1 = *(u16 *)(r10 -128)
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
99: (6b) *(u16 *)(r10 -16) = r1
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
100: (6b) *(u16 *)(r10 -128) = r9
; ipv6_key.lport = ({ typeof(__u16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; });
101: (07) r6 += 12
102: (bf) r1 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
103: (07) r1 += -128
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
104: (b7) r2 = 2
105: (bf) r3 = r6
106: (85) call bpf_probe_read#4
last_idx 106 first_idx 98
regs=4 stack=0 before 105: (bf) r3 = r6
regs=4 stack=0 before 104: (b7) r2 = 2
; dport = ({ typeof(__be16) _val; __builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; });
107: (69) r1 = *(u16 *)(r10 -128)
; ipv6_key.dport = ntohs(dport);
108: (dc) r1 = be16 r1
; ipv6_key.dport = ntohs(dport);
109: (6b) *(u16 *)(r10 -14) = r1
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
110: (79) r1 = *(u64 *)(r10 -8)
111: (7b) *(u64 *)(r10 -72) = r1
112: (79) r1 = *(u64 *)(r10 -16)
113: (7b) *(u64 *)(r10 -80) = r1
114: (79) r1 = *(u64 *)(r10 -24)
115: (7b) *(u64 *)(r10 -88) = r1
116: (79) r1 = *(u64 *)(r10 -32)
117: (7b) *(u64 *)(r10 -96) = r1
118: (79) r1 = *(u64 *)(r10 -40)
119: (7b) *(u64 *)(r10 -104) = r1
120: (79) r1 = *(u64 *)(r10 -48)
121: (7b) *(u64 *)(r10 -112) = r1
122: (79) r1 = *(u64 *)(r10 -56)
123: (7b) *(u64 *)(r10 -120) = r1
124: (79) r1 = *(u64 *)(r10 -64)
125: (7b) *(u64 *)(r10 -128) = r1
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
126: (18) r1 = 0xffff9b2c6bffcc00
128: (bf) r2 = r10
; struct ipv6_key_t ipv6_key = {.pid = pid};
129: (07) r2 += -128
; return bpf_map_lookup_elem((void *)map, key);
130: (85) call bpf_map_lookup_elem#1
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
131: (15) if r0 == 0x0 goto pc+13
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
132: (79) r1 = *(u64 *)(r0 +0)
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
133: (0f) r1 += r8
134: (7b) *(u64 *)(r0 +0) = r1
R0=map_value(id=0,off=0,ks=64,vs=8,imm=0) R1_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
135: (05) goto pc+18
154: safe
from 131 to 145: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=invP0 R10=fp0 fp-8=00000000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm fp-56=00000000 fp-64=0000mmmm fp-72=mmmmmmmm fp-80=mmmmmmmm fp-88=mmmmmmmm fp-96=mmmmmmmm fp-104=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm fp-128=mmmmmmmm
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
145: (7b) *(u64 *)(r10 -136) = r8
; ({ typeof(ipv6_send_bytes.key) _key = ipv6_key; typeof(ipv6_send_bytes.leaf) *_leaf = bpf_map_lookup_elem_(bpf_pseudo_fd(1, -3), &_key); if (_leaf) (*_leaf) += size;else { typeof(ipv6_send_bytes.leaf) _zleaf; __builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += size;bpf_map_update_elem_(bpf_pseudo_fd(1, -3), &_key, &_zleaf, BPF_NOEXIST); } });
146: (18) r1 = 0xffff9b2c6bffcc00
148: (bf) r2 = r10
;
149: (07) r2 += -128
150: (bf) r3 = r10
151: (07) r3 += -136
;
152: (b7) r4 = 1
153: (85) call bpf_map_update_elem#2
154: safe
processed 159 insns (limit 1000000) max_states_per_insn 0 total_states 10 peak_states 10 mark_read 3
I did some investigation on this problem. The issue is due to x64/bpf vs. aarch64 layout handling difference for i128 integers.
For x64/bpf, i128 alignment is not explicitly specified in layout string hence the llvm/clang assumes i128 aligns at 8 bytes. For a structure like
struct ipv6_key_t {
unsigned pid;
unsigned __int128 saddr;
unsigned short lport;
};
the IR type
%struct.ipv6_key_t = type { i32, [12 x i8], i128, i16, [14 x i8] }
The padding is done to ensure later selectionDAG does not create a different layout.
For aarch64, the layout string
"e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
```,
the i128 has alignment 16 bytes, so the IR type
%struct.ipv6_key_t = type { i32, i128, i16 }
There is no need to do padding since later selectionDAG will achieve the same layout conclusion with clang.
The issue with aarch64 frontend and bpf target as in bcc will cause problem in this case.
aarch64 frontend type
%struct.ipv6_key_t = type { i32, i128, i16 }
The frontend generates code assumes a size 16 * 3 = 48.
But bpf backend, which assumes i128 aligns at 8 bytes will have structure size 32 bytes.
which will cause incorrect result.
Note that for bpf, i128 align at 8 bytes totally fine as bpf does not 128bit instruction.
We need to discuss whether we should fix in bpf or not. The fix will be enforce 16byte alignment in bpf data layout string.
I think your current fix
diff --git a/tools/tcptop.py b/tools/tcptop.py index 2d4b7572..43fe8382 100755 --- a/tools/tcptop.py +++ b/tools/tcptop.py @@ -88,9 +88,9 @@ BPF_HASH(ipv4_send_bytes, struct ipv4_key_t); BPF_HASH(ipv4_recv_bytes, struct ipv4_key_t);
struct ipv6_key_t {
looks good. Could you submit a patch for this? Thanks!
The proposed llvm patch is here https://reviews.llvm.org/D76587
looks good. Could you submit a patch for this? Thanks!
When trying to run tcptop on aarch64, I get the following error:
/usr/share/bcc/tools/tcptop
bpf: Failed to load program: Permission denied ; struct sock sk = ctx->regs[0]; int copied = ctx->regs[1]; 0: (79) r8 = (u64 )(r1 +8) ; struct sock sk = ctx->regs[0]; int copied = ctx->regs[1]; 1: (79) r6 = (u64 )(r1 +0) ; u32 pid = bpf_get_current_pid_tgid() >> 32; 2: (85) call bpf_get_current_pid_tgid#14 3: (bf) r7 = r0 4: (b7) r1 = 0 ; u16 dport = 0, family = ({ typeof(unsigned short) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_family); _val; }); 5: (6b) (u16 )(r10 -48) = r1 last_idx 5 first_idx 0 regs=2 stack=0 before 4: (b7) r1 = 0 ; u16 dport = 0, family = ({ typeof(unsigned short) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_family); _val; }); 6: (bf) r3 = r6 7: (07) r3 += 16 8: (bf) r1 = r10 ; 9: (07) r1 += -48 ; u16 dport = 0, family = ({ typeof(unsigned short) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_family); _val; }); 10: (b7) r2 = 2 11: (85) call bpf_probe_read#4 last_idx 11 first_idx 0 regs=4 stack=0 before 10: (b7) r2 = 2 ; struct sock sk = ctx->regs[0]; int copied = ctx->regs[1]; 12: (bf) r1 = r8 13: (67) r1 <<= 32 14: (c7) r1 s>>= 32 15: (b7) r2 = 1 ; if (copied <= 0) 16: (6d) if r2 s> r1 goto pc+145 R0=inv(id=0) R1_w=inv(id=0,umin_value=1,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R2_w=inv1 R6=inv(id=0) R7=inv(id=0) R8=inv(id=0) R10=fp0 fp-48=??????mm ; 17: (77) r7 >>= 32 18: (69) r1 = (u16 *)(r10 -48) ; if (family == AF_INET) { 19: (15) if r1 == 0xa goto pc+57 R0=inv(id=0) R1_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm 20: (55) if r1 != 0x2 goto pc+141 R0=inv(id=0) R1=inv2 R2=inv1 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm 21: (b7) r1 = 0 ; ipv4_key.saddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; }); 22: (63) (u32 )(r10 -48) = r1 last_idx 22 first_idx 20 regs=2 stack=0 before 21: (b7) r1 = 0 23: (b7) r9 = 0 ; ipv4_key.saddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; }); 24: (bf) r3 = r6 25: (07) r3 += 4 26: (bf) r1 = r10 ; 27: (07) r1 += -48 ; ipv4_key.saddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; }); 28: (b7) r2 = 4 29: (85) call bpf_probe_read#4 last_idx 29 first_idx 20 regs=4 stack=0 before 28: (b7) r2 = 4 ; ipv4_key.saddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_rcv_saddr); _val; }); 30: (61) r1 = (u32 )(r10 -48) ; ipv4_key.daddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_daddr); _val; }); 31: (7b) (u64 )(r10 -112) = r1 32: (63) (u32 )(r10 -48) = r9 last_idx 32 first_idx 30 regs=200 stack=0 before 31: (7b) (u64 )(r10 -112) = r1 regs=200 stack=0 before 30: (61) r1 = (u32 )(r10 -48) R0_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9_rw=invP0 R10=fp0 fp-48_r=????mmmm parent didn't have regs=200 stack=0 marks last_idx 29 first_idx 20 regs=200 stack=0 before 29: (85) call bpf_probe_read#4 regs=200 stack=0 before 28: (b7) r2 = 4 regs=200 stack=0 before 27: (07) r1 += -48 regs=200 stack=0 before 26: (bf) r1 = r10 regs=200 stack=0 before 25: (07) r3 += 4 regs=200 stack=0 before 24: (bf) r3 = r6 regs=200 stack=0 before 23: (b7) r9 = 0 33: (bf) r1 = r10 ; 34: (07) r1 += -48 ; ipv4_key.daddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_daddr); _val; }); 35: (b7) r2 = 4 36: (bf) r3 = r6 37: (85) call bpf_probe_read#4 last_idx 37 first_idx 30 regs=4 stack=0 before 36: (bf) r3 = r6 regs=4 stack=0 before 35: (b7) r2 = 4 ; ipv4_key.daddr = ({ typeof(be32) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_daddr); _val; }); 38: (61) r1 = (u32 )(r10 -48) ; ipv4_key.lport = ({ typeof(u16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_num); _val; }); 39: (7b) (u64 )(r10 -120) = r1 40: (6b) (u16 )(r10 -48) = r9 ; ipv4_key.lport = ({ typeof(u16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_num); _val; }); 41: (bf) r3 = r6 42: (07) r3 += 14 43: (bf) r1 = r10 ; 44: (07) r1 += -48 ; ipv4_key.lport = ({ typeof(u16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_num); _val; }); 45: (b7) r2 = 2 46: (85) call bpf_probe_read#4 last_idx 46 first_idx 30 regs=4 stack=0 before 45: (b7) r2 = 2 ; ipv4_key.lport = ({ typeof(u16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_num); _val; }); 47: (69) r9 = (u16 )(r10 -48) ; dport = ({ typeof(__be16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->sk_common.skc_dport); _val; }); 48: (b7) r1 = 0 49: (6b) (u16 )(r10 -48) = r1 last_idx 49 first_idx 47 regs=2 stack=0 before 48: (b7) r1 = 0 ; ipv4_key.lport = ({ typeof(u16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_num); _val; }); 50: (07) r6 += 12 51: (bf) r1 = r10 ; 52: (07) r1 += -48 ; dport = ({ typeof(be16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; }); 53: (b7) r2 = 2 54: (bf) r3 = r6 55: (85) call bpf_probe_read#4 last_idx 55 first_idx 47 regs=4 stack=0 before 54: (bf) r3 = r6 regs=4 stack=0 before 53: (b7) r2 = 2 ; dport = ({ typeof(be16) _val; builtin_memset(&_val, 0, sizeof(_val)); bpf_probe_read(&_val, sizeof(_val), (u64)&sk->__sk_common.skc_dport); _val; }); 56: (69) r1 = (u16 )(r10 -48) ; ipv4_key.dport = ntohs(dport); 57: (dc) r1 = be16 r1 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 58: (6b) (u16 )(r10 -34) = r1 59: (6b) (u16 )(r10 -36) = r9 60: (79) r1 = (u64 )(r10 -120) 61: (63) (u32 )(r10 -40) = r1 62: (79) r1 = (u64 )(r10 -112) 63: (63) (u32 )(r10 -44) = r1 64: (63) (u32 )(r10 -48) = r7 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 65: (18) r1 = 0xffffd26fc3ea6c00 67: (bf) r2 = r10 ; 68: (07) r2 += -48 ; return bpf_map_lookup_elem((void )map, key); 69: (85) call bpf_map_lookup_elem#1 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (*_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 70: (15) if r0 == 0x0 goto pc+70 R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm ; 71: (67) r8 <<= 32 72: (c7) r8 s>>= 32 73: (79) r1 = (u64 )(r0 +0) R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm 74: (0f) r1 += r8 75: (7b) (u64 )(r0 +0) = r1 R0=map_value(id=0,off=0,ks=16,vs=8,imm=0) R1_w=inv(id=0) R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8_w=inv(id=0,smin_value=-2147483648,smax_value=2147483647) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm 76: (05) goto pc+85 ; } 162: (b7) r0 = 0 163: (95) exit
from 70 to 141: R0=inv0 R6=inv(id=0) R7=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R9=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R10=fp0 fp-40=mmmmmmmm fp-48=mmmmmmmm fp-112=mmmmmmmm fp-120=mmmmmmmm ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 141: (67) r8 <<= 32 142: (c7) r8 s>>= 32 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 143: (7b) (u64 )(r10 -96) = r8 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 144: (18) r1 = 0xffffd26fc3ea6c00 146: (bf) r2 = r10 ; ({ typeof(ipv4_recv_bytes.key) _key = ipv4_key; typeof(ipv4_recv_bytes.leaf) _leaf = bpf_map_lookupelem(bpf_pseudo_fd(1, -2), &_key); if (_leaf) (_leaf) += copied;else { typeof(ipv4_recv_bytes.leaf) _zleaf; builtin_memset(&_zleaf, 0, sizeof(_zleaf)); _zleaf += copied;bpf_map_updateelem(bpf_pseudo_fd(1, -2), &_key, &_zleaf, BPF_NOEXIST); } }); 147: (07) r2 += -48 148: (bf) r3 = r10 149: (07) r3 += -96 150: (05) goto pc+9 ; 160: (b7) r4 = 1 161: (85) call bpf_map_update_elem#2 ; } 162: (b7) r0 = 0 163: (95) exit
from 20 to 162: safe
from 19 to 77: R0=inv(id=0) R1_w=inv10 R2_w=inv1 R6=inv(id=0) R7_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R8=inv(id=0) R10=fp0 fp-48=??????mm ; 77: (b7) r9 = 0 ; struct ipv6_key_t ipv6_key = {.pid = pid}; 78: (7b) (u64 )(r10 -48) = r9 last_idx 78 first_idx 12 regs=200 stack=0 before 77: (b7) r9 = 0 ; struct ipv6_key_t ipv6_key = {.pid = pid}; 79: (63) (u32 )(r10 -48) = r7 ; struct ipv6_key_t ipv6_key = {.pid = pid}; 80: (7b) (u64 )(r10 +8) = r9 invalid stack off=8 size=8 processed 96 insns (limit 1000000) max_states_per_insn 0 total_states 7 peak_states 7 mark_read 4
Traceback (most recent call last): File "/usr/share/bcc/tools/tcptop", line 230, in
b = BPF(text=bpf_text)
File "/usr/lib/python3.8/site-packages/bcc/init.py", line 364, in init
self._trace_autoload()
File "/usr/lib/python3.8/site-packages/bcc/init.py", line 1178, in _trace_autoload
fn = self.load_func(func_name, BPF.KPROBE)
File "/usr/lib/python3.8/site-packages/bcc/init.py", line 403, in load_func
raise Exception("Failed to load BPF program %s: %s" %
Exception: Failed to load BPF program b'kprobe__tcp_cleanup_rbuf': Permission denied
It seems to be related to alignemnent in the ipv6_key_t structure. When moving the 32 bits pid field after the two 128 bits address fields, tcptop seems to works. I'm not sure that's a proper fix though.