Skip to content

Commit caa7278

Browse files
committed
KVM: x86/mmu: Rephrase comment about synthetic PFERR flags in #PF handler
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 <[email protected]> Reviewed-by: Xiaoyao Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 9ecc1c1 commit caa7278

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4552,7 +4552,10 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
45524552
if (WARN_ON_ONCE(error_code >> 32))
45534553
error_code = lower_32_bits(error_code);
45544554

4555-
/* Ensure the above sanity check also covers KVM-defined flags. */
4555+
/*
4556+
* Restrict KVM-defined flags to bits 63:32 so that it's impossible for
4557+
* them to conflict with #PF error codes, which are limited to 32 bits.
4558+
*/
45564559
BUILD_BUG_ON(lower_32_bits(PFERR_SYNTHETIC_MASK));
45574560

45584561
vcpu->arch.l1tf_flush_l1d = true;

0 commit comments

Comments
 (0)