Skip to content

Commit

Permalink
Mark [r1,r5] as invalid after a call
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
  • Loading branch information
Alan Jowett committed May 7, 2024
1 parent 621d21f commit f7016ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vm/ubpf_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ ubpf_validate_shadow_register(const struct ubpf_vm* vm, uint16_t* shadow_registe
if (inst.opcode == EBPF_OP_CALL) {
// Mark the return address register as initialized.
*shadow_registers |= 1 << 0;
// Mark r1-r5 as uninitialized.
*shadow_registers &= ~0x3e;
}

if (inst.opcode == EBPF_OP_EXIT && !(*shadow_registers & (1 << 0))) {
Expand Down

0 comments on commit f7016ab

Please sign in to comment.