git: 821f8ae42f42 - main - vmm: Don't assert on device errors in MOVS emulation

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 00:12:11 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=821f8ae42f42f8004567a2e202d031d76525bae9

commit 821f8ae42f42f8004567a2e202d031d76525bae9
Author:     Hayzam Sherif <hayzam@alchemilla.io>
AuthorDate: 2026-11-13 00:04:20 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-13 00:05:15 +0000

    vmm: Don't assert on device errors in MOVS emulation
    
    emulate_movs() asserts that it fails only with EFAULT, but a device read
    or write can fail with other errors, such as EINVAL from lapic_mmio_read()
    for an access whose 4-byte-aligned offset is not 16-byte aligned, or from
    lapic_mmio_write() for an unaligned or non-4-byte access.  A guest could
    therefore panic a kernel with INVARIANTS using a MOVS from the local APIC.
    Return the error, as the other emulation functions do.
    
    Reviewed by:    markj
    MFC after:      1 week
    Sponsored by:   Alchemilla Ventures Private Limited
---
 sys/amd64/vmm/vmm_instruction_emul.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c
index b588b3618764..3d1a43644e68 100644
--- a/sys/amd64/vmm/vmm_instruction_emul.c
+++ b/sys/amd64/vmm/vmm_instruction_emul.c
@@ -936,8 +936,6 @@ emulate_movs(struct vcpu *vcpu, uint64_t gpa, struct vie *vie,
 			vm_restart_instruction(vcpu);
 	}
 done:
-	KASSERT(error == 0 || error == EFAULT, ("%s: unexpected error %d",
-	    __func__, error));
 	return (error);
 }