verifier

package
v0.0.0-...-10d974e Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package verifier is responsible for exposing information the verifier provides for any loaded eBPF program

Package verifier is responsible for exposing information the verifier provides for any loaded eBPF program

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComplexityInfo

type ComplexityInfo struct {
	InsnMap   map[int]*InstructionInfo    `json:"insn_map"`
	SourceMap map[string]*SourceLineStats `json:"source_map"`
}

ComplexityInfo holds the complexity information for a given eBPF program, with assembly and source line information

type InstructionInfo

type InstructionInfo struct {
	Index            int                    `json:"index"`
	TimesProcessed   int                    `json:"times_processed"`
	Source           *SourceLine            `json:"source"`
	Code             string                 `json:"code"`
	RegisterState    map[int]*RegisterState `json:"register_state"` // Register state after execution of the instruction
	RegisterStateRaw string                 `json:"register_state_raw"`
	IsDoubleWidth    bool                   `json:"is_double_width"`
}

InstructionInfo holds information about an eBPF instruction extracted from the verifier

type RegisterState

type RegisterState struct {
	Register int    `json:"register"`
	Live     string `json:"live"`
	Type     string `json:"type"`
	Value    string `json:"value"`
	Precise  bool   `json:"precise"`
}

RegisterState holds the state for a given register

type SourceLine

type SourceLine struct {
	LineInfo string `json:"line_info"`
	Line     string `json:"line"`
}

SourceLine holds the information about a C source line

type SourceLineStats

type SourceLineStats struct {
	NumInstructions            int   `json:"num_instructions"`
	MaxPasses                  int   `json:"max_passes"`
	MinPasses                  int   `json:"min_passes"`
	TotalInstructionsProcessed int   `json:"total_instructions_processed"`
	AssemblyInsns              []int `json:"assembly_insns"`
}

SourceLineStats holds the aggregate verifier statistics for a given C source line

type Statistics

type Statistics struct {
	StackDepth                 stat `json:"stack_usage" kernel:"4.15"`
	InstructionsProcessed      stat `json:"instruction_processed" kernel:"4.15"`
	InstructionsProcessedLimit stat `json:"limit" kernel:"4.15"`
	MaxStatesPerInstruction    stat `json:"max_states_per_insn" kernel:"5.2"`
	TotalStates                stat `json:"total_states" kernel:"5.2"`
	PeakStates                 stat `json:"peak_states" kernel:"5.2"`
}

Statistics represent that statistics exposed via the eBPF verifier when LogLevelStats is enabled

type StatsOptions

type StatsOptions struct {
	ObjectFiles        []string
	FilterPrograms     []*regexp.Regexp
	DetailedComplexity bool
	VerifierLogsDir    string
}

StatsOptions holds the options for the function BuildVerifierStats

type StatsResult

type StatsResult struct {
	Stats           map[string]*Statistics         // map of program name to statistics
	Complexity      map[string]*ComplexityInfo     // map of program name to complexity info
	FuncsPerSection map[string]map[string][]string // map of object name to the list of functions per section
}

StatsResult holds the result of the verifier stats process

func BuildVerifierStats

func BuildVerifierStats(_ *StatsOptions) (*StatsResult, map[string]struct{}, error)

BuildVerifierStats accepts a list of eBPF object files and generates a map of all programs and their Statistics

Jump to

Keyboard shortcuts

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