Re: [PATCH v5 09/13] KVM: selftests: Do not intercept #PF by default in nVMX tests

From: Yosry Ahmed

Date: Tue Jul 28 2026 - 14:16:48 EST


On Tue, Jul 28, 2026 at 10:42 AM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> init_vmcs_control_fields() sets PFEC_MASK and PFEC_MATCH so that they
> never match, which reverses the meaning of the PF_VECTOR bit in
> EXCEPTION_BITMAP (which is zeroed), effectively enabling #PF
> interception by default.
>
> The relevant part of the SDM describes this:
> When a page fault occurs, a processor consults (1) bit 14
> of the exception bitmap; (2) the error code produced with the page
> fault [PFEC]; (3) the page-fault error-code mask field [PFEC_MASK];
> and (4) the page-fault error-code match field [PFEC_MATCH]. It checks
> if PFEC & PFEC_MASK = PFEC_MATCH. If there is equality, the
> specification of bit 14 in the exception bitmap is followed (for
> example, a VM exit occurs if that bit is set). If there is inequality,
> the meaning of that bit is reversed (for example, a VM exit occurs if
> that bit is clear).
>
> Clear PFEC_MATCH such that there is equality, and the #PF bit in the
> exception bitmap is followed.
>
> Signed-off-by: Yosry Ahmed <yosry@xxxxxxxxxx>

Oh this needs either:

Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>

or

Co-developed-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>