Re: [PATCH v3 10/16] KVM: selftests: Reuse virt mapping functions for nested EPTs
From: Yosry Ahmed
Date: Tue Dec 23 2025 - 18:47:43 EST
On Tue, Dec 23, 2025 at 03:14:28PM -0800, Sean Christopherson wrote:
> On Thu, Nov 27, 2025, Yosry Ahmed wrote:
> > + /*
> > + * EPTs do not have 'present' or 'user' bits, instead bit 0 is the
> > + * 'readable' bit. In some cases, EPTs can be execute-only and an entry
> > + * is present but not readable. However, for the purposes of testing we
> > + * assume 'present' == 'user' == 'readable' for simplicity.
> > + */
> > + pte_masks = (struct pte_masks){
> > + .present = BIT_ULL(0),
> > + .user = BIT_ULL(0),
> > + .writable = BIT_ULL(1),
> > + .x = BIT_ULL(2),
> > + .accessed = BIT_ULL(5),
> > + .dirty = BIT_ULL(6),
>
> Almost forgot, the Accessed and Dirty bits are wrong. They are bits 8 and 9
> respectively, not 5 and 6. Amusingly (well, it's amusing *now*, it wasn't so
> amusing at the time), I found that out when I couldn't get KVM to create a writable
> SPTE on a read fault in the nested dirty log test :-)
Instead of being a reasonable person and own up to my mistake, I will
blame Intel for putting the bits there to begin with :P
(But seriously, sorry for such a dumb mistake)