[PATCH 1/2] KVM: selftests: Fix initialization of GDT limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subtract 1 to initialize GDT limit according to spec.

Signed-off-by: Ackerley Tng <ackerleytng@xxxxxxxxxx>
---
 tools/testing/selftests/kvm/lib/x86_64/processor.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index acfa1d01e7df..33ca7f5232a4 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -502,7 +502,12 @@ static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt)
 		vm->gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA);
 
 	dt->base = vm->gdt;
-	dt->limit = getpagesize();
+
+	/*
+	 * Intel SDM Volume 3, 3.5.1: "the GDT limit should always be one less
+	 * than an integral multiple of eight"
+	 */
+	dt->limit = getpagesize() - 1;
 }
 
 static void kvm_setup_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp,
-- 
2.39.0.314.g84b9a713c41-goog




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux