* [PATCH] x86/pv: Check that emulate_privileged_op() don't change any unexpected flags
@ 2017-01-16 13:03 Andrew Cooper
2017-01-16 13:20 ` Jan Beulich
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2017-01-16 13:03 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Jan Beulich
No bits, other than arithmetic ones and the resume flag (which will most
likely change from 1 to 0), can be changed by the instructions we permit.
Extend the check to cover other flags.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
v2:
* Extend to all unexpected bits.
---
xen/arch/x86/traps.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 4f29c3a..ea0ce52 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3012,9 +3012,11 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
/*
* Un-mirror virtualized state from EFLAGS.
- * Nothing we allow to be emulated can change TF, IF, or IOPL.
+ * Nothing we allow to be emulated can change anything other than the
+ * arithmetic bits, and the resume flag.
*/
- ASSERT(!((regs->_eflags ^ eflags) & (X86_EFLAGS_IF | X86_EFLAGS_IOPL)));
+ ASSERT(!((regs->_eflags ^ eflags) &
+ ~(X86_EFLAGS_RF | X86_EFLAGS_ARITH_MASK)));
regs->_eflags |= X86_EFLAGS_IF;
regs->_eflags &= ~X86_EFLAGS_IOPL;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/pv: Check that emulate_privileged_op() don't change any unexpected flags
2017-01-16 13:03 [PATCH] x86/pv: Check that emulate_privileged_op() don't change any unexpected flags Andrew Cooper
@ 2017-01-16 13:20 ` Jan Beulich
0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2017-01-16 13:20 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Xen-devel
>>> On 16.01.17 at 14:03, <andrew.cooper3@citrix.com> wrote:
> No bits, other than arithmetic ones and the resume flag (which will most
> likely change from 1 to 0), can be changed by the instructions we permit.
> Extend the check to cover other flags.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-16 13:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 13:03 [PATCH] x86/pv: Check that emulate_privileged_op() don't change any unexpected flags Andrew Cooper
2017-01-16 13:20 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.