Skip to contentSkip to conversation

x86/emul: Assert the STI shadow when POPF sets the interrupt flag

PATCH In review Andrew Cooper 2 participants 2 messages Nov 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/emul: Assert the STI shadow when POPF sets the interrupt flag

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/x86_emulate/x86_emulate.c | 6 ++++++
 1 file changed, 6 insertions(+)
xen/arch/x86/x86_emulate/x86_emulate.c +6 -0
index e69dfdd..e93532d 100644
@@ -4061,6 +4061,12 @@ x86_emulate(
             }
         }
         dst.val &= EFLAGS_MODIFIABLE;
+
+        /* When IF transitions from 0 to 1, assert the STI shadow. */
+        if ( !(_regs.eflags & X86_EFLAGS_IF) &&
+             ((dst.val & ~mask) & X86_EFLAGS_IF) )
+            ctxt->retire.sti = true;
+
         _regs.eflags &= mask;
         _regs.eflags |= (dst.val & ~mask) | X86_EFLAGS_MBS;
         break;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

xen/arch/x86/x86_emulate/x86_emulate.c x86_emulate( · line 4068

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.11.18 at 15:09, <[email protected]> wrote:
xen/arch/x86/x86_emulate/x86_emulate.c +5 -0
@@ -4061,6 +4061,12 @@ x86_emulate(
             }
         }
         dst.val &= EFLAGS_MODIFIABLE;
+
+        /* When IF transitions from 0 to 1, assert the STI shadow. */
+        if ( !(_regs.eflags & X86_EFLAGS_IF) &&
+             ((dst.val & ~mask) & X86_EFLAGS_IF) )
+            ctxt->retire.sti = true;

I'm entirely unaware that POPF behaves the same way as STI in this regard. Therefore: Are you sure? Can you point me to where this is spelled out?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel