diff --git a/src/jit.rs b/src/jit.rs index fef800abf..08961a43b 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -395,7 +395,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> { self.emit_subroutines(); while self.pc * ebpf::INSN_SIZE < self.program.len() { - if self.offset_in_text_section + MAX_MACHINE_CODE_LENGTH_PER_INSTRUCTION > self.result.text_section.len() { + if self.offset_in_text_section + MAX_MACHINE_CODE_LENGTH_PER_INSTRUCTION * 2 >= self.result.text_section.len() { return Err(EbpfError::ExhaustedTextSegment(self.pc)); } let mut insn = ebpf::get_insn_unchecked(self.program, self.pc);