git: 01b73c604511 - releng/15.2 - amd64/vmm: Reject TSC_AUX writes with reserved bits set

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 17:09:44 UTC
The branch releng/15.2 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=01b73c60451102288ea974589f0c4ca4dd267b17

commit 01b73c60451102288ea974589f0c4ca4dd267b17
Author:     Hayzam Sherif <hayzam@alchemilla.io>
AuthorDate: 2026-11-05 11:53:03 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-17 13:35:31 +0000

    amd64/vmm: Reject TSC_AUX writes with reserved bits set
    
    On Intel CPUs, bits 63:32 of IA32_TSC_AUX are reserved.  Guest writes to
    the MSR are trapped and the value is stored in the vCPU's MSR array.
    vmx_msr_guest_enter_tsc_aux() later writes the value to the physical MSR,
    so reserved bits must be rejected before the value reaches the host MSR.
    
    Inject #GP into the guest instead, as the hardware would.
    
    Approved by:    re (cperciva)
    Approved by:    so
    Security:       FreeBSD-SA-26:84.vmm
    Security:       CVE-2026-101319
    Fixes:          f5f5f1e7d6de ("Support guest rdtscp and rdpid instructions on Intel VT-x")
    Sponsored by:   Alchemilla Ventures Private Limited
---
 sys/amd64/vmm/intel/vmx_msr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/vmm/intel/vmx_msr.c b/sys/amd64/vmm/intel/vmx_msr.c
index 40dbec290f2d..1f9fbb0e0b0d 100644
--- a/sys/amd64/vmm/intel/vmx_msr.c
+++ b/sys/amd64/vmm/intel/vmx_msr.c
@@ -492,7 +492,11 @@ vmx_wrmsr(struct vmx_vcpu *vcpu, u_int num, uint64_t val, bool *retu)
 		error = vmx_set_tsc_offset(vcpu, val - rdtsc());
 		break;
 	case MSR_TSC_AUX:
-		if (vmx_have_msr_tsc_aux)
+		/*
+		 * Bits 63:32 are reserved.  Reject them here, since the
+		 * value is later written to the host's MSR.
+		 */
+		if (vmx_have_msr_tsc_aux && (val >> 32) == 0)
 			/*
 			 * vmx_msr_guest_enter_tsc_aux() will apply this
 			 * value when it is called immediately before guest