[PATCH 1/7] x86/emul: ASSERT that X86EMUL_DONE doesn't escape to callers

Andrew Cooper posted 7 patches 11 months, 4 weeks ago
[PATCH 1/7] x86/emul: ASSERT that X86EMUL_DONE doesn't escape to callers
Posted by Andrew Cooper 11 months, 4 weeks ago
This property is far from clear.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Jinoh Kang <jinoh.kang.kr@gmail.com>

v2:
 * New
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index e88245eae9fb..94caec1d142c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8651,6 +8651,12 @@ int x86_emulate_wrapper(
 
     rc = x86_emulate(ctxt, ops);
 
+    /*
+     * X86EMUL_DONE is an internal signal in the emulator, and is not expected
+     * to ever escape out to callers.
+     */
+    ASSERT(rc != X86EMUL_DONE);
+
     /*
      * Most retire flags should only be set for successful instruction
      * emulation.
-- 
2.30.2


Re: [PATCH 1/7] x86/emul: ASSERT that X86EMUL_DONE doesn't escape to callers
Posted by Jan Beulich 11 months, 3 weeks ago
On 15.09.2023 22:36, Andrew Cooper wrote:
> This property is far from clear.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>