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.xen.org>
Subject: Re: [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point
Date: Mon, 22 Jan 2018 05:06:03 -0700	[thread overview]
Message-ID: <5A65E1BB02000078001A103D@prv-mh.provo.novell.com> (raw)
In-Reply-To: <26535bac-c79e-014f-924c-cfbe7aa3702b@citrix.com>

>>> On 22.01.18 at 12:42, <andrew.cooper3@citrix.com> wrote:
> On 19/01/18 13:51, Jan Beulich wrote:
>>>>> On 19.01.18 at 14:36, <andrew.cooper3@citrix.com> wrote:
>>> On 19/01/18 11:43, Jan Beulich wrote:
>>>>>>> On 18.01.18 at 16:46, <andrew.cooper3@citrix.com> wrote:
>>>>> @@ -729,6 +760,9 @@ ENTRY(nmi)
>>>>>  handle_ist_exception:
>>>>>          SAVE_ALL CLAC
>>>>>  
>>>>> +        SPEC_CTRL_ENTRY_FROM_INTR /* Req: %rsp=regs, Clob: acd */
>>>>> +        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
>>>> Following my considerations towards alternative patching to
>>>> eliminate as much overhead as possible from the Meltdown
>>>> band-aid in case it is being disabled, I'm rather hesitant to see any
>>>> patchable code being introduced into the NMI/#MC entry paths
>>>> without the patching logic first being made safe in this regard.
>>>> Exceptions coming here aren't very frequent (except perhaps on
>>>> hardware about to die), so the path isn't performance critical.
>>>> Therefore I think we should try to avoid any patching here, and
>>>> just conditionals instead. This in fact is one of the reasons why I
>>>> didn't want to macro-ize the assembly additions done in the
>>>> Meltdown band-aid.
>>>>
>>>> I do realize that this then also affects the exit-to-Xen path,
>>>> which I agree is less desirable to use conditionals on.
>>> While I agree that our lack of IST-safe patching is a problem, these
>>> alternative points are already present on the NMI and MCE paths, and
>>> need to be.  As a result, the DF handler is in no worse of a position. 
>>> As a perfect example, observe the CLAC in context.
>> Oh, indeed. We should change that.
>>
>>> I could perhaps be talked into making a SPEC_CTRL_ENTRY_FROM_IST variant
>>> which doesn't use alternatives (but IMO this is pointless in the
>>> presence of CLAC), but still don't think it is reasonable to treat DF
>>> differently to NMI/MCE.
>> #DF is debatable: On one hand I can see that if things go wrong,
>> it can equally be raised at any time. Otoh #MC and even more so
>> NMI can be raised _without_ things going (fatally) wrong, i.e. the
>> patching may break a boot which would otherwise have succeeded
>> (whereas the #DF would make the boot fail anyway).
> 
> I don't see a conclusion here, or a reason for treating #DF differently
> to NMI or #MC.

Odd - I thought my reply was pretty clear in this regard. I have
no good idea how to word it differently. Furthermore the goal
of the reply was not to settle on how to treat #DF, but to try
to convince you to avoid adding more patch points to the NMI /
#MC path (if you want #DF treated similarly, I wouldn't
object patching to be avoided there too).

> There is currently a very very slim race on boot where an NMI or #MC
> hitting the main application of alternatives may cause Xen to explode. 
> This has been the case since alternatives were introduced, and this
> patch doesn't make the problem meaningfully worse.

