]> git.baikalelectronics.ru Git - kernel.git/commit
kvm/x86: Avoid clearing the C-bit in rsvd_bits()
authorBrijesh Singh <brijesh.singh@amd.com>
Fri, 25 Aug 2017 20:55:40 +0000 (15:55 -0500)
committerIngo Molnar <mingo@kernel.org>
Sat, 26 Aug 2017 07:23:00 +0000 (09:23 +0200)
commit9bdfe1ec9cba6f36dbdcae045e0d41b8ca40e753
tree8634800519b50832e143d26d3058122db858ece2
parentb1375c65c61cbb2085964bd794f5f4274150cdd4
kvm/x86: Avoid clearing the C-bit in rsvd_bits()

The following commit:

  262db3171412 ("kvm/x86/svm: Support Secure Memory Encryption within KVM")

uses __sme_clr() to remove the C-bit in rsvd_bits(). rsvd_bits() is
just a simple function to return some 1 bits. Applying a mask based
on properties of the host MMU is incorrect. Additionally, the masks
computed by __reset_rsvds_bits_mask also apply to guest page tables,
where the C bit is reserved since we don't emulate SME.

The fix is to clear the C-bit from rsvd_bits_mask array after it has been
populated from __reset_rsvds_bits_mask()

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: kvm@vger.kernel.org
Cc: paolo.bonzini@gmail.com
Fixes: 262db31 ("kvm/x86/svm: Support Secure Memory Encryption within KVM")
Link: http://lkml.kernel.org/r/20170825205540.123531-1-brijesh.singh@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h