Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 1fcc68e

Browse files
committed
Removes add64 r10, imm special handling in execution.
1 parent e059054 commit 1fcc68e

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/interpreter.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! Interpreter for eBPF programs.
1414
1515
use crate::{
16-
ebpf::{self, FRAME_PTR_REG},
16+
ebpf,
1717
elf::Executable,
1818
error::{EbpfError, ProgramResult},
1919
program::BuiltinFunction,
@@ -188,16 +188,6 @@ impl<'a, 'b, C: ContextObject> Interpreter<'a, 'b, C> {
188188
}
189189

190190
match insn.opc {
191-
ebpf::ADD64_IMM if dst == FRAME_PTR_REG && self.executable.get_sbpf_version().dynamic_stack_frames() => {
192-
// Let the stack overflow. For legitimate programs, this is a nearly
193-
// impossible condition to hit since programs are metered and we already
194-
// enforce a maximum call depth. For programs that intentionally mess
195-
// around with the stack pointer, MemoryRegion::map will return
196-
// InvalidVirtualAddress(stack_ptr) once an invalid stack address is
197-
// accessed.
198-
self.reg[ebpf::FRAME_PTR_REG] = self.reg[ebpf::FRAME_PTR_REG].overflowing_add(insn.imm as u64).0;
199-
}
200-
201191
ebpf::LD_DW_IMM if !self.executable.get_sbpf_version().disable_lddw() => {
202192
ebpf::augment_lddw_unchecked(self.program, &mut insn);
203193
self.reg[dst] = insn.imm as u64;

src/jit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
422422
let target_pc = (self.pc as isize + insn.off as isize + 1) as usize;
423423

424424
match insn.opc {
425-
ebpf::ADD64_IMM if insn.dst == FRAME_PTR_REG as u8 && self.executable.get_sbpf_version().dynamic_stack_frames() => {
426-
self.emit_ins(X86Instruction::alu(OperandSize::S64, 0x81, 0, REGISTER_MAP[FRAME_PTR_REG], insn.imm, None));
427-
}
428-
429425
ebpf::LD_DW_IMM if !self.executable.get_sbpf_version().disable_lddw() => {
430426
self.emit_validate_and_profile_instruction_count(false, Some(self.pc + 2));
431427
self.pc += 1;

0 commit comments

Comments
 (0)