http_filter not working with LLVM 7.0.0
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
Hello, I'm trying to run [http_filter](https://github.com/iovisor/bcc/tree/master/examples/networking/http_filter) on my laptop where I have Archlinux installed with kernel: `4.18.16-arch1-1-ARCH` but I get this error which I guess is coming from the verifier (?)
```
binding socket to 'wlp3s0'
bpf: Failed to load program: Permission denied
0: (bf) r6 = r1
1: (28) r0 = *(u16 *)skb[12]
2: (55) if r0 != 0x800 goto pc+96
R0=inv2048 R6=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
3: (30) r0 = *(u8 *)skb[23]
4: (55) if r0 != 0x6 goto pc+94
R0=inv6 R6=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
5: (30) r0 = *(u8 *)skb[14]
6: (bf) r8 = r0
7: (67) r8 <<= 2
8: (57) r8 &= 60
9: (b7) r1 = 20
10: (2d) if r1 > r8 goto pc+88
R0=inv(id=0) R1=inv20 R6=ctx(id=0,off=0,imm=0) R8=inv(id=0,umin_value=20,umax_value=60,var_off=(0x0; 0x3c)) R10=fp0,call_-1
11: (bf) r7 = r8
12: (07) r7 += 26
13: (50) r0 = *(u8 *)skb[r7 + 0]
14: (bf) r7 = r0
15: (28) r0 = *(u16 *)skb[16]
16: (1f) r0 -= r8
17: (77) r7 >>= 2
18: (57) r7 &= 60
19: (1f) r0 -= r7
20: (67) r0 <<= 32
21: (77) r0 >>= 32
22: (b7) r1 = 7
23: (2d) if r1 > r0 goto pc+75
R0=inv(id=0,umin_value=7,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R1=inv7 R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umax_value=60,var_off=(0x0; 0x3c)) R8=inv(id=0,umin_value=20,umax_value=60,var_off=(0x0; 0x3c)) R10=fp0,call_-1
24: (0f) r7 += r8
25: (bf) r9 = r7
26: (07) r9 += 12
27: (07) r7 += 20
28: (bf) r8 = r9
29: (47) r8 |= 2
30: (50) r0 = *(u8 *)skb[r8 + 0]
31: (bf) r3 = r0
32: (2d) if r7 > r8 goto pc+9
R0=inv(id=0) R3=inv(id=0) R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umin_value=40,umax_value=140,var_off=(0x0; 0xfc)) R8=inv(id=0,umin_value=32,umax_value=254,var_off=(0x2; 0xfc)) R9=inv(id=0,umin_value=32,umax_value=132,var_off=(0x0; 0xfc)) R10=fp0,call_-1
33: (65) if r3 s> 0x47 goto pc+33
R0=inv(id=0) R3=inv(id=0,smax_value=71) R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umin_value=40,umax_value=140,var_off=(0x0; 0xfc)) R8=inv(id=0,umin_value=32,umax_value=254,var_off=(0x2; 0xfc)) R9=inv(id=0,umin_value=32,umax_value=132,var_off=(0x0; 0xfc)) R10=fp0,call_-1
34: (15) if r3 == 0x44 goto pc+41
R0=inv(id=0) R3=inv(id=0,smax_value=71) R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umin_value=40,umax_value=140,var_off=(0x0; 0xfc)) R8=inv(id=0,umin_value=32,umax_value=254,var_off=(0x2; 0xfc)) R9=inv(id=0,umin_value=32,umax_value=132,var_off=(0x0; 0xfc)) R10=fp0,call_-1
35: (15) if r3 == 0x47 goto pc+1
R0=inv(id=0) R3=inv(id=0,smax_value=71) R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umin_value=40,umax_value=140,var_off=(0x0; 0xfc)) R8=inv(id=0,umin_value=32,umax_value=254,var_off=(0x2; 0xfc)) R9=inv(id=0,umin_value=32,umax_value=132,var_off=(0x0; 0xfc)) R10=fp0,call_-1
36: (05) goto pc+62
99: (b7) r1 = 0
100: (bf) r0 = r1
101: (95) exit
from 35 to 37: R0=inv(id=0) R3=inv71 R6=ctx(id=0,off=0,imm=0) R7=inv(id=0,umin_value=40,umax_value=140,var_off=(0x0; 0xfc)) R8=inv(id=0,umin_value=32,umax_value=254,var_off=(0x2; 0xfc)) R9=inv(id=0,umin_value=32,umax_value=132,var_off=(0x0; 0xfc)) R10=fp0,call_-1
37: (55) if r2 != 0x54 goto pc+61
R2 !read_ok
Traceback (most recent call last):
File "http-parse-simple.py", line 69, in
function_http_filter = bpf.load_func("http_filter", BPF.SOCKET_FILTER)
File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 377, in load_func
(func_name, errstr))
Exception: Failed to load BPF program http_filter: Permission denied
```
I tried to run it in Ubuntu 16.04 with kernel `4.13.0-16-generic` and it works fine there
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure from examples/networking/http_filter, particularly http-parse-simple.py at the BPF.load_func call, using the reported Arch Linux kernel and LLVM 7.0.0 versions. Compare the verifier output with the working Ubuntu environment and determine whether http_filter loads successfully on the affected setup without the reported permission error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- devtools, networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100