Run user level code in guest in a new KVM selftest

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

 



Hi Sean,

I'm adding a nested exception selftest for FRED, which needs to run
user level code in guest.  I have to add the following hack for that:

diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index d8288374078e..72928c07ccbe 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -159,6 +159,7 @@ static uint64_t *virt_create_upper_pte(struct kvm_vm *vm,

        if (!(*pte & PTE_PRESENT_MASK)) {
                *pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK;
+               *pte |= PTE_USER_MASK;
                if (current_level == target_level)
*pte |= PTE_LARGE_MASK | (paddr & PHYSICAL_PAGE_MASK);
                else
@@ -222,6 +223,7 @@ void __virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, int level)
        TEST_ASSERT(!(*pte & PTE_PRESENT_MASK),
"PTE already present for 4k page at vaddr: 0x%lx\n", vaddr); *pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK | (paddr & PHYSICAL_PAGE_MASK);
+       *pte |= PTE_USER_MASK;
 }

 void virt_arch_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr)


Is there an exiting selftest running user level code in guest?

It seems there is none as the USER bit in PTEs is never set, what have I
missed?

If such a facility doesn't exist, we probably need to find a
clean solution to add the USER bit in user level page table mappings
(which seems not yet clearly defined yet).

Thanks!
    Xin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux