feat(go): advance validation sidecar toward production
This commit is contained in:
parent
6a06eba255
commit
f85c2e831a
92 changed files with 8881 additions and 91 deletions
141
go-agent/internal/ebpfsource/exec_bpfel.go
Normal file
141
go-agent/internal/ebpfsource/exec_bpfel.go
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// Code generated by bpf2go; DO NOT EDIT.
|
||||
//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 || wasm
|
||||
|
||||
package ebpfsource
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/cilium/ebpf"
|
||||
)
|
||||
|
||||
// Names of all BPF objects in the ELF.
|
||||
//
|
||||
// Used for safe lookups in a Collection or CollectionSpec.
|
||||
const (
|
||||
execMapEvents = "events"
|
||||
execProgTraceExecve = "trace_execve"
|
||||
)
|
||||
|
||||
// loadExec returns the embedded CollectionSpec for exec.
|
||||
func loadExec() (*ebpf.CollectionSpec, error) {
|
||||
reader := bytes.NewReader(_ExecBytes)
|
||||
spec, err := ebpf.LoadCollectionSpecFromReader(reader)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't load exec: %w", err)
|
||||
}
|
||||
|
||||
return spec, err
|
||||
}
|
||||
|
||||
// loadExecObjects loads exec and converts it into a struct.
|
||||
//
|
||||
// The following types are suitable as obj argument:
|
||||
//
|
||||
// *execObjects
|
||||
// *execPrograms
|
||||
// *execMaps
|
||||
//
|
||||
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
|
||||
func loadExecObjects(obj any, opts *ebpf.CollectionOptions) error {
|
||||
spec, err := loadExec()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return spec.LoadAndAssign(obj, opts)
|
||||
}
|
||||
|
||||
// execSpecs contains maps and programs before they are loaded into the kernel.
|
||||
//
|
||||
// It can be passed ebpf.CollectionSpec.Assign.
|
||||
type execSpecs struct {
|
||||
execProgramSpecs
|
||||
execMapSpecs
|
||||
execVariableSpecs
|
||||
}
|
||||
|
||||
// execProgramSpecs contains programs before they are loaded into the kernel.
|
||||
//
|
||||
// It can be passed ebpf.CollectionSpec.Assign.
|
||||
type execProgramSpecs struct {
|
||||
TraceExecve *ebpf.ProgramSpec `ebpf:"trace_execve"`
|
||||
}
|
||||
|
||||
// execMapSpecs contains maps before they are loaded into the kernel.
|
||||
//
|
||||
// It can be passed ebpf.CollectionSpec.Assign.
|
||||
type execMapSpecs struct {
|
||||
Events *ebpf.MapSpec `ebpf:"events"`
|
||||
}
|
||||
|
||||
// execVariableSpecs contains global variables before they are loaded into the kernel.
|
||||
//
|
||||
// It can be passed ebpf.CollectionSpec.Assign.
|
||||
type execVariableSpecs struct {
|
||||
}
|
||||
|
||||
// execObjects contains all objects after they have been loaded into the kernel.
|
||||
//
|
||||
// It can be passed to loadExecObjects or ebpf.CollectionSpec.LoadAndAssign.
|
||||
type execObjects struct {
|
||||
execPrograms
|
||||
execMaps
|
||||
execVariables
|
||||
}
|
||||
|
||||
func (o *execObjects) Close() error {
|
||||
return _ExecClose(
|
||||
&o.execPrograms,
|
||||
&o.execMaps,
|
||||
)
|
||||
}
|
||||
|
||||
// execMaps contains all maps after they have been loaded into the kernel.
|
||||
//
|
||||
// It can be passed to loadExecObjects or ebpf.CollectionSpec.LoadAndAssign.
|
||||
type execMaps struct {
|
||||
Events *ebpf.Map `ebpf:"events"`
|
||||
}
|
||||
|
||||
func (m *execMaps) Close() error {
|
||||
return _ExecClose(
|
||||
m.Events,
|
||||
)
|
||||
}
|
||||
|
||||
// execVariables contains all global variables after they have been loaded into the kernel.
|
||||
//
|
||||
// It can be passed to loadExecObjects or ebpf.CollectionSpec.LoadAndAssign.
|
||||
type execVariables struct {
|
||||
}
|
||||
|
||||
// execPrograms contains all programs after they have been loaded into the kernel.
|
||||
//
|
||||
// It can be passed to loadExecObjects or ebpf.CollectionSpec.LoadAndAssign.
|
||||
type execPrograms struct {
|
||||
TraceExecve *ebpf.Program `ebpf:"trace_execve"`
|
||||
}
|
||||
|
||||
func (p *execPrograms) Close() error {
|
||||
return _ExecClose(
|
||||
p.TraceExecve,
|
||||
)
|
||||
}
|
||||
|
||||
func _ExecClose(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 exec_bpfel.o
|
||||
var _ExecBytes []byte
|
||||
Loading…
Add table
Add a link
Reference in a new issue