Crate libubpf_sys

Crate libubpf_sys 

Source

Structs§

ubpf_vm
@brief Opaque type for a the uBPF VM.

Constants§

BasicJitMode
ExtendedJitMode

Functions§

as_external_function_t
@brief Cast an external function to \ref external_function_t
ubpf_compile
@brief Compile a BPF program in the VM to native code.
ubpf_compile_ex
@brief Compile a BPF program in the VM to native code.
ubpf_copy_jit
@brief Copy the JIT’d program code to the given buffer.
ubpf_create
@brief Create a new uBPF VM.
ubpf_destroy
@brief Free a uBPF VM.
ubpf_exec
@brief Execute a BPF program in the VM using the interpreter.
ubpf_exec_ex
ubpf_get_registers
@brief Retrieve the storage location for the BPF registers in the VM.
ubpf_load
@brief Load code into a VM. This must be done before calling ubpf_exec or ubpf_compile and after registering all functions.
ubpf_load_elf
@brief Load code from an ELF file.
ubpf_load_elf_ex
@brief Load code from an ELF file with extra parameters for extended control.
ubpf_register
@brief Register an external function. The immediate field of a CALL instruction is an index into an array of functions registered by the user. This API associates a function with an index.
ubpf_register_data_bounds_check
@brief Set a bounds check function for the VM.
ubpf_register_data_relocation
@brief Set a relocation function for the VM.
ubpf_register_debug_fn
@brief Add option to invoke a debug function before each instruction. Note: This only applies to the interpreter and not the JIT.
ubpf_register_external_dispatcher
@brief Register a function that dispatches to external helpers The immediate field of a CALL instruction is an index of a helper function to invoke. This API sets a callback that will choose the helper function to invoke (based on the index) and then invoke it. This API also sets a callback that the validator will use to determine if a given index is a valid external function.
ubpf_register_stack_usage_calculator
@brief Register a function that will be called during eBPF program validation to determine stack usage for a local function.
ubpf_set_error_print
@brief Set the function to be invoked if the program hits a fatal error.
ubpf_set_instruction_limit
@brief Set the instruction limit for the VM. This is the maximum number of instructions that a program may execute during a call to ubpf_exec. It has no effect on JIT’d programs.
ubpf_set_jit_code_size
@brief Set a size for the buffer allocated to machine code generated during JIT compilation. The JIT compiler allocates a buffer to store the code while it is being generated. The default may be too big for some embedded platforms. Use this to customize the size of that buffer. Note: The buffer being sized here is not the final location of the machine code returned by ubpf_compile – that buffer is perfectly sized to match the size of the generated machine code.
ubpf_set_pointer_secret
@brief Optional secret to improve ROP protection.
ubpf_set_registers
@brief Override the storage location for the BPF registers in the VM.
ubpf_set_unwind_function_index
@brief Instruct the uBPF runtime to apply unwind-on-success semantics to a helper function. If the function returns 0, the uBPF runtime will end execution of the eBPF program and immediately return control to the caller. This is used for implementing function like the “bpf_tail_call” helper.
ubpf_toggle_bounds_check
@brief Enable / disable bounds_check. Bounds check is enabled by default, but it may be too restrictive.
ubpf_toggle_undefined_behavior_check
@brief Enable or disable undefined behavior checks. Undefined behavior includes reading from uninitialized memory or using uninitialized registers. Default is disabled to preserve performance and compatibility with existing eBPF programs.
ubpf_translate
@brief Translate the eBPF byte code to machine code.
ubpf_translate_ex
@brief Translate the eBPF byte code to machine code.
ubpf_unload_code
@brief Unload code from a VM.

Type Aliases§

FILE
JitMode
@brief Enum to describe JIT mode.
external_function_dispatcher_t
@brief The type of an external helper dispatcher function.
external_function_t
@brief The type of an external helper function.
external_function_validate_t
@brief The type of an external helper validation function.
stack_usage_calculator_t
@brief The type of a stack usage calculator callback function.
ubpf_bounds_check
@brief Function that is called by the VM to check if a memory access is within bounds.
ubpf_data_relocation
@brief Data relocation function that is called by the VM when it encounters a R_BPF_64_64 relocation in the maps section of the ELF file.
ubpf_debug_fn
@brief A function to invoke before each instruction.
ubpf_jit_ex_fn
@brief Opaque type for a uBPF JIT compiled function with external stack.
ubpf_jit_fn
@brief Opaque type for a uBPF JIT compiled function.