SMAP patching affects 3 bytes (and I'm intending to put together a
patch removing that patching from the NMI / #MC path), while you
add patching of quite a few more bytes, increasing the risk
accordingly.

If you really don't want to switch away from the patching approach,
I won't refuse to ack the patch. But it'll mean subsequent changes
will be more intrusive, to get this converted to conditionals instead
(unless someone has _immediate_ plans to deal with the issues in
the patching logic itself).

Jan


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

  reply	other threads:[~2018-01-22 12:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 15:45 [PATCH v9 00/11] x86: Mitigations for SP2/CVE-2017-5715/Branch Target Injection Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 01/11] x86/thunk: Fix GEN_INDIRECT_THUNK comment Andrew Cooper
2018-01-18 16:06   ` Jan Beulich
2018-01-18 15:46 ` [PATCH v9 02/11] x86/cpuid: Handling of IBRS/IBPB, STIBP and IBRS for guests Andrew Cooper
2018-01-19 10:40   ` Jan Beulich
2018-01-19 10:53     ` Andrew Cooper
2018-01-19 11:46       ` Jan Beulich
2018-01-19 12:01         ` Andrew Cooper
2018-01-19 12:11           ` Jan Beulich
2018-01-19 12:36             ` Andrew Cooper
2018-01-19 12:52               ` Jan Beulich
2018-01-19 13:06                 ` Andrew Cooper
2018-01-19 13:33                   ` Jan Beulich
2018-01-19 15:00                     ` Andrew Cooper
2018-01-19 15:09                       ` Jan Beulich
2018-01-18 15:46 ` [PATCH v9 03/11] x86/msr: Emulation of MSR_{SPEC_CTRL, PRED_CMD} " Andrew Cooper
2018-01-19 10:45   ` Jan Beulich
2018-01-19 11:05     ` Andrew Cooper
2018-01-22 14:50     ` Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 04/11] x86/migrate: Move MSR_SPEC_CTRL on migrate Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 05/11] x86/hvm: Permit guests direct access to MSR_{SPEC_CTRL, PRED_CMD} Andrew Cooper
2018-01-18 18:04   ` Boris Ostrovsky
2018-01-19 10:52   ` Jan Beulich
2018-01-19 10:54     ` Andrew Cooper
2018-01-22  1:47   ` Tian, Kevin
2018-01-18 15:46 ` [PATCH v9 06/11] x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point Andrew Cooper
2018-01-19 10:39   ` Andrew Cooper
2018-01-19 11:43   ` Jan Beulich
2018-01-19 13:36     ` Andrew Cooper
2018-01-19 13:51       ` Jan Beulich
2018-01-22 11:42         ` Andrew Cooper
2018-01-22 12:06           ` Jan Beulich [this message]
2018-01-22 13:52             ` Andrew Cooper
2018-01-22 22:27       ` Boris Ostrovsky
2018-01-23  0:17         ` Andrew Cooper
2018-01-23  2:19           ` Boris Ostrovsky
2018-01-23 20:00             ` Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 07/11] x86/boot: Calculate the most appropriate BTI mitigation to use Andrew Cooper
2018-01-19 12:06   ` Jan Beulich
2018-01-19 13:48     ` Andrew Cooper
2018-01-19 14:01   ` Jan Beulich
2018-01-22 15:11     ` Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 08/11] x86/entry: Clobber the Return Stack Buffer/Return Address Stack on entry to Xen Andrew Cooper
2018-01-19 12:47   ` Jan Beulich
2018-01-19 14:24     ` Andrew Cooper
2018-01-19 15:02       ` Jan Beulich
2018-01-19 16:10         ` Andrew Cooper
2018-01-19 16:19           ` Jan Beulich
2018-01-19 16:43             ` Andrew Cooper
2018-01-22 15:51         ` Andrew Cooper
2018-01-22 16:49           ` Jan Beulich
2018-01-22 17:04             ` Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 09/11] x86/ctxt: Issue a speculation barrier between vcpu contexts Andrew Cooper
2018-01-19 13:25   ` Jan Beulich
2018-01-19 14:48     ` Andrew Cooper
2018-01-19 15:07       ` Jan Beulich
2018-01-20 11:10         ` David Woodhouse
2018-01-22 10:15           ` Jan Beulich
2018-01-18 15:46 ` [PATCH v9 10/11] x86/cpuid: Offer Indirect Branch Controls to guests Andrew Cooper
2018-01-18 15:46 ` [PATCH v9 11/11] x86/idle: Clear SPEC_CTRL while idle Andrew Cooper

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=5A65E1BB02000078001A103D@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.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.