Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // KnownExtensions is a set of filename extensions applied by the // Architecture's GetPathSuffix function. We use this in our // TruncateAll function. KnownExtensions = []string{ "", "32", } // ReportOutputDir is where report files will be dumped to. This // is set to the current working directory by default. ReportOutputDir = "." )
Functions ¶
func IsAnELF ¶
IsAnELF determines if a file is an ELF file or not Loose reinterpetation of debug/elf magic checking
func TruncateAll ¶
TruncateAll will truncate all files matching the current prefix with all known extensions in abireport. We do this to ensure that missing libs & reports are made obvious in git diffs.
Types ¶
type Architecture ¶
type Architecture struct { Machine elf.Machine // Corresponding machine for this configuration Symbols map[string]map[string]bool // Symbols exported for this architecture HiddenSymbols map[string]map[string]bool // Symbols found but not exported Dependencies map[string]bool // Dependencies for this architecture }
An Architecture is created for each ELF Machine type, and is used to group similar libraries and binaries in one place. This enables accounting for multilib/multiarch builds, to enable separate reports per architecture.
This is required because we can enable different options per architecture in packaging, and base symbols will be different between them in almost all cases, i.e. ld-linux*
func NewArchitecture ¶
func NewArchitecture(m elf.Machine) *Architecture
NewArchitecture will create a new Architecture and initialise the fields
func (*Architecture) GetPathSuffix ¶
func (a *Architecture) GetPathSuffix() string
GetPathSuffix will return an appropriate descriptor to use for the bucket configuration. This is used in the generated filenames
func (*Architecture) GetSymbolsTarget ¶
func (a *Architecture) GetSymbolsTarget(r *Record) map[string]map[string]bool
GetSymbolsTarget will return the appropriate symbol store for the given record, based on it's symbol visibility (soname presence)
type Record ¶
type Record struct { Path string // Where we found the file Flags RecordType // A bitwise set of RecordType Name string // Either the soname or the basename Dependencies []string // DT_NEEDED dependencies Symbols []string // Dynamic defined symbols Machine elf.Machine // Corresponding machine }
A Record is literally a recording of an encounter, with a file that we believe to hold some interest.
type RecordType ¶
type RecordType uint8
A RecordType is a flag which can be OR'd to define a type of Record encountered.
const ( // RecordTypeExecutable indicates the file was an executable RecordTypeExecutable RecordType = 1 << iota // RecordTypeLibrary indicates a shared library RecordTypeLibrary RecordType = 1 << iota // RecordType64bit indicates a 64-bit file RecordType64bit RecordType = 1 << iota // RecordType32bit indicates a 32-bit file RecordType32bit RecordType = 1 << iota // RecordTypeExport is set when we encounter valid ABI, i.e. a library // with a soname that we can export. RecordTypeExport RecordType = 1 << iota )
type Report ¶
type Report struct { Root string // Root directory that we're scanning Arches map[elf.Machine]*Architecture // Mapping of architectures // contains filtered or unexported fields }
A Report is used to traverse a given tree and identify any and all files that seem "interesting".
func NewReport ¶
NewReport will create a new walker instance, and attempt to initialise the magic library
func (*Report) AnalyzeOne ¶
AnalyzeOne will attempt to analyze the given record, and store the appropriate details for a later report.
func (*Report) GetBucket ¶
func (a *Report) GetBucket(record *Record) *Architecture
GetBucket will return an appropriate storage slot for the given record. If a bucket does not exist it will be created.