From: sashiko-bot@kernel.org
To: "Tina Zhang" <zhang_wei@open-hieco.net>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 4/9] KVM: nSVM: Propagate hardware DecodeAssist bytes to VMCB12
Date: Wed, 19 Aug 2026 06:11:16 +0000 [thread overview]
Message-ID: <20260819061116.7A9FC1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <79b5372fbfa85642af81b34f219c30cad45b3728.1787116250.git.zhang_wei@open-hieco.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing live migration serialization for DecodeAssist instruction bytes and desynchronization of vmcb02_insn_bytes_fresh flag.
--
--- Patch [4]: [PATCH v4 4/9] KVM: nSVM: Propagate hardware DecodeAssist bytes to VMCB12 ---
commit 84578efc5f5e5753c950d333f88e1748a68f8d8c
Author: Tina Zhang <zhang_wei@open-hieco.net>
KVM: nSVM: Propagate hardware DecodeAssist bytes to VMCB12
DecodeAssists provides instruction bytes for nested page faults and
intercepted page faults caused by data accesses. When the feature is
exposed to L1, copy fresh hardware-provided instruction bytes from VMCB02
to VMCB12 for these exits.
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index d08c30e9a6f44..d34370b84d5b3 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
[ ... ]
> +static void nested_svm_update_vmcb12_insn_bytes(struct kvm_vcpu *vcpu,
> + struct vmcb *vmcb12,
> + const struct vmcb *vmcb02)
> +{
> + struct vcpu_svm *svm = to_svm(vcpu);
> +
> + nested_svm_clear_insn_bytes(vmcb12);
> +
> + if (!nested_svm_vmexit_supports_insn_bytes(vcpu, vmcb02))
> + goto out;
> +
> + if (svm->nested.vmcb02_insn_bytes_fresh)
> + nested_svm_copy_insn_bytes(vmcb12, vmcb02);
[Severity: High]
If a live migration occurs while KVM has a pending hardware #PF VM-exit
(where exception_vmexit.pending = true and vmcb02_insn_bytes_fresh = true),
how does the destination hypervisor know to restore this state?
It appears svm_get_nested_state() and svm_set_nested_state() aren't updated
to serialize vmcb02_insn_bytes_fresh or the hardware insn_bytes. Could this
cause the destination hypervisor to inject a #PF into VMCB12 with an
insn_len of 0, effectively losing the instruction bytes?
Additionally, if userspace calls KVM_SET_VCPU_EVENTS to clear a pending
exception:
arch/x86/kvm/x86.c:kvm_vcpu_ioctl_x86_set_vcpu_events() {
...
vcpu->arch.exception_vmexit.pending = false;
...
}
The vmcb02_insn_bytes_fresh flag is not cleared alongside it. Could a
subsequent emulator-generated #PF then incorrectly copy these stale
instruction bytes into VMCB12?
> +
> +out:
> + svm->nested.vmcb02_insn_bytes_fresh = false;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787116250.git.zhang_wei@open-hieco.net?part=4
next prev parent reply other threads:[~2026-08-19 6:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 5:51 [PATCH v4 0/9] KVM: nSVM: Enable DecodeAssists for nested guests Tina Zhang
2026-08-19 5:51 ` [PATCH v4 1/9] KVM: x86: Add helper to provide intercept linear addresses Tina Zhang
2026-08-19 6:10 ` sashiko-bot
2026-08-19 5:51 ` [PATCH v4 2/9] KVM: nSVM: Synthesize DecodeAssists EXITINFO for emulated intercepts Tina Zhang
2026-08-19 6:05 ` sashiko-bot
2026-08-19 5:51 ` [PATCH v4 3/9] KVM: nSVM: Track hardware-provided instruction bytes Tina Zhang
2026-08-19 6:05 ` sashiko-bot
2026-08-19 5:51 ` [PATCH v4 4/9] KVM: nSVM: Propagate hardware DecodeAssist bytes to VMCB12 Tina Zhang
2026-08-19 6:11 ` sashiko-bot [this message]
2026-08-19 5:51 ` [PATCH v4 5/9] KVM: x86: Track emulator-originated nested #PF VM-Exits Tina Zhang
2026-08-19 6:11 ` sashiko-bot
2026-08-19 5:51 ` [PATCH v4 6/9] KVM: nSVM: Use emulator bytes for synthesized nested #NPF/#PF Tina Zhang
2026-08-19 5:51 ` [PATCH v4 7/9] KVM: nSVM: Fetch missing DecodeAssist bytes for synthesized #NPF/#PF Tina Zhang
2026-08-19 5:51 ` [PATCH v4 8/9] KVM: nSVM: Advertise DecodeAssists to L1 Tina Zhang
2026-08-19 5:51 ` [PATCH v4 9/9] KVM: selftests: Add nested SVM DecodeAssists test Tina Zhang
2026-08-19 6:10 ` sashiko-bot
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=20260819061116.7A9FC1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhang_wei@open-hieco.net \
/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.