diff --git a/src/interpreter.rs b/src/interpreter.rs index d6b10cbc..573a7cb7 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -13,7 +13,7 @@ //! Interpreter for eBPF programs. use crate::{ - ebpf::{self, FRAME_PTR_REG}, + ebpf, elf::Executable, error::{EbpfError, ProgramResult}, program::BuiltinFunction, @@ -188,16 +188,6 @@ impl<'a, 'b, C: ContextObject> Interpreter<'a, 'b, C> { } match insn.opc { - ebpf::ADD64_IMM if dst == FRAME_PTR_REG && self.executable.get_sbpf_version().dynamic_stack_frames() => { - // Let the stack overflow. For legitimate programs, this is a nearly - // impossible condition to hit since programs are metered and we already - // enforce a maximum call depth. For programs that intentionally mess - // around with the stack pointer, MemoryRegion::map will return - // InvalidVirtualAddress(stack_ptr) once an invalid stack address is - // accessed. - self.reg[ebpf::FRAME_PTR_REG] = self.reg[ebpf::FRAME_PTR_REG].overflowing_add(insn.imm as u64).0; - } - ebpf::LD_DW_IMM if !self.executable.get_sbpf_version().disable_lddw() => { ebpf::augment_lddw_unchecked(self.program, &mut insn); self.reg[dst] = insn.imm as u64; diff --git a/src/jit.rs b/src/jit.rs index 4103804f..dc908df3 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -422,10 +422,6 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> { let target_pc = (self.pc as isize + insn.off as isize + 1) as usize; match insn.opc { - ebpf::ADD64_IMM if insn.dst == FRAME_PTR_REG as u8 && self.executable.get_sbpf_version().dynamic_stack_frames() => { - self.emit_ins(X86Instruction::alu(OperandSize::S64, 0x81, 0, REGISTER_MAP[FRAME_PTR_REG], insn.imm, None)); - } - ebpf::LD_DW_IMM if !self.executable.get_sbpf_version().disable_lddw() => { self.emit_validate_and_profile_instruction_count(false, Some(self.pc + 2)); self.pc += 1;