xen: temporary disable SMAP when forwarding hypercalls from user-spaceThe Xen page-table walker used to resolve the virtual addresses in thehypercalls will refuse to access user-space pages when S
xen: temporary disable SMAP when forwarding hypercalls from user-spaceThe Xen page-table walker used to resolve the virtual addresses in thehypercalls will refuse to access user-space pages when SMAP is enabledunless the AC flag in EFLAGS is set (just like normal hardware withSMAP support would do).Since privcmd allows forwarding hypercalls (and buffers) fromuser-space into Xen make sure SMAP is temporary disabled for theduration of the hypercall from user-space.Approved by: re (gjb)Sponsored by: Citrix Systems R&D
show more ...
Remove unneeded include of vm_phys.h.
xen/privcmd: fix integer truncation in IOCTL_PRIVCMD_MMAPBATCHThe size field in the XENMEM_add_to_physmap_range is an uint16_t, and theprivcmd driver was doing an implicit truncation of an int int
xen/privcmd: fix integer truncation in IOCTL_PRIVCMD_MMAPBATCHThe size field in the XENMEM_add_to_physmap_range is an uint16_t, and theprivcmd driver was doing an implicit truncation of an int into an uint16_twhen filling the hypercall parameters.Fix this by adding a loop and making sure privcmd splits ioctl request into2^16 chunks when issuing the hypercalls.Reported and tested by: Marcin Cieslak <[email protected]>Sponsored by: Citrix Systems R&D
xen: introduce a newbus function to allocate unused memoryIn order to map memory from other domains when running on Xen FreeBSD usesunused physical memory regions. Until now this memory has been a
xen: introduce a newbus function to allocate unused memoryIn order to map memory from other domains when running on Xen FreeBSD usesunused physical memory regions. Until now this memory has been allocatedusing bus_alloc_resource, but this is not completely safe as we can end upusing unreclaimed MMIO or ACPI regions.Fix this by introducing a new newbus method that can be used by Xen driversto request for unused memory regions. On amd64 we make sure this memorycomes from regions above 4GB in order to prevent clashes with MMIO/ACPIregions. On i386 there's nothing we can do, so just fall back to theprevious mechanism.Sponsored by: Citrix Systems R&DTested by: Gustau Pérez <[email protected]>
xen: implement the privcmd user-space deviceThis device is only attached to priviledged domains, and allows thetoolstack to interact with Xen. The two functions of the privcmdinterface is to allo
xen: implement the privcmd user-space deviceThis device is only attached to priviledged domains, and allows thetoolstack to interact with Xen. The two functions of the privcmdinterface is to allow the execution of hypercalls from user-space, andthe mapping of foreign domain memory.Sponsored by: Citrix Systems R&Di386/include/xen/hypercall.h:amd64/include/xen/hypercall.h: - Introduce a function to make generic hypercalls into Xen.xen/interface/xen.h:xen/interface/memory.h: - Import the new hypercall XENMEM_add_to_physmap_range used by auto-translated guests to map memory from foreign domains.dev/xen/privcmd/privcmd.c: - This device has the following functions: - Allow user-space applications to make hypercalls into Xen. - Allow user-space applications to map memory from foreign domains, this is accomplished using the newly introduced hypercall (XENMEM_add_to_physmap_range).xen/privcmd.h: - Public ioctl interface for the privcmd device.x86/xen/hvm.c: - Remove declaration of hypercall_page, now it's declared in hypercall.h.conf/files: - Add the privcmd device to the build process.