HomeFreeBSD

vmm: Fix routines which create maps of the guest physical address space

Description

vmm: Fix routines which create maps of the guest physical address space

In vm_mmap_memseg(), use vm_map_insert() instead of vm_map_find().
Existing callers expect to map the GPA that they passed, whereas
vm_map_find() merely treats the GPA as a hint. Also check for overflow
and remove a test for first < 0 since "first" is unsigned.

In vmm_mmio_alloc(), return an error number instead of an object
pointer, since the sole caller doesn't need the pointer. As in
vm_mmap_memseg(), use vm_map_insert() instead of vm_map_find() and
validate parameters. This function is not directly reachable via
ioctl(), but we ought to be careful anyway.

Reviewed by: corvink, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53246

Details

Provenance
markjAuthored on Oct 28 2025, 8:15 PM
Reviewer
corvink
Differential Revision
D53246: vmm: Fix routines which create maps of the guest physical address space
Parents
rG924c0c60d4ae: zlib: Move to a new zlib package
Branches
Unknown
Tags
Unknown