mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/emulate: check cpl for all privileged instructions
Without this, it is possible for userspace to load its own IDT or GDT.
This is XSA-105.
Reported-by: Andrei LUTAS <vlutas@bitdefender.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrei LUTAS <vlutas@bitdefender.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 0e442727ce
master date: 2014-09-23 14:33:06 +0200
This commit is contained in:
1 parent
b2fe29bc7c
commit
e66d14038c
1 file changed
+3
@@ -3293,6 +3293,7 @@ x86_emulate(
|
||||
goto swint;
|
||||
|
||||
case 0xf4: /* hlt */
|
||||
generate_exception_if(!mode_ring0(), EXC_GP, 0);
|
||||
ctxt->retire.flags.hlt = 1;
|
||||
break;
|
||||
|
||||
@@ -3718,6 +3719,7 @@ x86_emulate(
|
||||
break;
|
||||
case 2: /* lgdt */
|
||||
case 3: /* lidt */
|
||||
generate_exception_if(!mode_ring0(), EXC_GP, 0);
|
||||
generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);
|
||||
fail_if(ops->write_segment == NULL);
|
||||
memset(®, 0, sizeof(reg));
|
||||
@@ -3746,6 +3748,7 @@ x86_emulate(
|
||||
case 6: /* lmsw */
|
||||
fail_if(ops->read_cr == NULL);
|
||||
fail_if(ops->write_cr == NULL);
|
||||
generate_exception_if(!mode_ring0(), EXC_GP, 0);
|
||||
if ( (rc = ops->read_cr(0, &cr0, ctxt)) )
|
||||
goto done;
|
||||
if ( ea.type == OP_REG )
|
||||
|
||||