Commit fcd17f1
add: macOS native support (#3)
* add: Enhance compatibility and extend tests for cross-platform support
- Updated `load_module_file` to handle built-in kernel modules, improving resilience in aarch64/VZ environments.
- Introduced comprehensive backend conformance test suite to validate KVM and VZ implementations.
- Added macOS Virtualization.framework (VZ) backend with detailed configuration support.
- Reorganized shared constants and structures for cross-platform reuse.
- Enhanced protocol with optional version negotiation for better backward compatibility.
* refactor: Simplify control flow, formatting, and function signatures across core components
- Consolidated redundant control flow in `guest-agent`, `control_channel`, and `backend` modules.
- Applied consistent formatting and compact function signatures for improved readability and maintainability.
- Adjusted pre-commit hook path for streamlined formatting validation.
- Enhanced Rust API's argument structures and handling for better clarity.
* refactor: streamline conformance tests and enhance CI for cross-platform support
- Unified backend availability checks with `backend_available` to improve readability and maintainability.
- Replaced KVM-specific checks with a generic VM backend check across conformance tests.
- Expanded GitHub Actions CI matrix to include macOS builds and tests for cross-platform compatibility.
- Introduced dedicated E2E test workflow for macOS Virtualization.framework (VZ) backend.
- Updated test image script to support musl cross-compilation and macOS environment.
* refactor: implement `Default` for `KvmBackend`, simplify control flow, and enhance pre-commit hooks
- Added `Default` implementation for `KvmBackend` to streamline initialization.
- Simplified `is_running` with `is_some_and` and adjusted response handling in async task.
- Enhanced pre-commit hooks to enforce `cargo clippy` checks with warnings as errors.
* update: enforce Linux-only restriction for `guest-agent` and exclude it from macOS CI tasks
- Added compile-time check to ensure `guest-agent` runs only on Linux (as PID 1 inside micro-VMs).
- Updated GitHub Actions workflows to exclude `guest-agent` from macOS builds, tests, and documentation generation.
* update: add `Send + Sync` safety guarantees for `VzBackend` and refactor socket device handling
- Introduced `SendSyncDevice` wrapper for `VZVirtioSocketDevice` to ensure thread safety.
- Implemented `Send` and `Sync` traits for `VzBackend`, with safe access guarantees.
- Refactored connector and initialization logic to utilize the new `SendSyncDevice`.
* update: improve type safety and refactor completion handler logic in `VzBackend`
- Replaced generic `AnyObject` usage with specific `VZSocketDeviceConfiguration` and `VZNetworkDeviceConfiguration` types.
- Ensured thread-safe wrappers for `SendSyncDevice` using `Arc`.
- Refactored completion handler implementation with scoped variables to reduce mutex contention.
- Addressed platform-specific code warnings for non-Linux builds.
* refactor: use `block_in_place` for synchronous `VzBackend` VM setup and improve channel handling
- Replaced async `oneshot` channels with synchronous `std::sync::mpsc::channel` for VM start/stop operations.
- Refactored VM setup logic to execute synchronously via `tokio::task::block_in_place` for ObjC type safety.
- Enhanced logging and streamlined configuration flow for better maintainability.
* remove: drop `boot_diag.rs` example and update related configurations
- Removed the `boot_diag.rs` Linux-specific example to simplify codebase and maintenance.
- Adjusted CI documentation build command to use the `--workspace` flag for consistency.
- Minor cleanup in `VzBackend` to remove unnecessary cast for file descriptor.
* refactor: implement `Default` for `VzBackend` and update inconsistent doc links
- Added `Default` implementation for `VzBackend` to simplify initialization.
- Fixed inconsistent references to `ControlChannel` and `VmmBackend` in documentation comments for improved clarity.
* fix: mark Low-Level VM Access doctest as ignored for macOS compatibility
The doctest references MicroVm and VoidBoxConfig which are Linux-only types,
causing doc-test failures on macOS CI.
* update: add caching for musl-cross toolchain in macOS E2E workflow and increase timeout to 60 mins
- Implemented caching of the musl-cross toolchain to optimize workflow execution.
- Updated timeout for macOS E2E tests to 60 minutes to accommodate longer runs.
- Improved musl-cross installation process with cache utilization and verification steps.
* fix: make Virtualization.framework backend work end-to-end on macOS Apple Silicon
- VZ backend: fix DispatchQueue thread affinity, vsock FD ownership (libc::dup), async streaming exec
- Guest agent: DHCP-first networking for VZ NAT, tmpfs /tmp for sandbox user, relax RLIMIT_AS for Bun
- Cross-build: auto-detect musl toolchain, download ARM64 glibc/busybox from Ubuntu packages
- Refactor build_guest_image.sh into platform-specific modules (lib/guest_{common,linux,macos}.sh)
- Add voidbox.entitlements and .cargo/config.toml for code-signing and cross-compilation
- README: macOS prerequisites and run instructions
* update: streamline kernel download process with helper script and adjust README setup steps
- Added `scripts/download_kernel.sh` for simplified and reusable kernel downloads.
- Refactored README setup steps to utilize the new script, improving clarity and organization.
- Updated test image script to align with musl cross-compilation changes.
- Removed hardcoded kernel version from macOS E2E workflow, delegating version control to the helper script.
* update: improve `VzBackend` VM lifecycle management, add checksum verification, and enhance kernel script
- Refactored `VzBackend` VM lifecycle to ensure thread safety and prevent dangling pointers on timeout or failure.
- Introduced checksum verification for kernel downloads to ensure data integrity.
- Enhanced kernel script with customizable `KERNEL_UPLOAD` version, updated URLs to HTTPS, and added SHA256 checks.
- Adjusted pre-commit hooks to exclude `guest-agent` on macOS for compatibility.
* update: improve kernel extraction to handle zstd-compressed `.deb` packages
- Added support for zstd-compressed archives (`data.tar.zst`) in `scripts/download_kernel.sh`.
- Enhanced error handling for missing or unsupported archive formats.
- Improved compatibility with macOS and older GNU tar versions lacking native zstd support.
* update: refine kernel extraction script, clean imports, and improve pre-commit checks
- Simplified kernel extraction logic with added compatibility for macOS `bsdtar` and refined error handling for `.deb` packages.
- Removed unused `AnyThread` import from `VzBackend`.
- Adjusted pre-commit hook to remove unnecessary stderr redirection for better feedback during Clippy checks.
* add: include `AnyThread` import in `VzBackend` for thread safety improvements
* update: enhance kernel extraction script with improved file detection and error clarity
- Replaced `ls` with `find` for more reliable `data.tar*` detection, ensuring cross-platform compatibility.
- Refined error message for missing `data.tar` to improve user feedback during `.deb` extraction.
* update: configure `tokio::test` to use multi-threaded runtime in conformance tests
- Added `flavor = "multi_thread", worker_threads = 2` to all `tokio::test` annotations, improving test execution scalability.
---------
Co-authored-by: Cristian Spinetta <cebspinetta@gmail.com>1 parent f8e54b8 commit fcd17f1
File tree
41 files changed
+3538
-560
lines changed- .cargo
- .githooks
- .github/workflows
- examples
- guest-agent/src
- scripts
- lib
- src
- backend
- vz
- devices
- observe
- sandbox
- vmm
- tests
- e2e
- void-box-protocol/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+3538
-560
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
53 | 70 | | |
54 | 71 | | |
55 | | - | |
56 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
59 | 80 | | |
| |||
64 | 85 | | |
65 | 86 | | |
66 | 87 | | |
| 88 | + | |
67 | 89 | | |
68 | 90 | | |
69 | 91 | | |
70 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
71 | 98 | | |
72 | 99 | | |
73 | | - | |
| 100 | + | |
74 | 101 | | |
75 | 102 | | |
| 103 | + | |
76 | 104 | | |
77 | | - | |
| 105 | + | |
78 | 106 | | |
79 | 107 | | |
80 | 108 | | |
| |||
95 | 123 | | |
96 | 124 | | |
97 | 125 | | |
98 | | - | |
99 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
100 | 132 | | |
101 | 133 | | |
102 | 134 | | |
| |||
105 | 137 | | |
106 | 138 | | |
107 | 139 | | |
108 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
109 | 146 | | |
110 | 147 | | |
111 | 148 | | |
112 | 149 | | |
113 | | - | |
114 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
115 | 156 | | |
116 | 157 | | |
117 | 158 | | |
| |||
122 | 163 | | |
123 | 164 | | |
124 | 165 | | |
125 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
126 | 172 | | |
127 | 173 | | |
128 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments