Skip to content

Commit

Permalink
Set stack as function of max call depth
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan Jowett committed Nov 13, 2024
1 parent 94f7a43 commit e594cf2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vm/inc/ubpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ extern "C"
#define UBPF_MAX_INSTS 65536
#endif

/**
* @brief Default maximum number of nested calls in the VM.
*/
#if !defined(UBPF_MAX_CALL_DEPTH)
#define UBPF_MAX_CALL_DEPTH 8
#endif

/**
* @brief Default stack size for the eBPF program. Must be divisible by 16.
*/
#if !defined(UBPF_EBPF_STACK_SIZE)
#define UBPF_EBPF_STACK_SIZE (8 * 1024)
#define UBPF_EBPF_STACK_SIZE (UBPF_MAX_CALL_DEPTH * 512)
#endif

/**
Expand All @@ -60,12 +67,6 @@ extern "C"

#define UBPF_EBPF_NONVOLATILE_SIZE (sizeof(uint64_t) * 5)

/**
* @brief Default maximum number of nested calls in the VM.
*/
#if !defined(UBPF_MAX_CALL_DEPTH)
#define UBPF_MAX_CALL_DEPTH 10
#endif

/**
* @brief Opaque type for a the uBPF VM.
Expand Down

0 comments on commit e594cf2

Please sign in to comment.