diff options
author | Ackerley Tng <ackerleytng@google.com> | 2024-03-15 02:26:23 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-04-29 22:55:10 +0300 |
commit | 0d95817e075314706b3e4086080a9bbb1421634c (patch) | |
tree | 6ea4d9590eb36fb0e033a9a7e5710a87d397eb94 /tools | |
parent | 3a085fbf8228cfcdbf48ded8915618e10226f2e3 (diff) | |
download | linux-0d95817e075314706b3e4086080a9bbb1421634c.tar.xz |
KVM: selftests: Fix off-by-one initialization of GDT limit
Fix an off-by-one bug in the initialization of the GDT limit, which as
defined in the SDM is inclusive, not exclusive.
Note, vcpu_init_descriptor_tables() gets the limit correct, it's only
vcpu_setup() that is broken, i.e. only tests that _don't_ invoke
vcpu_init_descriptor_tables() can have problems. And the fact that KVM
effectively initializes the GDT twice will be cleaned up in the near
future.
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
[sean: rewrite changelog]
Link: https://lore.kernel.org/r/20240314232637.2538648-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index f2506b9edb37..a04c2e623d09 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -523,7 +523,7 @@ static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt) vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA); dt->base = vm->arch.gdt; - dt->limit = getpagesize(); + dt->limit = getpagesize() - 1; } static void kvm_setup_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp, |