mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86: Restore all 64 bits of DR6 and DR7 during RSM on x86-64
Date: Fri, 5 Feb 2021 09:15:43 +0100	[thread overview]
Message-ID: <4ed4e33e-191d-1ee9-eee5-1c5a8a553b41@redhat.com> (raw)
In-Reply-To: <20210205012458.3872687-3-seanjc@google.com>

On 05/02/21 02:24, Sean Christopherson wrote:
> Restore the full 64-bit values of DR6 and DR7 when emulating RSM on
> x86-64, as defined by both Intel's SDM and AMD's APM.
> 
> Note, bits 63:32 of DR6 and DR7 are reserved, so this is a glorified nop
> unless the SMM handler is poking into SMRAM, which it most definitely
> shouldn't be doing since both Intel and AMD list the DR6 and DR7 fields
> as read-only.
> 
> Fixes: 660a5d517aaa ("KVM: x86: save/load state on SMM switch")
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>   arch/x86/kvm/emulate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2e6e6c39922f..72a1bd04dfe1 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2564,12 +2564,12 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt,
>   	ctxt->_eip   = GET_SMSTATE(u64, smstate, 0x7f78);
>   	ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED;
>   
> -	val = GET_SMSTATE(u32, smstate, 0x7f68);
> +	val = GET_SMSTATE(u64, smstate, 0x7f68);
>   
>   	if (ctxt->ops->set_dr(ctxt, 6, val))
>   		return X86EMUL_UNHANDLEABLE;
>   
> -	val = GET_SMSTATE(u32, smstate, 0x7f60);
> +	val = GET_SMSTATE(u64, smstate, 0x7f60);
>   
>   	if (ctxt->ops->set_dr(ctxt, 7, val))
>   		return X86EMUL_UNHANDLEABLE;
> 

Queued, thanks.

Paolo


      reply	other threads:[~2021-02-05  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05  1:24 [PATCH 0/2] KVM: x86: RSM emulation DR6/DR7 cleanups Sean Christopherson
2021-02-05  1:24 ` [PATCH 1/2] KVM: x86: Remove misleading DR6/DR7 adjustments from RSM emulation Sean Christopherson
2021-02-05  1:24 ` [PATCH 2/2] KVM: x86: Restore all 64 bits of DR6 and DR7 during RSM on x86-64 Sean Christopherson
2021-02-05  8:15   ` Paolo Bonzini [this message]

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=4ed4e33e-191d-1ee9-eee5-1c5a8a553b41@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®