From 7b7b8dd715f8e5be086aa496a506e4599eb0d8b5 Mon Sep 17 00:00:00 2001 From: Hisham Alkhudrawi Date: Thu, 29 Oct 2026 22:56:05 -0400 Subject: [PATCH] proxyclient/run_guest: add --disable-node Deleting an ADT node to keep a guest away from a device is not always an option: SPTM reads /arm-io/ans.reg and nvme-queue-entries itself and panics before XNU runs if the node is gone. Prefix the node's compatible with "disabled," instead, which leaves the properties in place while keeping the guest's drivers off it. Assisted-By: LLM Signed-off-by: Hisham Alkhudrawi --- proxyclient/tools/run_guest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proxyclient/tools/run_guest.py b/proxyclient/tools/run_guest.py index ef25e38d..13faf6b6 100755 --- a/proxyclient/tools/run_guest.py +++ b/proxyclient/tools/run_guest.py @@ -52,6 +52,9 @@ def boot_arg_key(arg): parser.add_argument('-C', '--cpus', default=None) parser.add_argument('--strip-node', action="append", default=[], metavar='SUBSTR', help='Remove every ADT node whose name contains SUBSTR.') +parser.add_argument('--disable-node', action="append", default=[], metavar='PATH', + help='Keep the ADT node at PATH (others, e.g. SPTM, may need its properties) but ' + 'prefix every compatible under it with "disabled," so no driver matches.') parser.add_argument('-r', '--raw', action="store_true") parser.add_argument('-E', '--entry-point', action="store", type=int, help="Entry point for the raw image", default=0x800) parser.add_argument('-a', '--append-payload', type=pathlib.Path, action="append", default=[]) @@ -114,6 +117,15 @@ def strip_nodes(node, path=""): strip_nodes(hv.adt) +for path in args.disable_node: + def disable(node, path): + if hasattr(node, "compatible"): + node.compatible = ["disabled," + c for c in node.compatible] + print(f"Disabled ADT node {path}: {node.compatible}") + for child in node: + disable(child, f"{path}/{child.name}") + disable(hv.adt[path], path) + if args.debug_xnu: hv.adt["chosen"].debug_enabled = 1