From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Kevin Tian <kevin.tian@intel.com>,
suravee.suthikulpanit@amd.com, Eddie Dong <eddie.dong@intel.com>,
Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH] x86/HVM: only kill guest when unknown VM exit occurred in guest kernel mode
Date: Thu, 30 Oct 2014 14:57:14 +0000 [thread overview]
Message-ID: <545251CA.1040907@citrix.com> (raw)
In-Reply-To: <54525C990200007800043915@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2840 bytes --]
On 30/10/14 14:43, Jan Beulich wrote:
> A recent KVM change by Nadav Amit <namit@cs.technion.ac.il> pointed out
> that unconditional VM exits (like VMX'es ones for the INVEPT, INVVPID,
> and XSETBV instructions) may result from guest user mode activity (in
> the example cases, e.g. prior to a privilege level check being done).
> Consequently convert the unconditional domain_crash() to a conditional
> one (when guest is in kernel mode) with the alternative of injecting
> #UD (when in user mode).
>
> This is meant to be a precaution against in-guest security issues
> introduced when any such VM exit becomes possible (on newer hardware)
> without the hypervisor immediately being aware of it. There are no such
> unhandled VM exits currently (and hence this is not an active security
> issue), but old (no longer security maintained) versions exhibit issues
> in the cases given as examples above.
>
> Suggested-by: Tim Deegan <tim@xen.org>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
The gdprintk() in vmx.c is not true for some entries via the
exit_and_crash label, but it is probably worth deferring fixing it to a
separate patch.
>
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -2680,7 +2680,11 @@ void svm_vmexit_handler(struct cpu_user_
> "exitinfo1 = %#"PRIx64", exitinfo2 = %#"PRIx64"\n",
> exit_reason,
> (u64)vmcb->exitinfo1, (u64)vmcb->exitinfo2);
> - domain_crash(v->domain);
> + if ( vmcb_get_cpl(vmcb) )
> + hvm_inject_hw_exception(TRAP_invalid_op,
> + HVM_DELIVER_NO_ERROR_CODE);
> + else
> + domain_crash(v->domain);
> break;
> }
>
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3157,8 +3157,19 @@ void vmx_vmexit_handler(struct cpu_user_
> /* fall through */
> default:
> exit_and_crash:
> - gdprintk(XENLOG_ERR, "Bad vmexit (reason %#lx)\n", exit_reason);
> - domain_crash(v->domain);
> + {
> + struct segment_register ss;
> +
> + gdprintk(XENLOG_WARNING, "Bad vmexit (reason %#lx)\n",
> + exit_reason);
> +
> + vmx_get_segment_register(v, x86_seg_ss, &ss);
> + if ( ss.attr.fields.dpl )
> + hvm_inject_hw_exception(TRAP_invalid_op,
> + HVM_DELIVER_NO_ERROR_CODE);
> + else
> + domain_crash(v->domain);
> + }
> break;
> }
>
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 3772 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-10-30 14:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 14:43 [PATCH] x86/HVM: only kill guest when unknown VM exit occurred in guest kernel mode Jan Beulich
2014-10-30 14:57 ` Andrew Cooper [this message]
2014-10-30 15:14 ` Jan Beulich
2014-10-30 15:15 ` Boris Ostrovsky
2014-10-31 6:59 ` Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=545251CA.1040907@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=aravind.gopalakrishnan@amd.com \
--cc=boris.ostrovsky@oracle.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.