]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86/mmu: Rephrase comment about synthetic PFERR flags in #PF handler
authorSean Christopherson <seanjc@google.com>
Sat, 8 Jun 2024 00:11:08 +0000 (17:11 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 14 Jun 2024 16:20:47 +0000 (09:20 -0700)
Reword the BUILD_BUG_ON() comment in the legacy #PF handler to explicitly
describe how asserting that synthetic PFERR flags are limited to bits 31:0
protects KVM against inadvertently passing a synthetic flag to the common
page fault handler.

No functional change intended.

Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240608001108.3296879-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c

index fd5378b72896f4f01fa51f28b768b9732e55bdc3..46103e3eda306d13e54bd5db1899c37bbd9f38fa 100644 (file)
@@ -4552,7 +4552,10 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
        if (WARN_ON_ONCE(error_code >> 32))
                error_code = lower_32_bits(error_code);
 
-       /* Ensure the above sanity check also covers KVM-defined flags. */
+       /*
+        * Restrict KVM-defined flags to bits 63:32 so that it's impossible for
+        * them to conflict with #PF error codes, which are limited to 32 bits.
+        */
        BUILD_BUG_ON(lower_32_bits(PFERR_SYNTHETIC_MASK));
 
        vcpu->arch.l1tf_flush_l1d = true;