Skip to contentSkip to conversation

New: nSVM: missing sanity checks in svm_leave_smm()

Bug 220964 [email protected] 2 participants 3 messages Jan 10 – Jan 15 KVM

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=220964

Bug ID: 220964
Summary: nSVM: missing sanity checks in svm_leave_smm()
Product: Virtualization
Version: unspecified
Hardware: AMD
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: kvm
Assignee: [email protected]
Reporter: [email protected]
Regression: No

In svm_leave_smm():

    svm_copy_vmrun_state(&svm->vmcb01.ptr->save, map_save.hva + 0x400);
...
    nested_copy_vmcb_control_to_cache(svm, &vmcb12->control);
    nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
    ret = enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa, vmcb12,

false);

map_save.hva and vmcb12 are guest mappings, but there is no sanity check performed on the copied control/save areas. It seems that this allows the guest to modify restricted values (intercepts, EFER, CR4) and gain access to CPU features the host may not support or expose.

nested_copy_vmcb_control_to_cache() and nested_vmcb_check_controls() ought to be combined into one function, same with nested_copy_vmcb_save_to_cache() and nested_vmcb_check_save(), to eliminate the risk that a copy is made without sanity check.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw
Quoted 23 lines · On Sat, Jan 10, 2026 at 08:03:07PM +0000, [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=220964

Bug ID: 220964
Summary: nSVM: missing sanity checks in svm_leave_smm()
Product: Virtualization
Version: unspecified
Hardware: AMD
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: kvm
Assignee: [email protected]
Reporter: [email protected]
Regression: No

In svm_leave_smm():

    svm_copy_vmrun_state(&svm->vmcb01.ptr->save, map_save.hva + 0x400);
...
    nested_copy_vmcb_control_to_cache(svm, &vmcb12->control);
    nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
    ret = enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa, vmcb12,
Quoted 6 lines

false);

map_save.hva and vmcb12 are guest mappings, but there is no sanity check performed on the copied control/save areas. It seems that this allows the guest to modify restricted values (intercepts, EFER, CR4) and gain access to CPU features the host may not support or expose.

This was reported by Sean in
https://lore.kernel.org/kvm/[email protected]/.

I think the following patch should fix it:
https://lore.kernel.org/kvm/[email protected]/.

Quoted 11 lines

nested_copy_vmcb_control_to_cache() and nested_vmcb_check_controls() ought to be combined into one function, same with nested_copy_vmcb_save_to_cache() and nested_vmcb_check_save(), to eliminate the risk that a copy is made without sanity check.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 220964] nSVM: missing sanity checks in svm_leave_smm()

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=220964

--- Comment #1 from [email protected] ---

Quoted 23 lines · On Sat, Jan 10, 2026 at 08:03:07PM +0000, [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=220964

Bug ID: 220964
Summary: nSVM: missing sanity checks in svm_leave_smm()
Product: Virtualization
Version: unspecified
Hardware: AMD
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: kvm
Assignee: [email protected]
Reporter: [email protected]
Regression: No

In svm_leave_smm():

    svm_copy_vmrun_state(&svm->vmcb01.ptr->save, map_save.hva + 0x400);
...
    nested_copy_vmcb_control_to_cache(svm, &vmcb12->control);
    nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
    ret = enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa, vmcb12,
Quoted 7 lines

false);

map_save.hva and vmcb12 are guest mappings, but there is no sanity check performed on the copied control/save areas. It seems that this allows the guest
to modify restricted values (intercepts, EFER, CR4) and gain access to CPU features the host may not support or expose.

This was reported by Sean in
https://lore.kernel.org/kvm/[email protected]/.

I think the following patch should fix it:
https://lore.kernel.org/kvm/[email protected]/.

Quoted 11 lines

nested_copy_vmcb_control_to_cache() and nested_vmcb_check_controls() ought to be combined into one function, same with nested_copy_vmcb_save_to_cache() and nested_vmcb_check_save(), to eliminate the risk that a copy is made without sanity check.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.