From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jim Mattson <jmattson@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel
Subject: Re: [PATCH 3/3] KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE
Date: Wed, 5 Nov 2025 12:37:37 -0800 [thread overview]
Message-ID: <aQu1keKld2CT0OY5@google.com> (raw)
In-Reply-To: <ek624i3z4e4nwlk36h7frogzgiml47xdzzilu5zuhiyb5gk5eb@tr2a6ptojzyo>
On Wed, Nov 05, 2025, Yosry Ahmed wrote:
> On Wed, Nov 05, 2025 at 11:48:27AM -0800, Sean Christopherson wrote:
> > On Fri, Oct 24, 2025, Yosry Ahmed wrote:
> Looks good with a minor nit:
>
> >
> > /*
> > * Adjust the exit code accordingly if a CR other than CR0 is
> > * being written, and skip straight to the common handling as
> > * only CR0 has an additional selective intercept.
> > */
> > if (info->intercept == x86_intercept_cr_write && info->modrm_reg) {
> > icpt_info.exit_code += info->modrm_reg;
> > break;
> > }
> >
> > /*
> > * Convert the exit_code to SVM_EXIT_CR0_SEL_WRITE if L1 set
> > * INTERCEPT_SELECTIVE_CR0 but not INTERCEPT_CR0_WRITE, as the
> > * unconditional intercept has higher priority.
> > */
>
> We only convert the exict_code to SVM_EXIT_CR0_SEL_WRITE if other
> conditions are true below. So maybe "Check if the exit_code needs to be
> converted to.."?
Ouch, good point. I keep forgetting that the common code below this needs to
check the exit_code against the intercept enables. How about this?
/*
* Convert the exit_code to SVM_EXIT_CR0_SEL_WRITE if a
* selective CR0 intercept is triggered (the common logic will
* treat the selective intercept as being enabled). Note, the
* unconditional intercept has higher priority, i.e. this is
* only relevant if *only* the selective intercept is enabled.
*/
>
> > if (vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_CR0_WRITE) ||
> > !(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_SELECTIVE_CR0)))
> > break;
> >
> >
> > > - info->intercept == x86_intercept_clts)
> > > + vmcb12_is_intercept(&svm->nested.ctl,
> > > + INTERCEPT_CR0_WRITE) ||
> > > + !(vmcb12_is_intercept(&svm->nested.ctl,
> > > + INTERCEPT_SELECTIVE_CR0)))
> >
> > Let these poke out.
>
> Sure. Do you prefer a new version with this + your fixup above, or will
> you fix them up while applying?
If you're happy with it, I'll just fixup when applying.
next prev parent reply other threads:[~2025-11-05 20:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 19:29 [PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection Yosry Ahmed
2025-10-24 19:29 ` [PATCH 1/3] KVM: nSVM: Remove redundant cases in nested_svm_intercept() Yosry Ahmed
2025-10-24 19:29 ` [PATCH 2/3] KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW emulation Yosry Ahmed
2025-11-05 19:44 ` Sean Christopherson
2025-11-05 19:59 ` Yosry Ahmed
2025-10-24 19:29 ` [PATCH 3/3] KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE Yosry Ahmed
2025-11-05 19:48 ` Sean Christopherson
2025-11-05 20:04 ` Yosry Ahmed
2025-11-05 20:37 ` Sean Christopherson [this message]
2025-11-05 21:35 ` Yosry Ahmed
2025-10-24 19:51 ` [PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection Yosry Ahmed
2025-11-10 15:37 ` Sean Christopherson
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=aQu1keKld2CT0OY5@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.