selectors

package
v0.8.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypePost       = 0
	ActionTypeFollowFd   = 1
	ActionTypeSigKill    = 2
	ActionTypeUnfollowFd = 3
	ActionTypeOverride   = 4
	ActionTypeCopyFd     = 5
	ActionTypeGetUrl     = 6
	ActionTypeDnsLookup  = 7
)
View Source
const (
	SelectorOpGT  = 1
	SelectorOpLT  = 2
	SelectorOpEQ  = 3
	SelectorOpNEQ = 4
	// Pid and Namespace ops
	SelectorOpIn    = 5
	SelectorOpNotIn = 6
	// String ops
	SelectorOpPrefix  = 8
	SelectorOpPostfix = 9
	// Map ops
	SelectorInMap    = 10
	SelectorNotInMap = 11
)

Variables

This section is empty.

Functions

func AdvanceSelectorLength

func AdvanceSelectorLength(k *KernelSelectorState) uint32

func ArgSelectorValue

func ArgSelectorValue(v string) ([]byte, uint32)

func ArgTypeToString

func ArgTypeToString(t uint32) string

func HasOverride

func HasOverride(spec *v1alpha1.KProbeSpec) bool

func InitKernelSelectors

func InitKernelSelectors(selectors []v1alpha1.KProbeSelector, args []v1alpha1.KProbeArg, actionArgTable *idtable.Table) ([4096]byte, error)

The byte array storing the selector configuration has the following format array := [N][S1_off][S2_off]...[SN_off][S1][S2][...][SN]

N: is the number of selectors (u32)
Sx_off: is the relative offset of  selector x (diff of Sx to Sx_off)
Sx: holds the data for the selector

Each selector x starts with its length in bytes, and then stores a number of sections for the different matchers. Each section will typically starts with its length in bytes.

Sx := [length]

[matchPIDs]
[matchNamespaces]
[matchCapabilities]
[matchNamespaceChanges]
[matchCapabilityChanges]
[matchArgs]
[matchActions]

matchPIDs := [length][PID1][PID2]...[PIDn] matchNamespaces := [length][NSx][NSy]...[NSn] matchCapabilities := [length][CAx][CAy]...[CAn] matchNamespaceChanges := [length][NCx][NCy]...[NCn] matchCapabilityChanges := [length][CAx][CAy]...[CAn] matchArgs := [length][ARGx][ARGy]...[ARGn] PIDn := [op][flags][nValues][v1]...[vn] Argn := [index][op][valueGen] NSn := namespace[op][valueInt] NCn := [op][valueInt] CAn := [type][op][namespacecap][valueInt] valueGen := [type][len][v] valueInt := [len][v]

For some examples, see kernel_test.go

func MatchActionSigKill

func MatchActionSigKill(spec interface{}) bool

func ParseMatchAction added in v0.8.20

func ParseMatchAction(k *KernelSelectorState, action *v1alpha1.ActionSelector, actionArgTable *idtable.Table) error

func ParseMatchActions added in v0.8.20

func ParseMatchActions(k *KernelSelectorState, actions []v1alpha1.ActionSelector, actionArgTable *idtable.Table) error

func ParseMatchArg added in v0.8.20

func ParseMatchArg(k *KernelSelectorState, arg *v1alpha1.ArgSelector, sig []v1alpha1.KProbeArg) error

func ParseMatchArgs added in v0.8.20

func ParseMatchArgs(k *KernelSelectorState, args []v1alpha1.ArgSelector, sig []v1alpha1.KProbeArg) error

func ParseMatchBinaries added in v0.8.20

func ParseMatchBinaries(k *KernelSelectorState, binarys []v1alpha1.BinarySelector) error

func ParseMatchBinary added in v0.8.20

func ParseMatchBinary(k *KernelSelectorState, b *v1alpha1.BinarySelector) error

func ParseMatchCapabilities added in v0.8.20

func ParseMatchCapabilities(k *KernelSelectorState, actions []v1alpha1.CapabilitiesSelector) error

func ParseMatchCapabilityChanges added in v0.8.20

func ParseMatchCapabilityChanges(k *KernelSelectorState, actions []v1alpha1.CapabilitiesSelector) error

func ParseMatchCaps added in v0.8.20

func ParseMatchCaps(k *KernelSelectorState, action *v1alpha1.CapabilitiesSelector) error

func ParseMatchNamespace added in v0.8.20

func ParseMatchNamespace(k *KernelSelectorState, action *v1alpha1.NamespaceSelector) error

func ParseMatchNamespaceChange added in v0.8.20

func ParseMatchNamespaceChange(k *KernelSelectorState, action *v1alpha1.NamespaceChangesSelector) error

func ParseMatchNamespaceChanges added in v0.8.20

func ParseMatchNamespaceChanges(k *KernelSelectorState, actions []v1alpha1.NamespaceChangesSelector) error

func ParseMatchNamespaces added in v0.8.20

func ParseMatchNamespaces(k *KernelSelectorState, actions []v1alpha1.NamespaceSelector) error

func ParseMatchPid added in v0.8.20

func ParseMatchPid(k *KernelSelectorState, pid *v1alpha1.PIDSelector) error

func ParseMatchPids added in v0.8.20

func ParseMatchPids(k *KernelSelectorState, matchPids []v1alpha1.PIDSelector) error

func SelectorOp added in v0.8.20

func SelectorOp(op string) (uint32, error)

func WriteSelectorByteArray

func WriteSelectorByteArray(k *KernelSelectorState, b []byte, size uint32)

func WriteSelectorInt32

func WriteSelectorInt32(k *KernelSelectorState, v int32)

func WriteSelectorInt64

func WriteSelectorInt64(k *KernelSelectorState, v int64)

func WriteSelectorLength

func WriteSelectorLength(k *KernelSelectorState, loff uint32)

func WriteSelectorUint32

func WriteSelectorUint32(k *KernelSelectorState, v uint32)

func WriteSelectorUint64

func WriteSelectorUint64(k *KernelSelectorState, v uint64)

Types

type ActionArgEntry added in v0.8.18

type ActionArgEntry struct {
	// contains filtered or unexported fields
}

Action argument table entry (for URL and FQDN arguments)

func (*ActionArgEntry) GetArg added in v0.8.18

func (g *ActionArgEntry) GetArg() string

func (*ActionArgEntry) SetID added in v0.8.18

func (g *ActionArgEntry) SetID(id idtable.EntryID)

type KernelSelectorState

type KernelSelectorState struct {
	// contains filtered or unexported fields
}

func InitKernelSelectorState

func InitKernelSelectorState(selectors []v1alpha1.KProbeSelector, args []v1alpha1.KProbeArg,
	actionArgTable *idtable.Table) (*KernelSelectorState, error)

func (*KernelSelectorState) AddBinaryName added in v0.8.18

func (k *KernelSelectorState) AddBinaryName(binary string)

func (*KernelSelectorState) Buffer

func (k *KernelSelectorState) Buffer() [4096]byte

func (*KernelSelectorState) GetBinSelNamesMap added in v0.8.18

func (k *KernelSelectorState) GetBinSelNamesMap() map[uint32]uint32

func (*KernelSelectorState) GetBinaryOp added in v0.8.18

func (k *KernelSelectorState) GetBinaryOp() uint32

func (*KernelSelectorState) GetNewBinaryMappings added in v0.8.18

func (k *KernelSelectorState) GetNewBinaryMappings() map[uint32]string

func (*KernelSelectorState) SetBinaryOp added in v0.8.18

func (k *KernelSelectorState) SetBinaryOp(op uint32)

func (*KernelSelectorState) ValueMaps

func (k *KernelSelectorState) ValueMaps() []map[[8]byte]struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL