On 9/5/2026 7:58 AM, Jim Mattson wrote:
On Mon, Aug 24, 2026 at 5:40 AM Tina Zhang <[email protected]> wrote:+static void nested_svm_copy_insn_bytes(struct vmcb *to, + const struct vmcb *from) +{ + u8 insn_len = from->control.insn_len; + + nested_svm_clear_insn_bytes(to);It's not obvious to me that this clearing is necessary (except in the case of the early return below). The APM does not say what happens to the remaining bytes if there is a short read.
You're right. I had interpreted the APM as requiring the entire Guest Instruction Bytes field to be cleared when rebuilding the state, but that was too broad. For a short read, the remaining bytes are not defined and do not need to be cleared. Thanks for correcting my understanding.
+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);Clearing here is premature. If L1 does not have X86_FEATURE_DECODEASSISTS, the "Guest Instruction Bytes" fields of vmcs12 should not be touched.
Agreed.
Moreover, as I pointed out earlier, if L1 has X86_FEATURE_DECODEASSISTS, and the VM-exit doesn't have instruction bytes, you onlyhave to clear bits 7:0.
Yes. I'll update it in the next version. Thanks, Tina

