Skip to content

Commit 53510b9

Browse files
committed
KVM: x86/mmu: Set shadow_dirty_mask for EPT even if A/D bits disabled
Set shadow_dirty_mask to the architectural EPT Dirty bit value even if A/D bits are disabled at the module level, i.e. even if KVM will never enable A/D bits in hardware. Doing so provides consistent behavior for Accessed and Dirty bits, i.e. doesn't leave KVM in a state where it sets shadow_accessed_mask but not shadow_dirty_mask. Functionally, this should be one big nop, as consumption of shadow_dirty_mask is always guarded by a check that hardware A/D bits are enabled. Link: https://lore.kernel.org/r/20241011021051.1557902-12-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 3835819 commit 53510b9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/mmu/spte.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void kvm_mmu_set_ept_masks(bool has_ad_bits, bool has_exec_only)
420420

421421
shadow_user_mask = VMX_EPT_READABLE_MASK;
422422
shadow_accessed_mask = VMX_EPT_ACCESS_BIT;
423-
shadow_dirty_mask = has_ad_bits ? VMX_EPT_DIRTY_BIT : 0ull;
423+
shadow_dirty_mask = VMX_EPT_DIRTY_BIT;
424424
shadow_nx_mask = 0ull;
425425
shadow_x_mask = VMX_EPT_EXECUTABLE_MASK;
426426
/* VMX_EPT_SUPPRESS_VE_BIT is needed for W or X violation. */

0 commit comments

Comments
 (0)