All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH v2 09/16] x86: don't setup PV hypercall stubs and entries when !CONFIG_PV
Date: Wed, 31 Oct 2018 02:58:59 -0600	[thread overview]
Message-ID: <5BD96ED302000078001F6A1C@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <07afbc67-eee6-c763-d451-6dcac15e0f74@citrix.com>

>>> On 30.10.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
> On 29/10/18 14:37, Jan Beulich wrote:
>>>>> On 19.10.18 at 17:59, <andrew.cooper3@citrix.com> wrote:
>>> On 19/10/18 15:28, Wei Liu wrote:
>>>> @@ -347,6 +352,7 @@ void subarch_percpu_traps_init(void)
>>>>      /* Common SYSCALL parameters. */
>>>>      wrmsrl(MSR_STAR, XEN_MSR_STAR);
>>>>      wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK);
>>>> +#endif
>>> It would be a wise precaution to initialise these MSRs to 0 in the !PV
>>> case, so we don't retain stale values.
>> If anything, EFER.SCE needs to be kept clear, as that's what
>> controls whether SYSCALL would raise #GP(0).
> 
> I toyed with suggesting this, but I'm not entirely certain.
> 
> SVM unilaterally switches EFER between host and guest context, so will
> preserve whatever value Xen had at VMRUN time.
> 
> Gen 2 VT-x has host/guest load/save support, so can be configured to
> exit in whichever configuration we would like.
> 
> Gen 1 VT-x uses MSR load-save lists, with an optimisation in the case
> that guest == host.  By clearing SCE in Xen context, we miss the
> optimisation in the common case for 64bit guests.
> 
>> But without a
>> PV domain around, nothing can access the host values of
>> these MSRs in the first place, so instead we could simplify
>> some context switching by never restoring host values, and
>> only ever loading guest ones. Except that, of course, VMLOAD
>> is an all-or-nothing insn, and we need to use to get TR loaded.
> 
> The VMLOAD path is a bit of a special case, in that we need to do it,
> and its rather faster than the other available options.  Conditionally
> feeding zeros into this would be fine.
> 
> That said, overall, we may want to leave some poisoned values around. 
> In the case that SCE is enabled and we do hit a spurious SYSCALL/SYSRET
> instruction, it would be better to definitely crash.

I'd be fine with poisoned (but not zero) values, if indeed we mean
to allow for a hypervisor crash in that case (which ought to be
fine, since we're talking about unreachable code anyway). Ideally
"poisoned" would be "non-canonical", but the MSRs don't allow for
non-canonical addresses to be loaded into them, so we'd need to
think of different poisoning values.

Trapping a spurious SYSRET seems impossible though, as EFER.SCE
is the only attribute we control there.

For SYSENTER/SYSEXIT, storing zeros is of course going to be
fine (yielding #GP(0) on both insns).

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-10-31  8:59 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 14:28 [PATCH v2 00/16] Make CONFIG_PV work on x86 Wei Liu
2018-10-19 14:28 ` [PATCH v2 01/16] x86: make mm.c build with !CONFIG_PV Wei Liu
2018-10-26 15:57   ` Jan Beulich
2018-10-19 14:28 ` [PATCH v2 02/16] x86: put some code in arch_set_info_guest under CONFIG_PV Wei Liu
2018-10-26 15:58   ` Jan Beulich
2018-10-19 14:28 ` [PATCH v2 03/16] x86: make traps.c build with !CONFIG_PV Wei Liu
2018-10-26 16:02   ` Jan Beulich
2018-10-30 17:48     ` Wei Liu
2018-10-19 14:28 ` [PATCH v2 04/16] x86: make construct_dom0 " Wei Liu
2018-10-19 15:04   ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 05/16] x86/pv: make guest_io_{read, write} local functions Wei Liu
2018-10-19 15:10   ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 06/16] x86/amd: call post outb hook for both PV and HVM Wei Liu
2018-10-19 15:55   ` Wei Liu
2018-10-29 14:00   ` Jan Beulich
2018-10-19 14:28 ` [PATCH v2 07/16] x86: put XEN_DOMCTL_{set, get}_address_size under CONFIG_PV Wei Liu
2018-10-19 15:18   ` Andrew Cooper
2018-10-30 21:08     ` Wei Liu
2018-10-29 14:28   ` Jan Beulich
2018-10-30 20:50     ` Wei Liu
2018-10-31  9:00       ` Jan Beulich
2018-10-31  9:33         ` Wei Liu
2018-10-31  9:47           ` Jan Beulich
2018-10-31  9:54             ` Wei Liu
2018-10-31 10:12               ` Jan Beulich
2018-10-19 14:28 ` [PATCH v2 08/16] x86: connect guest creation with CONFIG_PV Wei Liu
2018-10-19 15:36   ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 09/16] x86: don't setup PV hypercall stubs and entries when !CONFIG_PV Wei Liu
2018-10-19 15:59   ` Andrew Cooper
2018-10-29 14:37     ` Jan Beulich
2018-10-30 18:08       ` Andrew Cooper
2018-10-31  8:58         ` Jan Beulich [this message]
2018-11-02 12:57           ` Wei Liu
2018-11-02 13:03             ` Jan Beulich
2018-10-29 14:33   ` Jan Beulich
2018-10-19 14:28 ` [PATCH v2 10/16] x86: don't setup legacy syscall vector " Wei Liu
2018-10-19 16:09   ` Andrew Cooper
2018-10-22 11:12     ` Wei Liu
2018-10-22 11:21       ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 11/16] x86: don't set sysenter_entry in vmcs " Wei Liu
2018-10-19 15:42   ` Andrew Cooper
2018-10-19 16:00     ` Wei Liu
2018-10-19 16:16       ` Andrew Cooper
2018-11-02 14:05   ` Wei Liu
2018-11-02 14:32     ` Jan Beulich
2018-11-02 14:33       ` Wei Liu
2018-10-19 14:28 ` [PATCH v2 12/16] x86: stub out PV only code in do_debug Wei Liu
2018-10-19 15:43   ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 13/16] x86: rearrange x86_64/entry.S Wei Liu
2018-10-29 14:57   ` Jan Beulich
2018-11-02 12:54     ` Wei Liu
2018-10-19 14:28 ` [PATCH v2 14/16] x86: make entry point code build when !CONFIG_PV Wei Liu
2018-10-29 15:03   ` Jan Beulich
2018-11-02 13:08     ` Wei Liu
2018-11-02 13:45       ` Jan Beulich
2018-11-02 14:14         ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 15/16] x86: expose CONFIG_PV Wei Liu
2018-10-19 15:51   ` Andrew Cooper
2018-10-19 14:28 ` [PATCH v2 16/16] x86: update help string for CONFIG_HVM Wei Liu
2018-10-19 15:55   ` Andrew Cooper
2018-10-29 14:14   ` Jan Beulich

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=5BD96ED302000078001F6A1C@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.liu2@citrix.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.