|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v8 00/65] ASI: HVM, functionally complete
Le 02/12/2026 à 12:20, George Dunlap a écrit : This is a functionally complete series to implement address space isolation. It does not include any low-hanging optimizations. The approach is the same since v3: Start by focusing on just getting ASI and intra-domain isolation for HVM guests. PV support is added where it's simple to do. The main difference in v8: Two patches from v7 have been checked in, and comments on 3/ have been addressed. Include PH2, allowing HVM domains with per-vCPU areas to map only the stack of the pCPU on which they're running. Included in this version: Additional safety precautions for a previously posted patch (01). - X1 (02-06): Add a vCPU state window to the per-domain area (both for PV and HVM). Move SVM VMCB structures and VMX guest MSR areas into it. - X2 (07-10): Move every vCPU's saved register frame (PV and HVM), and the HVM emulator's operand caches, into the vCPU state window. 10 also clears the vCPU's copy of an emulated I/O request once it has been consumed. - X3 (11-13): Introduce map_domain_pages(), which maps several pages in the calling vCPU's per-domain area, and use it in place of vmap() for the shadow code's cross-page emulated writes and the HVM emulator's multi-frame accesses. - X4 (14-20): Move the guest XSAVE areas into the vCPU state window. - VH (21-29): Give each vCPU of an HVM guest its own per-domain area and its own mapcache. - DV (30-38): Maintain two "views" of the directmap: A full directmap, and a sparse directmap. The full directmap is what we have now; the sparse directmap removes non-xenheap heap memory. - PH1 (39-49): Preparation for per-pCPU stacks, modifying rendezvous and call-function IPIs to not use the stack. - PH2 (50-65), new in this version: Moving pCPU stacks into the perdomain area, allocating them from the domheap Implemented but not yet posted: - O: A number of optimizations to improve performance The functionality of 01-38 (X, VH, and DV) is the bare minimum that XenServer needs to make it into 4.23. v7 can be found here: https://lore.kernel.org/xen-devel/20261119-asi-hvm-v7-0-6551b6d5c879@xxxxxxxxxxxxxx/ v8 is based on staging 091d3c200281. v7's 01-02 are in staging (9f9e2532c20d, ff9c79ec370c); v7's 03-50 are v8's 02-49. Changes in v8: - 01 is new, after Andrew's reply to v7's 01: populate_perdomain_mapping() asserts that _PAGE_AVAIL0 is clear in the flags it is given, and masks it out. - Following Jan's review of v7's 03: 02 asserts v == current in svm_guest_x86_mode(), gives svm_set_tsc_offset() one exit path, and maps the VMCB through pointers-to-const where it only reads it; 04 maps it through a pointer-to-const too. - "No functional change" is gone from four messages: 07 and 33 drop it, 18 says that the new error paths cannot be taken yet, and 44 says what does change (the smp_rmb() on Arm). - PH2 (50-65) is new. Some more details: 10 also limits exposure of ioreq state: Completely isolating each vCPU's I/O requests from being read by other vCPUs of the same domain is complicated; as a mitigation, this patch clears the emulated I/O request once it has been consumed, reducing the window available to read the payload. 14-17 are Alejandro's patches from "x86: Address Space Isolation FPU preparations" (v3, January 2025), revived. State is moved from the xenheap into the per-domain area for both ASI and non-ASI domains: VMCB, MSR List, vCPU register frame, and XSAVE/FPU areas. Same is true for users of map_domain_pages. This protects non-ASI domains from ASI domains. One key thing to get feedback on, still open from v6, is the question below 20's "---": xstate_init() now panics on hardware whose XSAVE area needs more than the three pages reserved for it in the vCPU state window. No current hardware does. Should it do more, for instance size the reservation from the size found at boot, or fall back to xenheap areas on such hardware? In PH1, the data that rendezvous and call-function IPIs hand to other CPUs moves off the initiating CPU's stack. 44 adds by-value payloads for call-function IPIs, which 46-48 use, and 49 asserts that a payload passed by pointer is not on the stack. In PH2, with the new cpu-stack sub-option of asi= (54), each pCPU's stack is mapped at an address of its own in the per-domain area, and the pCPU runs on it there (58-59); an HVM vCPU's page-tables then map only the stack of the pCPU it runs on (60), and the stacks come from the domain heap, which the sparse directmap does not map (61). 62 zeroes the stack on context switch. 54, 56-59 and 62 are Roger's, from "x86: adventures in Address Space Isolation" (v2, January 2025), reworked HVM-first; their changelogs say what changed since. 50 fixes a bug in staging under FRED and applies on its own; 63-65 add checks that could be dropped. Note that at the end of this series, PV guests can be given the sparse directmap; this isolates them from other domains, but doesn't isolate vCPUs within a domain. With this series, a PV domain's register frames and XSAVE areas are also out of reach of domains on the sparse directmap, whether or not the PV domain itself is on it. Testing of v8, on the series as posted (staging 091d3c200281): - Builds of xen/ at each of the 65 patches, in seven configurations: debug and release, !HVM, !PV, the PV shim, and shadow paging, debug and release; from 32, which adds CONFIG_SPARSE_DIRECTMAP, also with it, debug and release. No warnings or errors beyond those staging itself gives. arm64 builds of 65, debug and release. - On an Intel NUC: whole-tree builds (xen, tools, stubdom, docs) at each of the 65, with tools/tests/vpci run. - QEMU (TCG) boots at each of the 65: PV dom0s without asi=, with asi=1, with asi=1,dom0=0 and with xpti=1; PVH dom0s without asi=, with asi=1 and with asi=1,dom0=0, on HAP and on shadow; and XTF's 32-bit PV and 32-bit HVM selftests as dom0 (asi= arrives with 22). Each boot gets to dom0's userspace (or the test's result) with no crash, assertion or WARN() in Xen's log. - On the NUC: boots of 65 with asi=1. In each, a 64-bit PV guest is live-migrated to the same host in shadow log-dirty mode under a verified workload, with an HVM guest beside it, and XTF's full suite, 32-bit PV included, passes twice (the usual four skips). - GitLab CI https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/3142304689 A dependency graph of the above functionality can be found here: https://xenbits.xenproject.org/people/gdunlap/asi-series-deps.html (...) base-commit: 091d3c200281ea44846ccdf1e5d39985321c643e Tested-by: Teddy Astie <teddy.astie@xxxxxxxxxx>Tested various workloads on both Intel and AMD hardware with both asi=0 and asi=1 with PV Dom0 and PV (XTF) and PVH DomUs; with various tests (save/restore HVM, stress-testing, ...). I haven't tested asi-specific properties though (side channels, ...). So far, everything survived, and no issue in sight. Teddy Attachment:
OpenPGP_signature.asc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |