Skip to content

Commit

Permalink
fix vm.due_insn_count subtract overflow when enable_instruction_meter…
Browse files Browse the repository at this point in the history
…=false (#23)
  • Loading branch information
hycinth22 authored Jan 30, 2025
1 parent ac6ba8d commit bce8eed
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,7 @@ impl<'a, C: ContextObject> EbpfVm<'a, C> {
self.registers[1] = ebpf::MM_INPUT_START;
self.registers[11] = executable.get_entrypoint_instruction_offset() as u64;
let config = executable.get_config();
let initial_insn_count = if config.enable_instruction_meter {
self.context_object_pointer.get_remaining()
} else {
0
};
let initial_insn_count = self.context_object_pointer.get_remaining();
self.previous_instruction_meter = initial_insn_count;
self.due_insn_count = 0;
self.program_result = ProgramResult::Ok(0);
Expand Down

0 comments on commit bce8eed

Please sign in to comment.