kallsyms

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package kallsyms provides functions to resolve kernel symbols.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpecUpdateAddresses

func SpecUpdateAddresses(spec *ebpf.CollectionSpec, symbols []string) error

SpecUpdateAddresses updates the addresses of the given symbols in the given collection spec.

The ebpf program is expected to be have global variables with the suffix "_addr" for each symbol:

const volatile __u64 socket_file_ops_addr = 0;

Then, SpecUpdateAddresses() can be called in this way:

kallsyms.SpecUpdateAddresses(spec, []string{"socket_file_ops"})

Types

type KAllSyms

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

func NewKAllSyms

func NewKAllSyms() (*KAllSyms, error)

NewKAllSyms reads /proc/kallsyms and returns a KAllSyms.

func NewKAllSymsFromReader

func NewKAllSymsFromReader(reader io.Reader) (*KAllSyms, error)

NewKAllSymsFromReader reads a kallsyms file from the given reader and returns a KAllSyms.

func (*KAllSyms) LookupByInstructionPointer

func (k *KAllSyms) LookupByInstructionPointer(ip uint64) string

LookupByInstructionPointer tries to find the kernel symbol corresponding to the given instruction pointer. For example, if instruction pointer is 0x1004 and there is a symbol which address is 0x1000, this function will return the name of this symbol. If no symbol is found, it returns "[unknown]".

func (*KAllSyms) SymbolExists

func (k *KAllSyms) SymbolExists(symbol string) bool

SymbolExists returns true if the given symbol exists in the kernel.

Jump to

Keyboard shortcuts

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