From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Nadav Amit <nadav.amit@gmail.com>,
Sean Christopherson <sean.j.christopherson@intel.com>
Subject: [kvm-unit-tests PATCH] cstart64: do not assume CR4 should be zero
Date: Wed, 15 Jul 2020 13:52:35 -0700 [thread overview]
Message-ID: <20200715205235.13113-1-sean.j.christopherson@intel.com> (raw)
Explicitly zero cr4 in prepare_64() instead of "zeroing" it in the
common enter_long_mode(). Clobbering cr4 in enter_long_mode() breaks
switch_to_5level(), which sets cr4.LA57 before calling enter_long_mode()
and obviously expects cr4 to be preserved.
Fixes: d86ef58 ("cstart: do not assume CR4 starts as zero")
Cc: Nadav Amit <namit@vmware.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
Two lines of code, two bugs. I'm pretty sure Paolo should win some kind
of award. :-D
x86/cstart64.S | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/x86/cstart64.S b/x86/cstart64.S
index 3ae98d3..2d16688 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -175,8 +175,12 @@ prepare_64:
lgdt gdt64_desc
setup_segments
+ xor %eax, %eax
+ mov %eax, %cr4
+
enter_long_mode:
- mov $(1 << 5), %eax // pae
+ mov %cr4, %eax
+ bts $5, %eax // pae
mov %eax, %cr4
mov pt_root, %eax
--
2.26.0
next reply other threads:[~2020-07-15 20:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 20:52 Sean Christopherson [this message]
2020-07-15 21:46 ` [kvm-unit-tests PATCH] cstart64: do not assume CR4 should be zero Nadav Amit
2020-07-28 21:31 ` Paolo Bonzini
2020-07-28 21:29 ` Paolo Bonzini
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=20200715205235.13113-1-sean.j.christopherson@intel.com \
--to=sean.j.christopherson@intel.com \
--cc=kvm@vger.kernel.org \
--cc=nadav.amit@gmail.com \
--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.