diff --git a/ubpf_8h_source.html b/ubpf_8h_source.html
index 7e7fb2f1f..4130bd1a9 100644
--- a/ubpf_8h_source.html
+++ b/ubpf_8h_source.html
@@ -108,194 +108,198 @@
45 #if !defined(UBPF_EBPF_STACK_SIZE)
-
46 #define UBPF_EBPF_STACK_SIZE 512
+
46 #define UBPF_EBPF_STACK_SIZE (8 * 1024)
-
49 #define UBPF_EBPF_NONVOLATILE_SIZE (sizeof(uint64_t) * 5)
-
-
54 #if !defined(UBPF_MAX_CALL_DEPTH)
-
55 #define UBPF_MAX_CALL_DEPTH 10
-
-
-
+
57 #if !defined(UBPF_EBPF_LOCAL_FUNCTION_STACK_SIZE)
+
58 #define UBPF_EBPF_LOCAL_FUNCTION_STACK_SIZE 256
+
+
+
61 #define UBPF_EBPF_NONVOLATILE_SIZE (sizeof(uint64_t) * 5)
-
-
-
72 typedef uint64_t (*
ubpf_jit_ex_fn)(
void* mem,
size_t mem_len, uint8_t* stack,
size_t stack_len);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
175 uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
unsigned int index,
void* cookie);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
251 ubpf_load(
struct ubpf_vm* vm,
const void* code, uint32_t code_len,
char** errmsg);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
273 #if defined(UBPF_HAS_ELF_H)
-
-
295 ubpf_load_elf(
struct ubpf_vm* vm,
const void* elf,
size_t elf_len,
char** errmsg);
-
-
-
320 ubpf_load_elf_ex(
struct ubpf_vm* vm,
const void* elf,
size_t elf_len,
const char* main_section_name,
char** errmsg);
-
-
-
-
337 ubpf_exec(
const struct ubpf_vm* vm,
void* mem,
size_t mem_len, uint64_t* bpf_return_value);
-
-
-
-
341 const struct ubpf_vm* vm,
-
-
-
344 uint64_t* bpf_return_value,
-
-
-
-
-
-
-
-
-
-
-
398 ubpf_copy_jit(
struct ubpf_vm* vm,
void* buffer,
size_t size,
char** errmsg);
-
-
-
416 ubpf_translate(
struct ubpf_vm* vm, uint8_t* buffer,
size_t* size,
char** errmsg);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
496 const char* symbol_name,
-
497 uint64_t symbol_offset,
-
498 uint64_t symbol_size);
-
-
-
-
-
-
-
-
+
66 #if !defined(UBPF_MAX_CALL_DEPTH)
+
67 #define UBPF_MAX_CALL_DEPTH 10
+
+
+
+
+
+
+
84 typedef uint64_t (*
ubpf_jit_ex_fn)(
void* mem,
size_t mem_len, uint8_t* stack,
size_t stack_len);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
187 uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
unsigned int index,
void* cookie);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
263 ubpf_load(
struct ubpf_vm* vm,
const void* code, uint32_t code_len,
char** errmsg);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
285 #if defined(UBPF_HAS_ELF_H)
+
+
307 ubpf_load_elf(
struct ubpf_vm* vm,
const void* elf,
size_t elf_len,
char** errmsg);
+
+
+
332 ubpf_load_elf_ex(
struct ubpf_vm* vm,
const void* elf,
size_t elf_len,
const char* main_section_name,
char** errmsg);
+
+
+
+
349 ubpf_exec(
const struct ubpf_vm* vm,
void* mem,
size_t mem_len, uint64_t* bpf_return_value);
+
+
+
+
353 const struct ubpf_vm* vm,
+
+
+
356 uint64_t* bpf_return_value,
+
+
+
+
+
+
+
+
+
+
+
410 ubpf_copy_jit(
struct ubpf_vm* vm,
void* buffer,
size_t size,
char** errmsg);
+
+
+
428 ubpf_translate(
struct ubpf_vm* vm, uint8_t* buffer,
size_t* size,
char** errmsg);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
508 const char* symbol_name,
+
509 uint64_t symbol_offset,
+
510 uint64_t symbol_size);
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
593 const uint64_t registers[16],
-
594 const uint8_t* stack_start,
-
-
596 uint64_t register_mask,
-
597 const uint8_t* stack_mask_start);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
605 const uint64_t registers[16],
+
606 const uint8_t* stack_start,
+
+
608 uint64_t register_mask,
+
609 const uint8_t* stack_mask_start);
+
+
+
+
+
+
+
+
int ubpf_set_unwind_function_index(struct ubpf_vm *vm, unsigned int idx)
Instruct the uBPF runtime to apply unwind-on-success semantics to a helper function....
-
int(* stack_usage_calculator_t)(const struct ubpf_vm *vm, uint16_t pc, void *cookie)
The type of a stack usage calculator callback function.
Definition: ubpf.h:207
+
int(* stack_usage_calculator_t)(const struct ubpf_vm *vm, uint16_t pc, void *cookie)
The type of a stack usage calculator callback function.
Definition: ubpf.h:219
int ubpf_exec(const struct ubpf_vm *vm, void *mem, size_t mem_len, uint64_t *bpf_return_value)
Execute a BPF program in the VM using the interpreter.
int ubpf_register_external_dispatcher(struct ubpf_vm *vm, external_function_dispatcher_t dispatcher, external_function_validate_t validater)
Register a function that dispatches to external helpers The immediate field of a CALL instruction is ...
ubpf_jit_ex_fn ubpf_compile_ex(struct ubpf_vm *vm, char **errmsg, enum JitMode jit_mode)
Compile a BPF program in the VM to native code.
int ubpf_register_data_bounds_check(struct ubpf_vm *vm, void *user_context, ubpf_bounds_check bounds_check)
Set a bounds check function for the VM.
uint64_t * ubpf_get_registers(const struct ubpf_vm *vm)
Retrieve the storage location for the BPF registers in the VM.
-
uint64_t(* ubpf_jit_ex_fn)(void *mem, size_t mem_len, uint8_t *stack, size_t stack_len)
Opaque type for a uBPF JIT compiled function with external stack.
Definition: ubpf.h:72
+
uint64_t(* ubpf_jit_ex_fn)(void *mem, size_t mem_len, uint8_t *stack, size_t stack_len)
Opaque type for a uBPF JIT compiled function with external stack.
Definition: ubpf.h:84
int ubpf_set_pointer_secret(struct ubpf_vm *vm, uint64_t secret)
Optional secret to improve ROP protection.
int ubpf_register(struct ubpf_vm *vm, unsigned int index, const char *name, external_function_t fn)
Register an external function. The immediate field of a CALL instruction is an index into an array of...
bool ubpf_toggle_undefined_behavior_check(struct ubpf_vm *vm, bool enable)
Enable or disable undefined behavior checks. Undefined behavior includes reading from uninitialized m...
-
JitMode
Enum to describe JIT mode.
Definition: ubpf.h:92
-
@ BasicJitMode
Definition: ubpf.h:94
-
@ ExtendedJitMode
Definition: ubpf.h:93
+
JitMode
Enum to describe JIT mode.
Definition: ubpf.h:104
+
@ BasicJitMode
Definition: ubpf.h:106
+
@ ExtendedJitMode
Definition: ubpf.h:105
external_function_t as_external_function_t(void *f)
Cast an external function to external_function_t.
-
uint64_t(* ubpf_jit_fn)(void *mem, size_t mem_len)
Opaque type for a uBPF JIT compiled function.
Definition: ubpf.h:66
-
bool(* ubpf_bounds_check)(void *context, uint64_t addr, uint64_t size)
Function that is called by the VM to check if a memory access is within bounds.
Definition: ubpf.h:519
+
uint64_t(* ubpf_jit_fn)(void *mem, size_t mem_len)
Opaque type for a uBPF JIT compiled function.
Definition: ubpf.h:78
+
bool(* ubpf_bounds_check)(void *context, uint64_t addr, uint64_t size)
Function that is called by the VM to check if a memory access is within bounds.
Definition: ubpf.h:531
ubpf_jit_fn ubpf_compile(struct ubpf_vm *vm, char **errmsg)
Compile a BPF program in the VM to native code.
int ubpf_register_data_relocation(struct ubpf_vm *vm, void *user_context, ubpf_data_relocation relocation)
Set a relocation function for the VM.
int ubpf_exec_ex(const struct ubpf_vm *vm, void *mem, size_t mem_len, uint64_t *bpf_return_value, uint8_t *stack, size_t stack_len)
-
uint64_t(* ubpf_data_relocation)(void *user_context, const uint8_t *data, uint64_t data_size, const char *symbol_name, uint64_t symbol_offset, uint64_t symbol_size)
Data relocation function that is called by the VM when it encounters a R_BPF_64_64 relocation in the ...
Definition: ubpf.h:492
+
uint64_t(* ubpf_data_relocation)(void *user_context, const uint8_t *data, uint64_t data_size, const char *symbol_name, uint64_t symbol_offset, uint64_t symbol_size)
Data relocation function that is called by the VM when it encounters a R_BPF_64_64 relocation in the ...
Definition: ubpf.h:504
bool ubpf_toggle_bounds_check(struct ubpf_vm *vm, bool enable)
Enable / disable bounds_check. Bounds check is enabled by default, but it may be too restrictive.
struct ubpf_vm * ubpf_create(void)
Create a new uBPF VM.
int ubpf_load(struct ubpf_vm *vm, const void *code, uint32_t code_len, char **errmsg)
Load code into a VM. This must be done before calling ubpf_exec or ubpf_compile and after registering...
-
bool(* external_function_validate_t)(unsigned int index, const struct ubpf_vm *vm)
The type of an external helper validation function.
Definition: ubpf.h:180
+
bool(* external_function_validate_t)(unsigned int index, const struct ubpf_vm *vm)
The type of an external helper validation function.
Definition: ubpf.h:192
int ubpf_set_jit_code_size(struct ubpf_vm *vm, size_t code_size)
Set a size for the buffer allocated to machine code generated during JIT compilation....
-
uint64_t(* external_function_t)(uint64_t p0, uint64_t p1, uint64_t p2, uint64_t p3, uint64_t p4)
The type of an external helper function.
Definition: ubpf.h:139
+
uint64_t(* external_function_t)(uint64_t p0, uint64_t p1, uint64_t p2, uint64_t p3, uint64_t p4)
The type of an external helper function.
Definition: ubpf.h:151
ubpf_jit_fn ubpf_copy_jit(struct ubpf_vm *vm, void *buffer, size_t size, char **errmsg)
Copy the JIT'd program code to the given buffer.
-
uint64_t(* external_function_dispatcher_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, unsigned int index, void *cookie)
The type of an external helper dispatcher function.
Definition: ubpf.h:174
+
uint64_t(* external_function_dispatcher_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, unsigned int index, void *cookie)
The type of an external helper dispatcher function.
Definition: ubpf.h:186
int ubpf_register_stack_usage_calculator(struct ubpf_vm *vm, stack_usage_calculator_t calculator, void *cookie)
Register a function that will be called during eBPF program validation to determine stack usage for a...
int ubpf_register_debug_fn(struct ubpf_vm *vm, void *context, ubpf_debug_fn debug_function)
Add option to invoke a debug function before each instruction. Note: This only applies to the interpr...
int ubpf_translate(struct ubpf_vm *vm, uint8_t *buffer, size_t *size, char **errmsg)
Translate the eBPF byte code to machine code.
@@ -304,7 +308,7 @@
void ubpf_set_error_print(struct ubpf_vm *vm, int(*error_printf)(FILE *stream, const char *format,...))
Set the function to be invoked if the program hits a fatal error.
void ubpf_unload_code(struct ubpf_vm *vm)
Unload code from a VM.
void ubpf_set_registers(struct ubpf_vm *vm, uint64_t *regs)
Override the storage location for the BPF registers in the VM.
-
void(* ubpf_debug_fn)(void *context, int program_counter, const uint64_t registers[16], const uint8_t *stack_start, size_t stack_length, uint64_t register_mask, const uint8_t *stack_mask_start)
A function to invoke before each instruction.
Definition: ubpf.h:590
+
void(* ubpf_debug_fn)(void *context, int program_counter, const uint64_t registers[16], const uint8_t *stack_start, size_t stack_length, uint64_t register_mask, const uint8_t *stack_mask_start)
A function to invoke before each instruction.
Definition: ubpf.h:602
int ubpf_translate_ex(struct ubpf_vm *vm, uint8_t *buffer, size_t *size, char **errmsg, enum JitMode jit_mode)
Translate the eBPF byte code to machine code.