Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
a0f66dd
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
verifier
/
dead_code.c
Blame
Blame
Latest commit
History
History
161 lines (161 loc) · 3.69 KB
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
verifier
/
dead_code.c
Top
File metadata and controls
Code
Blame
161 lines (161 loc) · 3.69 KB
Raw
{ "dead code: start", .insns = { BPF_JMP_IMM(BPF_JA, 0, 0, 2), BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0), BPF_JMP_IMM(BPF_JA, 0, 0, 2), BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, -4), BPF_EXIT_INSN(), }, .errstr_unpriv = "R9 !read_ok", .result_unpriv = REJECT, .result = ACCEPT, .retval = 7, }, { "dead code: mid 1", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 0, 1), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, 0), BPF_EXIT_INSN(), }, .result = ACCEPT, .retval = 7, }, { "dead code: mid 2", .insns = { BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_prandom_u32), BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 4), BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1), BPF_JMP_IMM(BPF_JA, 0, 0, 2), BPF_MOV64_IMM(BPF_REG_0, 7), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 1), BPF_EXIT_INSN(), }, .result = ACCEPT, .retval = 1, }, { "dead code: end 1", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, 1), BPF_EXIT_INSN(), BPF_EXIT_INSN(), }, .result = ACCEPT, .retval = 7, }, { "dead code: end 2", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, 1), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 12), BPF_EXIT_INSN(), }, .result = ACCEPT, .retval = 7, }, { "dead code: end 3", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 8, 1), BPF_EXIT_INSN(), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 10, 1), BPF_JMP_IMM(BPF_JA, 0, 0, 1), BPF_MOV64_IMM(BPF_REG_0, 12), BPF_JMP_IMM(BPF_JA, 0, 0, -5), }, .result = ACCEPT, .retval = 7, }, { "dead code: tail of main + func", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 8, 1), BPF_EXIT_INSN(), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 1), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 12), BPF_EXIT_INSN(), }, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .result = ACCEPT, .retval = 7, }, { "dead code: tail of main + two functions", .insns = { BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_0, 8, 1), BPF_EXIT_INSN(), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 1), BPF_EXIT_INSN(), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 1), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 12), BPF_EXIT_INSN(), }, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .result = ACCEPT, .retval = 7, }, { "dead code: function in the middle and mid of another func", .insns = { BPF_MOV64_IMM(BPF_REG_1, 7), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 3), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 12), BPF_EXIT_INSN(), BPF_MOV64_IMM(BPF_REG_0, 7), BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 7, 1), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -5), BPF_EXIT_INSN(), }, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .result = ACCEPT, .retval = 7, }, { "dead code: middle of main before call", .insns = { BPF_MOV64_IMM(BPF_REG_1, 2), BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 2, 1), BPF_MOV64_IMM(BPF_REG_1, 5), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 1), BPF_EXIT_INSN(), BPF_MOV64_REG(BPF_REG_0, BPF_REG_1), BPF_EXIT_INSN(), }, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .result = ACCEPT, .retval = 2, }, { "dead code: start of a function", .insns = { BPF_MOV64_IMM(BPF_REG_1, 2), BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 1), BPF_EXIT_INSN(), BPF_JMP_IMM(BPF_JA, 0, 0, 0), BPF_MOV64_REG(BPF_REG_0, BPF_REG_1), BPF_EXIT_INSN(), }, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .result = ACCEPT, .retval = 2, },
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
You can’t perform that action at this time.