From 6b58569318e04d4065e15f6760b2f13161b1aafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Wed, 4 Sep 2024 08:47:18 +0200 Subject: [PATCH] Makes the ExhaustedTextSegment check more conservative. --- src/jit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);