Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
xen.3679
58343f44-x86-svm-fix-injection-of-software-inte...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 58343f44-x86-svm-fix-injection-of-software-interrupts.patch of Package xen.3679
Subject: x86/svm: fix injection of software interrupts From: Andrew Cooper andrew.cooper3@citrix.com Tue Nov 22 14:29:50 2016 +0100 Date: Tue Nov 22 14:29:50 2016 +0100: Git: 387b8aef1824af3d6d99652f971042b43f62c064 The non-NextRip logic in c/s 36ebf14eb "x86/emulate: support for emulating software event injection" was based on an older version of the AMD software manual. The manual was later corrected, following findings from that series. I took the original wording of "not supported without NextRIP" to mean that X86_EVENTTYPE_SW_INTERRUPT was not eligible for use. It turns out that this is not the case, and the new wording is clearer on the matter. Despite testing the original patch series on non-NRip hardware, the swint-emulation XTF test case focuses on the debug vectors; it never ended up executing an `int $n` instruction for a vector which wasn't also an exception. During a vmentry, the use of X86_EVENTTYPE_HW_EXCEPTION comes with a vector check to ensure that it is only used with exception vectors. Xen's use of X86_EVENTTYPE_HW_EXCEPTION for `int $n` injection has always been buggy on AMD hardware. Fix this by always using X86_EVENTTYPE_SW_INTERRUPT. Print and decode the eventinj information in svm_vmcb_dump(), as it has several invalid combinations which cause vmentry failures. This is CVE-2016-9378 / part of XSA-196. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> master commit: 920edccd41db6cb0145545afa1850edf5e7d098e master date: 2016-11-22 13:51:16 +0100 diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 7952565..e729480 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1229,17 +1229,14 @@ static void svm_inject_trap(struct hvm_trap *trap) { case X86_EVENTTYPE_SW_INTERRUPT: /* int $n */ /* - * Injection type 4 (software interrupt) is only supported with - * NextRIP support. Without NextRIP, the emulator will have performed - * DPL and presence checks for us. + * Software interrupts (type 4) cannot be properly injected if the + * processor doesn't support NextRIP. Without NextRIP, the emulator + * will have performed DPL and presence checks for us, and will have + * moved eip forward if appropriate. */ if ( cpu_has_svm_nrips ) - { vmcb->nextrip = regs->eip + _trap.insn_len; - event.fields.type = X86_EVENTTYPE_SW_INTERRUPT; - } - else - event.fields.type = X86_EVENTTYPE_HW_EXCEPTION; + event.fields.type = X86_EVENTTYPE_SW_INTERRUPT; break; case X86_EVENTTYPE_PRI_SW_EXCEPTION: /* icebp */ diff --git a/xen/arch/x86/hvm/svm/svmdebug.c b/xen/arch/x86/hvm/svm/svmdebug.c index ce7d055..3ef360b 100644 --- a/xen/arch/x86/hvm/svm/svmdebug.c +++ b/xen/arch/x86/hvm/svm/svmdebug.c @@ -49,6 +49,10 @@ void svm_vmcb_dump(const char *from, struct vmcb_struct *vmcb) vmcb->tlb_control, (unsigned long long)vmcb->_vintr.bytes, (unsigned long long)vmcb->interrupt_shadow); + printk("eventinj %016"PRIx64", valid? %d, ec? %d, type %u, vector %#x\n", + vmcb->eventinj.bytes, vmcb->eventinj.fields.v, + vmcb->eventinj.fields.ev, vmcb->eventinj.fields.type, + vmcb->eventinj.fields.vector); printk("exitcode = %#Lx exitintinfo = %#Lx\n", (unsigned long long)vmcb->exitcode, (unsigned long long)vmcb->exitintinfo.bytes);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor