All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: emulate reserved nops from 0f/18 to 0f/1f
Date: Mon, 18 May 2020 09:07:20 -0700	[thread overview]
Message-ID: <20200518160720.GB3632@linux.intel.com> (raw)
In-Reply-To: <20200515161919.29249-1-pbonzini@redhat.com>

On Fri, May 15, 2020 at 12:19:19PM -0400, Paolo Bonzini wrote:
> Instructions starting with 0f18 up to 0f1f are reserved nops, except those
> that were assigned to MPX.

Well, they're probably reserved NOPs again :-D.

> These include the endbr markers used by CET.

And RDSPP.  Wouldn't it make sense to treat RDSPP as a #UD even though it's
a NOP if CET is disabled?  The logic being that a sane guest will execute
RDSSP iff CET is enabled, and in that case it'd be better to inject a #UD
than to silently break the guest.

Extending that logic to future features, wouldn't it then make sense to
keep the current #UD behavior for all opcodes to avoid silently breakage?
I.e. change only the opcodes for endbr (which consume only 2 of 255 ModRMs
for 0f 1e) to be NOPs.

> List them correctly in the opcode table.
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/kvm/emulate.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index de5476f8683e..d0e2825ae617 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -4800,8 +4800,12 @@ static const struct opcode twobyte_table[256] = {
>  	GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_10_0f_11),
>  	GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_10_0f_11),
>  	N, N, N, N, N, N,
> -	D(ImplicitOps | ModRM | SrcMem | NoAccess),
> -	N, N, N, N, N, N, D(ImplicitOps | ModRM | SrcMem | NoAccess),
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), /* 4 * prefetch + 4 * reserved NOP */
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), N, N,
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), /* 8 * reserved NOP */
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), /* 8 * reserved NOP */
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), /* 8 * reserved NOP */
> +	D(ImplicitOps | ModRM | SrcMem | NoAccess), /* NOP + 7 * reserved NOP */
>  	/* 0x20 - 0x2F */
>  	DIP(ModRM | DstMem | Priv | Op3264 | NoMod, cr_read, check_cr_read),
>  	DIP(ModRM | DstMem | Priv | Op3264 | NoMod, dr_read, check_dr_read),
> -- 
> 2.18.2
> 

  reply	other threads:[~2020-05-18 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 16:19 [PATCH] KVM: x86: emulate reserved nops from 0f/18 to 0f/1f Paolo Bonzini
2020-05-18 16:07 ` Sean Christopherson [this message]
2020-05-18 17:37   ` Paolo Bonzini
2020-05-19  6:02     ` Sean Christopherson
2020-05-19  7:43       ` Paolo Bonzini
2020-05-19  7:55         ` Sean Christopherson
2020-05-19  8:06           ` Paolo Bonzini
2020-05-19 15:32             ` Sean Christopherson

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=20200518160720.GB3632@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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.