14 Commits
Author SHA1 Message Date
James Stringer 042559092b Preserve VM MAC addresses across restarts
Save and reuse each VM's MAC address on Windows and macOS hosts, including existing VMs that do not yet have one.
2026-09-15 20:17:41 -04:00
James Stringer 4e2493dfbe Fix international keyboard input and Linux clipboard copying 2026-09-07 14:27:27 -04:00
James Stringer 978f52b8f5 Fix VM setup, storage, snapshots, and viewer behavior 2026-09-07 13:02:28 -04:00
James Stringer e931f24bf7 Remove superseded dev prototypes from the engine and ivshmem tools
win2ntfs.c was the standalone harness that validated the WIM->NTFS apply;
that logic now lives (with real per-file SIDs) in win_disk.c. AppSandboxSHM_producer.c
was the ivshmem bring-up bandwidth POC whose host-side reader (shm-test) is gone;
the production data path is asb_transport over the AppSandboxSHM driver. Neither
file was compiled by any target or included anywhere.
2026-06-30 19:30:52 -04:00
James Stringer dfd6fe475f Win-on-Mac: fix ivshmem AGENT/SSH region overlap and display readiness
Post-review fixes and release prep for the win-on-mac feature.

* asb_shm_layout.h: fix a region-sizing bug -- the AGENT (ch1) slot stride
  (0x20070) exceeded ASB_AGENT_REGION_SIZE (0x20000) by 112 bytes, so the agent
  host->guest ring overran into the adjacent SSH (ch7) region and corrupted its
  slot state under sustained traffic. Enlarge the AGENT region to 0x21000
  (downstream offsets cascade) and add per-region compile-time guards
  (n_slots*stride <= region_size) so this class of overlap fails the build.
  Host/publisher-side only -- the guest reads geometry from the published directory.

* headless.m: GET /display readiness now includes idd_ready for a Windows guest,
  matching the open precondition (asb_core_mac.m) and the Windows host
  (asb_vm_idd_ready). Before, the Mac readiness was running && agent_online only,
  so it could report ready before the VDD was up and a poll-then-open would
  spuriously 409 display_not_ready. macOS guests are unchanged.

* iso-patch-mac.m (stage): wipe the plaintext password buffer on the
  --shadowhash-file read-failure path, matching the sibling --kcpassword-file path.

* iso_patch_mac.m: point the signed Windows guest payload at the v0.1.4 release.

* vm_lifecycle.py: raise the Windows build-stall budget to 3600 s for the
  signal-less first-boot window under concurrent multi-VM load.

* tools/headless-api/README.md: document Windows guests on macOS hosts (platform
  matrix, host-fixed line, requirements heading, osType field).
2026-06-30 18:12:32 -04:00
James Stringer 303b34dab8 Win-on-Mac: encode the guest password in the daemon for all three configs
All three guest configs now obfuscate/hash the account credential in the daemon
and hand the disk-applier child only the non-plaintext result -- the plaintext
never crosses the process boundary, mirroring the Windows-on-Windows model.

  * Win-on-Mac: the daemon generates unattend.xml / setup.cmd / SetupComplete.cmd
    in-process via the shared asb_provision_* (base64 of UTF-16LE(pass+"Password"),
    the same encoder the Windows backend uses) and passes build-windows only
    --prov-dir; the plaintext --pass argv is gone. The child still detects the
    install.wim language and reports LANG:, and the daemon re-generates unattend.xml
    in-process with the detected tag -- the exact mirror of vhdx_create_thread.
  * Mac-on-Mac: the salted PBKDF2-SHA512 ShadowHash + kcpassword are computed in
    the daemon via the new shared tools/provision/mac_account_hash.{h,m}; the stage
    child takes --shadowhash-file / --kcpassword-file. --user-password-file remains
    a direct-CLI fallback.
  * Verified end-to-end on live Windows + macOS guests with a 12-character mixed
    Chinese/English password (ValidateCredentials / dscl -authonly), exercising the
    UTF-16 surrogate path.

