All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Eddie Dong <eddie.dong@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	suravee.suthikulpanit@amd.com
Subject: Re: [PATCH] x86/HVM: only kill guest when unknown VM exit occurred in guest kernel mode
Date: Thu, 30 Oct 2014 11:15:21 -0400	[thread overview]
Message-ID: <54525609.2020708@oracle.com> (raw)
In-Reply-To: <54525C990200007800043915@mail.emea.novell.com>

On 10/30/2014 10:43 AM, 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: Boris Ostrovsky <boris.ostrovsky@oracle.com>


>
> --- 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;
>       }
>   
>
>
>

  parent reply	other threads:[~2014-10-30 15:13 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
2014-10-30 15:14   ` Jan Beulich
2014-10-30 15:15 ` Boris Ostrovsky [this message]
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=54525609.2020708@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=aravind.gopalakrishnan@amd.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.