public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Kevin Cheng <chengkev@google.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,  yosry.ahmed@linux.dev
Subject: Re: [PATCH V2 2/4] KVM: SVM: Fix nested NPF injection to set PFERR_GUEST_{PAGE,FINAL}_MASK
Date: Tue, 24 Feb 2026 08:53:58 -0800	[thread overview]
Message-ID: <aZ3Xpq_v4q8bpGrJ@google.com> (raw)
In-Reply-To: <aZ3VCq4s7l9f4JTw@google.com>

On Tue, Feb 24, 2026, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
> > index 37eba7dafd14f..f148c92b606ba 100644
> > --- a/arch/x86/kvm/mmu/paging_tmpl.h
> > +++ b/arch/x86/kvm/mmu/paging_tmpl.h
> > @@ -385,18 +385,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
> >  		real_gpa = kvm_translate_gpa(vcpu, mmu, gfn_to_gpa(table_gfn),
> >  					     nested_access, &walker->fault);
> >  
> > -		/*
> > -		 * FIXME: This can happen if emulation (for of an INS/OUTS
> > -		 * instruction) triggers a nested page fault.  The exit
> > -		 * qualification / exit info field will incorrectly have
> > -		 * "guest page access" as the nested page fault's cause,
> > -		 * instead of "guest page structure access".  To fix this,
> > -		 * the x86_exception struct should be augmented with enough
> > -		 * information to fix the exit_qualification or exit_info_1
> > -		 * fields.
> > -		 */
> > -		if (unlikely(real_gpa == INVALID_GPA))
> > +		if (unlikely(real_gpa == INVALID_GPA)) {
> > +#if PTTYPE != PTTYPE_EPT
> 
> I would rather swap the order of patches two and three, so that we end up with
> a "positive" if-statement.  I.e. add EPT first so that we get (spoiler alert):
> 
> #if PTTYPE == PTTYPE_EPT
> 			walker->fault.exit_qualification |= EPT_VIOLATION_GVA_IS_VALID;
> #else
> 			walker->fault.error_code |= PFERR_GUEST_PAGE_MASK;
> #endif

Scratch this comment, I got my walkers confused.

  reply	other threads:[~2026-02-24 16:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24  7:18 [PATCH V2 0/4] KVM: X86: Correctly populate nested page fault Kevin Cheng
2026-02-24  7:18 ` [PATCH V2 1/4] KVM: x86: Widen x86_exception's error_code to 64 bits Kevin Cheng
2026-02-24  7:18 ` [PATCH V2 2/4] KVM: SVM: Fix nested NPF injection to set PFERR_GUEST_{PAGE,FINAL}_MASK Kevin Cheng
2026-02-24 16:42   ` Sean Christopherson
2026-02-24 16:53     ` Sean Christopherson [this message]
2026-03-05  3:50     ` Kevin Cheng
2026-03-05 19:46       ` Sean Christopherson
2026-03-13  4:50     ` Kevin Cheng
2026-03-13  5:36       ` Kevin Cheng
2026-02-24  7:18 ` [PATCH V2 3/4] KVM: VMX: Don't consult original exit qualification for nested EPT violation injection Kevin Cheng
2026-02-24 17:31   ` Sean Christopherson
2026-02-24 19:00     ` Yosry Ahmed
2026-02-24 19:37       ` Sean Christopherson
2026-02-24 19:42         ` Yosry Ahmed
2026-02-24 20:28           ` Sean Christopherson
2026-02-24  7:18 ` [PATCH V2 4/4] KVM: selftests: Add nested page fault injection test Kevin Cheng
2026-02-24 17:37   ` Sean Christopherson
2026-03-05  3:54     ` Kevin Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZ3Xpq_v4q8bpGrJ@google.com \
    --to=seanjc@google.com \
    --cc=chengkev@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yosry.ahmed@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox