public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Chao Gao <chao.gao@intel.com>, Xin Li <xin@zytor.com>,
	Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: Re: [PATCH v3 3/4] KVM: nVMX: Disallow access to vmcs12 fields that aren't supported by "hardware"
Date: Fri, 9 Jan 2026 06:44:29 -0800	[thread overview]
Message-ID: <aWEUTQeNXugBYAZA@google.com> (raw)
In-Reply-To: <288eaa68-7d4d-4c1b-ae70-419554d1d8f2@intel.com>

On Fri, Jan 09, 2026, Xiaoyao Li wrote:
> On 1/9/2026 12:15 PM, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index 61113ead3d7b..ac7a17560c8f 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> > @@ -111,6 +111,9 @@ static void init_vmcs_shadow_fields(void)
> >   			  field <= GUEST_TR_AR_BYTES,
> >   			  "Update vmcs12_write_any() to drop reserved bits from AR_BYTES");
> > +		if (get_vmcs12_field_offset(field) < 0)
> > +			continue;
> > +
> 
> why shadow_read_only_fields[] doesn't need such guard?
> 
> IIUC, copy_vmcs12_to_shadow() will VMWRITE shadowed readonly field even if
> it doesn't exist on the hardware?

Because I fixated on the existing checks and didn't look at the first for-loop.

This time around I'll test by hacking in shadowed fields arbitrary shadow fields.

  reply	other threads:[~2026-01-09 14:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  4:15 [PATCH v3 0/4] KVM: nVMX: Disallow access to vmcs12 fields that aren't supported by "hardware" Sean Christopherson
2026-01-09  4:15 ` [PATCH v3 1/4] KVM: nVMX: Setup VMX MSRs on loading CPU during nested_vmx_hardware_setup() Sean Christopherson
2026-01-09 11:24   ` Xiaoyao Li
2026-01-09  4:15 ` [PATCH v3 2/4] KVM: VMX: Add a wrapper around ROL16() to get a vmcs12 from a field encoding Sean Christopherson
2026-01-09 11:34   ` Xiaoyao Li
2026-01-09  4:15 ` [PATCH v3 3/4] KVM: nVMX: Disallow access to vmcs12 fields that aren't supported by "hardware" Sean Christopherson
2026-01-09 14:08   ` Xiaoyao Li
2026-01-09 14:44     ` Sean Christopherson [this message]
2026-01-09 15:17       ` Sean Christopherson
2026-01-09  4:15 ` [PATCH v3 4/4] KVM: nVMX: Remove explicit filtering of GUEST_INTR_STATUS from shadow VMCS fields 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=aWEUTQeNXugBYAZA@google.com \
    --to=seanjc@google.com \
    --cc=chao.gao@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiaoyao.li@intel.com \
    --cc=xin@zytor.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