Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Kyle Zeng <kylebot@openai.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	 Thomas Gleixner <tglx@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	Oleg Boiko <oboiko@openai.com>
Subject: Re: [PATCH v4] KVM: x86: Restrict saved GPA writes to hardware write faults
Date: Fri, 18 Sep 2026 06:59:45 -0700	[thread overview]
Message-ID: <aq1D0Qxsa7IMX6ea@google.com> (raw)
In-Reply-To: <20260918033658.21842-1-kylebot@openai.com>

On Thu, Sep 17, 2026, Kyle Zeng wrote:
> @@ -2036,6 +2037,7 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm)
>  	unsigned long i;
>  
>  	dst->active = true;
> +	dst_kvm->arch.has_protected_page_tables = true;
>  	dst->asid = src->asid;
>  	dst->handle = src->handle;
>  	dst->pages_locked = src->pages_locked;

Hrm, I think in the sev_migrate_from() case, we should clear the flag in the source
to be consistent with the other fields:

	src->asid = 0;
	src->active = false;
	src->handle = 0;
	src->pages_locked = 0;
	src->es_active = false;

And with the vCPU tracking:

		memset(&src_svm->sev_es, 0, sizeof(src_svm->sev_es));
		src_svm->vmcb->control.ghcb_gpa = INVALID_PAGE;
		src_svm->vmcb->control.vmsa_pa = INVALID_PAGE;
		src_vcpu->arch.guest_state_protected = false;

I can't imagine it will ever matter, but it leaving the flag set looks wrong,
being consistent costs nothing in practice.

No need for a v5, I'll fixup when applying.

  reply	other threads:[~2026-09-18 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18  3:36 [PATCH v4] KVM: x86: Restrict saved GPA writes to hardware write faults Kyle Zeng
2026-09-18 13:59 ` Sean Christopherson [this message]
2026-10-02 21:06 ` 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=aq1D0Qxsa7IMX6ea@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kylebot@openai.com \
    --cc=mingo@redhat.com \
    --cc=oboiko@openai.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@kernel.org \
    /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