All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>,
	Feng Wu <feng.wu@intel.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: Bisected Xen-unstable: "Segment register inaccessible for d1v0" when starting HVM guest on intel
Date: Wed, 2 Jul 2014 11:02:53 +0100	[thread overview]
Message-ID: <53B3D8CD.1050506@citrix.com> (raw)
In-Reply-To: <53B3F324020000780001F66B@mail.emea.novell.com>

On 02/07/14 10:55, Jan Beulich wrote:
>>>> On 02.07.14 at 11:44, <andrew.cooper3@citrix.com> wrote:
>> On 02/07/14 10:28, Jan Beulich wrote:
>>> This being a PV extension to the base architecture, the hardware
>>> specification is meaningless. What we need to do here is _extend_ what
>>> the hardware has specified for those extra accesses. We have three
>>> options basically:
>>> 1) never do any checking on such accesses
>>> 2) honor CPL and EFLAGS.AC
>>> 3) always do the checking
>>> The first one obviously is bad from a security POV. Since the third one is
>>> more strict than the second and since I assume adding some override is
>>> going to be the simpler change than altering the point in time when the
>>> VMCS gets loaded during context switch (the suggestion of which no one
>>> at all commented on so far), I'd prefer that one, but wouldn't mind
>>> option 2 to be implemented instead.
>> The problem is not the hypervisor check.  We are already deep within an
>> hvm_copy_to_user() which is between a stac()/clac() pair.
>>
>> The issue is that guest_walk_tables() is checking a Xen access using
>> guest page tables as if it were a supervisor access given the current
>> context of the vcpu.
> And I only ever referred to the checking done there; the hypervisor
> access is of no concern here.
>
>> What can/should Xen do if its emulated access fails with a guest SMAP
>> violations?  It certainly can't/shouldn't inject a pagefault, nor should
>> it actually fail the write.  copy_to_user() is not subject to the guest
>> operating mode and whether we are writing into guest user or supervisor
>> pages.
> Just like copy_to_user() would produce -EFAULT for a hypercall
> when used on a non-present page or a non-canonical address, it
> should (and afaict will with how things are right now) similarly
> produce -EFAULT for an attempted access to a guest-accessible
> page when the current mode of the guest is supervisor.
>
> To me it is a logical extension to also fail accesses outside of
> hypercalls or emulation.
>
> Jan

Consider an HVM guest with SMAP in effect, making a hypercall.  If a
guest handle points to guest userspace, Xen would be unable to ever
complete the hypercall without an -EFAULT.

I don't think this is reasonable to fail.

~Andrew

  reply	other threads:[~2014-07-02 10:02 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 20:21 Bisected Xen-unstable: "Segment register inaccessible for d1v0" when starting HVM guest on intel Sander Eikelenboom
2014-06-30 15:45 ` Jan Beulich
2014-06-30 16:37   ` Sander Eikelenboom
2014-06-30 17:31     ` Andrew Cooper
2014-07-01  5:05       ` Wu, Feng
2014-07-01  7:01         ` Jan Beulich
2014-07-01  9:03           ` Wu, Feng
2014-07-01  9:39             ` Jan Beulich
2014-07-01  9:49               ` Jan Beulich
2014-07-02  4:23               ` Wu, Feng
2014-07-02  7:02                 ` Jan Beulich
2014-07-02  7:32                   ` Wu, Feng
2014-07-02  7:50                     ` Jan Beulich
2014-07-02  9:14                       ` Wu, Feng
2014-07-02  9:28                         ` Jan Beulich
2014-07-02  9:44                           ` Andrew Cooper
2014-07-02  9:55                             ` Jan Beulich
2014-07-02 10:02                               ` Andrew Cooper [this message]
2014-07-02 10:07                                 ` Jan Beulich
2014-07-02 10:37                                   ` Andrew Cooper
2014-07-02 12:08                               ` Wu, Feng
2014-07-02 12:34                                 ` Jan Beulich
2014-07-02 13:15                           ` Wu, Feng
2014-07-02 13:22                             ` Jan Beulich
2014-07-03  6:15                               ` Wu, Feng
2014-07-03  6:49                                 ` Jan Beulich
2014-07-03  8:17                                   ` Wu, Feng
2014-07-03  8:59                                     ` Jan Beulich
2014-07-03  9:24                                       ` Wu, Feng
2014-07-03  9:32                                         ` Jan Beulich
2014-07-03 13:04                                   ` Wu, Feng
2014-07-03 13:21                                     ` Jan Beulich
2014-07-03 13:34                                       ` Wu, Feng
2014-07-04  2:51     ` Wu, Feng
2014-07-04  6:50       ` Jan Beulich
2014-07-04  6:58         ` Wu, Feng
2014-07-04  7:11           ` Jan Beulich
2014-07-04  8:54             ` Wu, Feng
2014-07-04  9:04               ` Jan Beulich
2014-07-04  9:08                 ` Wu, Feng
2014-07-07 20:48                   ` Konrad Rzeszutek Wilk
2014-07-07 22:26                     ` Wu, Feng

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=53B3D8CD.1050506@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=feng.wu@intel.com \
    --cc=linux@eikelenboom.it \
    --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.