From 96735eba68067341a8c5042a530046e7b5048369 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 8 Nov 2021 19:51:14 -0500 Subject: [PATCH] iret: Implement eip limit check (fix ubuntu 10 #474) --- src/rust/cpu/cpu.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rust/cpu/cpu.rs b/src/rust/cpu/cpu.rs index 095b7a4a..616faa8f 100644 --- a/src/rust/cpu/cpu.rs +++ b/src/rust/cpu/cpu.rs @@ -551,7 +551,15 @@ pub unsafe fn iret(is_16: bool) { }, }; - dbg_assert!(new_eip as u32 <= cs_descriptor.effective_limit()); + if new_eip as u32 > cs_descriptor.effective_limit() { + dbg_log!( + "#gp iret: new_eip > cs_descriptor.effective_limit, new_eip={:x} cs_descriptor.effective_limit={:x}", + new_eip as u32, + cs_descriptor.effective_limit() + ); + trigger_gp(new_cs & !3); + return; + } if !cs_descriptor.is_present() { panic!("not present");