• Krish Sadhukhan's avatar
    nSVM: Test non-MBZ reserved bits in CR3 in long mode and legacy PAE mode · 6d0ecbf6
    Krish Sadhukhan authored
    According to section "CR3" in APM vol. 2, the non-MBZ reserved bits in CR3
    need to be set by software as follows:
    
    	"Reserved Bits. Reserved fields should be cleared to 0 by software
    	when writing CR3."
    
    But experiments show that consistency checking in SVM ignores these
    non-MBZ-reserved bits in CR3, meaning they can be set to 1 also. However,
    setting them to 1 may cause guest crashes in some modes and in bare metal
    environments. Hence, this test induces an #NPF by clearing the "P" bit in
    the highest level page table, when testing the 1-setting of these bits.
    Inducing an #NPF causes the guest to exit to userspace before any guest
    instruction is executed thus avoiding any crash.
    Signed-off-by: default avatarKrish Sadhukhan <krish.sadhukhan@oracle.com>
    Message-Id: <20201006190654.32305-4-krish.sadhukhan@oracle.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    6d0ecbf6
svm_tests.c 58 KB