Also in this checkpoint of accumulated win-on-mac work:

  * agent: report_idd_status re-runs on the device-check loop (force-on-connect +
    on-change) so display readiness tracks the live, self-healed VDD state instead
    of a single one-shot sample.
  * disk builder (tools/iso-patch-mac/engine): WIM reader gains the install-image
    default-language reader behind the language auto-detect; win_disk locale/apply
    refinements.
  * display + transport: idd_display Metal render + clipboard-reader paths;
    asb_ivshmem_transport slot-reclaim hardening.
  * housekeeping: remove the dev-only transport test harness (tools/transport/test/*);
    update headless-api test scripts; drop changelog-style comments.
2026-06-29 20:50:32 -04:00
James Stringer 4b28e7138d Windows-on-Mac: JIT-only guest payload; remove the bundled test-signed fallback
The Mac host now sources the entire Windows guest payload via JIT download + cache --
no bundled/embedded fallback, so zero test-signed binaries ship in the app.

- iso-patch-mac.m (build-windows): --signed-payload-zip is now required (its extraction
  failing is a hard error, not a fallback); new --netkvm-zip. Extract the signed zip in
  full -- the Windows-built zip uses backslash separators that forward-slash unzip
  include-patterns never match (unzip exits 11 and stages nothing); a full extract makes
  Info-ZIP rewrite them into real resources/ + drivers/. Stage our VDD/VAD/SHM from the
  signed payload and NetKVM from its own zip (best-effort). Drop --payload/--devcon.
- iso_patch_mac.{h,m}: buildWindowsDiskWithISO drops payloadDir/devconExe, takes a
  required signedPayloadZip + optional netkvmZip. Add ensureNetkvmZipCached (pulls the
  vendored netkvm-arm64.zip from the public repo, cached like the IPSW).
- asb_core_mac.m: remove windows_payload_directory()/devcon_exe_path(); the create flow
  fails if the signed payload download fails (JIT-only). NetKVM + OpenSSH best-effort.
- Remove the "Embed agent_win" Xcode phase and git rm tools/agent_win (the test-signed
  EXEs + drivers). The app bundle embeds zero Windows test-signed binaries.

Fixes the staging bug where the backslash zip silently fell back to the bundled
WDKTestCert drivers, which failed DriverStore import (0xE0000243), so the agent never
came online.
2026-06-28 23:09:39 -04:00
James Stringer 3cddb072e7 Windows-on-Mac: JIT-download the signed guest payload instead of bundling it
The macOS host now pulls the signed Windows release zip (EV-signed agent EXEs +
MS-attestation-signed drivers, incl. the ivshmem AppSandboxSHM) and stages those
into the guest, instead of the bundled test-signed tools/agent_win payload.

- iso_patch_mac.m: ensureSignedWinPayloadZipCached mirrors ensureOpenSSHMsiCached
  -- a single atomic writeToFile of the release zip to a version-named file under
  the support dir (sibling of VMs/), race-safe by the same single atomic write.
  Returns the cached zip path; the build extracts it.
- iso-patch-mac.m (build-windows): new --signed-payload-zip. When given, the CLI
  selectively unzips resources/appsandbox-*.exe + drivers/* into its own per-build
  temp and prefers them over --payload (so concurrent creates never collide);
  derives binDir/drvDir/devconPath from it. Falls back to --payload on any problem.
  The signed drivers carry no .cer, so SetupComplete's `if exist` certutil steps
  no-op; devcon comes from the zip's drivers/.
- iso_patch_mac.{h,m}: buildWindowsDiskWithISO threads signedPayloadZip and makes
  --payload conditional (a nil bundle can't crash the args array).
- asb_core_mac.m: start_windows_build_flow caches the zip off-main and passes it;
  bundled payload remains the fallback. NetKVM is still not downloaded.

The bundled test-signed payload stays embedded as a fallback for now; dropping the
Xcode "Embed agent_win" phase (to fully remove test-signed binaries from the app)
is a follow-up once the download URL is durable. Mac target not compiled here.
2026-06-28 21:16:30 -04:00
James Stringer 842c194e2c Windows-on-Mac: build-integrate the SHM driver, fix provisioning, harden transport/display
- Rename the ivshmem guest driver asb_ivshmem -> AppSandboxSHM everywhere (files, INF
  service/binary/catalog + display strings, device-interface GUID symbol with the GUID
  value preserved, driver source, transport, provisioning, payload, iso-patch stage list).
  QEMU's ivshmem device id and the Mac host transport (asb_ivshmem_transport.*) keep names.
- Build the driver through the VS pipeline like VDD/VAD: AppSandboxSHM.vcxproj (KMDF) +
  Package/AppSandboxSHMPackage.vcxproj (Inf2Cat + TestSign + post-build copy into
  bin\Release[-ARM64]\drivers), registered in AppSandbox.sln; add to submission-config.json
  + make-release.ps1 for MS attestation. INF gets a .10.0...22000 (Win11) TargetOSVersion
  decoration (required by DIRID 13 / PnpLockdown).
- Install the SHM PCI driver with devcon update (not devcon install, which fabricates a
  phantom ROOT devnode on a real PnP hwid) -- same pattern as NetKVM.
- Fix SetupComplete.cmd: a literal (...) in an echo inside a cmd ( ) block desynced cmd's
  paren matcher and silently skipped every driver install; removed it.
- iso-patch: per-build -shadow ISO attach so concurrent VM builds get independent devices.
- Reconcile all user-mode .vcxproj to the v145 (VS 2026) toolset.
- Transport/display: guest liveness beacon + h2g-stall reclaim, zero-copy Metal render of
  the IDD display, clipboard-file paste chown for the root daemon.
- Refresh the committed tools/agent_win payload; update the windows-on-mac integration plan.
2026-06-22 22:38:34 -04:00
James Stringer 0d4897dd6b Windows guest on Mac host via QEMU+HVF + ivshmem transport
Run Windows 11 ARM64 guests on macOS over QEMU+HVF, with an ivshmem
shared-memory transport carrying every guest channel (agent control,
display/VDD, input, audio, clipboard, SSH, 9P) - no guest networking
required.

- tools/transport: one guest transport API, two backends (PC AF_HYPERV,
  Mac ivshmem); SPSC ring with an acquire-barrier fix for SSH integrity
- tools/ivshmem: our own KMDF ivshmem BAR-mapping driver (no third party)
- src/backend_mac: Mac-host ivshmem transport, QEMU VM lifecycle, IDD
  display consumer, agent/SSH proxies, ISO->disk patcher, Windows create
- tools/agent + channel EXEs + tools/vdd: wired to asb_transport
- tools/agent_win: staged guest payload (interim, pending JIT pull)
- vendor/qemu-ivshmem: vendored QEMU 11.0.1 fork (ivshmem-plain) + LGPL
  source mirror for the self-contained app bundle
- tools/sign/make-release.ps1: use the host-native ARM64 MSBuild so the
  WDK driver ApiValidator runs (the x86 validator fails on ARM64)
2026-06-21 18:30:59 -04:00
James Stringer 503db33307 Harden iso-patch-mac (ARC over-release, resume-sidecar overflow)
- C8  StageEntry stored ARC __strong NSString members in an NSValue (raw byte
      copy, no retain), so ARC over-released them each loop iteration ->
      double-free/UAF in the privileged stage path; mark __unsafe_unretained
      (the source strings outlive the command via the outer autorelease pool).
- L10 resumeDataFromSidecarAt: `raw.length < 8 + n` overflowed for n near
      UINT64_MAX, bypassing the guard and throwing NSRangeException; compare
      with subtraction (`n > raw.length - 8`).
2026-06-03 20:58:30 -04:00
James Stringer 7d76acdf52 Make downloads more reliable on macOS 2026-04-22 22:43:37 -04:00
James Stringer ad551fb39e Set Computer Name 2026-04-18 22:59:38 -04:00
James Stringer aad2902c0a SSH + Clipboard + File staging for macOS 2026-04-18 22:14:59 -04:00