sysprog21 / sehttpd Goto Github PK
View Code? Open in Web Editor NEWA small and efficient web server with 1K lines of C code
License: MIT License
A small and efficient web server with 1K lines of C code
License: MIT License
Running the epbf program
$ sudo python http-parse-sample.py
will get this error:
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_w=inv2048 R6_w=ctx(id=0,off=0,imm=0) R10=fp0
3: (30) r0 = *(u8 *)skb[23]
4: (55) if r0 != 0x6 goto pc+94
R0_w=inv6 R6_w=ctx(id=0,off=0,imm=0) R10=fp0
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
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_w=inv(id=0,umin_value=7,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R1_w=inv7 R6=ctx(id=0,off=0,imm=0) R7_w=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
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
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
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
35: (15) if r3 == 0x47 goto pc+1
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
37: (55) if r2 != 0x54 goto pc+61
R2 !read_ok
processed 41 insns (limit 1000000) max_states_per_insn 0 total_states 3 peak_states 3 mark_read 1
Traceback (most recent call last):
File "http-parse-sample.py", line 77, in <module>
function_http_filter = bpf.load_func("http_filter", BPF.SOCKET_FILTER)
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 413, in load_func
(func_name, errstr))
Exception: Failed to load BPF program http_filter: Permission denied
Here is my environment:
$ uname -a
Linux desktop 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Check this issue : iovisor/bcc#2035
and this commit : iovisor/bcc@60b0166
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.