Skip to content

Commit

Permalink
Freeing stack memory via free is undefined behavior (#496)
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
Co-authored-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan-Jowett and Alan Jowett authored May 28, 2024
1 parent 54be1df commit d370804
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions vm/ubpf_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,6 @@ ubpf_exec_ex(
}

cleanup:
#if defined(NTDDI_VERSION) && defined(WINNT)
free(stack_frames);
#endif
if (shadow_stack) {
free(shadow_stack);
}
Expand All @@ -1295,8 +1292,6 @@ ubpf_exec(const struct ubpf_vm* vm, void* mem, size_t mem_len, uint64_t* bpf_ret
// Windows Kernel mode limits stack usage to 12K, so we need to allocate it dynamically.
#if defined(NTDDI_VERSION) && defined(WINNT)
uint64_t* stack = NULL;
struct ubpf_stack_frame* stack_frames = NULL;

stack = calloc(UBPF_EBPF_STACK_SIZE, 1);
if (!stack) {
return -1;
Expand Down

0 comments on commit d370804

Please sign in to comment.