Repository navigation
Add slot-owned MSHV servicing #934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,053
−868
Merged
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
3845941
Add experimental slot-owned MSHV servicing
bfjelds 531184b
Support slot-owned MSHV during ACL first update
bfjelds d754cfc
Clean stale MSHV bootstrap files before checking capacity
bfjelds caef68e
Decode hypervisor validation failures in the preview client
bfjelds a0c777d
Document initial MSHV architecture support choice
bfjelds b3409b1
Discover initial MSHV mode from the installed ACL payload
bfjelds abc1207
Document offline MSHV initialization support limit
bfjelds 1904245
Explain early MSHV mode-transition validation
bfjelds ee05d86
Document x64-only slot payload list
bfjelds 3fe19a8
Document slot payload helper contracts
bfjelds b5a0107
Clarify read-only UKI removal selection helper
bfjelds 8527cc5
Document new ESP validation and discovery functions
bfjelds 87a453e
Explain provisioning-time MSHV validation
bfjelds 38b83e1
Select validated update slot for conservative fallback commit
bfjelds 5ca0440
Keep boot-validation context comment with its construction
bfjelds 940971a
Explain commit mode validation and clean-install exemption
bfjelds 1a7414a
Explain retained configuration during recovery validation
bfjelds 541df4d
Simplify and explain hypervisor validation inputs
bfjelds 4ea3e30
Separate health and hypervisor recovery match arms
bfjelds c2c6a48
Explain manual rollback mode-transition validation
bfjelds 88e7b8b
Document MSHV boot and slot-owned servicing separately
bfjelds b5aa942
Link efitreeloader repository from MSHV documentation
bfjelds da5d234
Clarify MSHV disk streaming and recorded-mode restrictions
bfjelds fbc81f0
Remove disk streaming from MSHV limitations
bfjelds d0df622
Simplify MSHV identity-validation limitation wording
bfjelds 452cf2f
Define successful MSHV identity validation against active slot
bfjelds fe30460
Make MSHV configuration test architecture-aware
bfjelds dd280ab
Move shared MSHV bundle helpers into boot module
bfjelds 7026c0b
Clarify MSHV servicing function and block comments
bfjelds 7acc0ed
Tighten MSHV comments and match enum style
bfjelds 53e47d2
docs: clarify UEFI fallback selection matrix
bfjelds aa8a51d
docs: restore UEFI fallback lifecycle explanation
bfjelds e43d432
Move MSHV validation into ESP and use architecture helper
bfjelds 3d0376d
Remove legacy MSHV payload preservation
bfjelds e82ca71
docs: remove experimental label from MSHV parameter
bfjelds f4d698e
Reclaim interrupted UKI staging before ESP deployment
bfjelds 327f8e1
Detect MSHV images from COSI bootloader metadata
bfjelds c82c8d6
Align MSHV detection with upstream COSI metadata
bfjelds 3fc019c
Use shared bootloader model for MSHV detection
bfjelds a63f54a
Share MSHV payload paths and correct servicing comments
bfjelds ce4bd43
Align MSHV imports with module conventions
bfjelds 4404387
Discover image-specific MSHV secondary payloads
bfjelds a9a4140
Restore detailed servicing comments
bfjelds a31dd26
Fix MSHV fallback cleanup and deployment restrictions
bfjelds f0c172b
Generalize commit failure state and gate MSHV validation on runtime d…
bfjelds 15179d9
Remove obsolete hypervisor failure state alias
bfjelds 7abbc1c
Remove MSHV slot-staging capacity prediction
bfjelds a340334
Update cleanup documentation after preflight removal
bfjelds f255519
Gate UKI staging cleanup independently of MSHV
bfjelds dd3faf5
Ignore unrelated second-stage EFI files
bfjelds 1f6840d
Allow MSHV fallback over ordinary GRUB files
bfjelds 8c56b2c
Use MSHV boot component terminology
bfjelds 7de7c0a
Consolidate commit success reporting
bfjelds 539aae8
Separate bootloader staging from installed boot-tree copying
bfjelds 7cf1706
Document boot-tree copying and replacement invariants
bfjelds cb2cf4c
Remove redundant ESP boot-file replacement wrapper
bfjelds e3e0131
boot: rely on staged copies instead of capacity estimates
bfjelds 3da29ed
boot: explain image staging path handling
bfjelds c499dd0
boot: name tree-copy helpers for bootstrap and fallback
bfjelds f22eb3d
boot: explain preparation before slot cleanup
bfjelds f60748c
boot: document staging selection and MSHV validation
bfjelds 016dc4a
boot: separate capability-specific file discovery
bfjelds ad8f36f
boot: document pre-staging UKI cleanup selection
bfjelds 3419d0e
boot: show example capability-specific filepaths
bfjelds 654aa0d
boot: document staging preparation contract
bfjelds d39df6a
boot: clarify MSHV bootstrap validation scope
bfjelds 9366de6
boot: document runtime MSHV validation semantics
bfjelds 631c89d
boot: remove MSHV-specific initialization validation
bfjelds fbbe51a
boot: rename file helpers to boot_tree
bfjelds da1499e
docs: clarify MSHV validation and failure boundaries
bfjelds 4cfbf08
docs: scope MSHV explanation to its bootloader type
bfjelds 77bf521
docs: remove MSHV boot-chain qualifier
bfjelds d555938
Document pre-refresh fallback health-check coverage
bfjelds 2889c5a
Simplify MSHV servicing after review
bfjelds fe25cd0
Address ESP ownership and staging review feedback
bfjelds a624a70
Use walkdir for boot-tree traversal
bfjelds 9ff608d
Move reusable boot-tree filesystem mechanics into osutils
bfjelds 5cf1fe3
Clarify filesystem helper names and remove comment-only changes
bfjelds d3bc06a
Clarify MSHV validation function contracts
bfjelds f1de574
Clarify missing-path canonicalization helper
bfjelds 2dc65fe
Address MSHV servicing review suggestions
bfjelds 7aec517
Apply ESP visibility and error-reporting feedback
bfjelds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| //! Validates MSHV boot components independently of the surrounding bootloader chain. | ||
|
|
||
| use std::{fs, io::ErrorKind, path::Path}; | ||
|
|
||
| use anyhow::{ensure, Context, Error}; | ||
|
|
||
| use crate::subsystems::esp::boot_tree; | ||
|
|
||
| const MSHV_BOOT_FILES: &[&str] = &["HvLoader.efi", "lxhvloader.dll"]; | ||
| const MSHV_BOOT_COMPONENTS_DIR: &str = "Windows"; | ||
|
|
||
| /// Detects MSHV components in a slot or fallback BOOT directory. | ||
| /// | ||
| /// Any loader filename or Windows entry triggers validation of both required | ||
| /// loaders and the optional Windows tree. Returns true only after validation; | ||
| /// partial components are an error, not an ordinary non-MSHV directory. | ||
| /// Returns false when no markers exist, including when the directory is absent. | ||
| /// Filesystem inspection errors propagate without modifying the directory. | ||
| pub(crate) fn has_slot_mshv_boot_components(boot_dir: &Path) -> Result<bool, Error> { | ||
| for marker in MSHV_BOOT_FILES | ||
| .iter() | ||
| .copied() | ||
| .chain([MSHV_BOOT_COMPONENTS_DIR]) | ||
| { | ||
| match fs::symlink_metadata(boot_dir.join(marker)) { | ||
| Ok(_) => { | ||
| validate_boot_components(boot_dir)?; | ||
| return Ok(true); | ||
| } | ||
| Err(error) if error.kind() == ErrorKind::NotFound => {} | ||
| Err(error) => return Err(error).context("Failed to inspect MSHV boot components"), | ||
| } | ||
| } | ||
| Ok(false) | ||
| } | ||
|
|
||
| /// Requires regular HvLoader.efi and lxhvloader.dll files in `boot_dir`. | ||
| /// | ||
| /// Windows is optional, but when present must be a directory tree containing | ||
| /// only regular files/directories, with no links or reserved replacement names. | ||
| /// Checks filesystem structure, not binary contents or runtime hypervisor identity. | ||
| /// Supporting bootloaders, including ETL's second stage, are validated separately. | ||
| /// This function does not modify the directory. | ||
| pub(crate) fn validate_boot_components(boot_dir: &Path) -> Result<(), Error> { | ||
| for name in MSHV_BOOT_FILES { | ||
| let path = boot_dir.join(name); | ||
| ensure!( | ||
| fs::symlink_metadata(&path) | ||
| .with_context(|| format!("Missing MSHV boot component: {name}"))? | ||
| .is_file(), | ||
| "Invalid MSHV boot component: {name}" | ||
| ); | ||
| } | ||
| let windows = boot_dir.join(MSHV_BOOT_COMPONENTS_DIR); | ||
| match fs::symlink_metadata(&windows) { | ||
| Ok(_) => { | ||
| boot_tree::filepaths(&windows)?; | ||
| } | ||
| Err(error) if error.kind() == ErrorKind::NotFound => {} | ||
| Err(error) => return Err(error).context("Failed to inspect MSHV boot component directory"), | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| pub(crate) const MSHV_SLOT_BOOT_FILES: &[&str] = &[ | ||
| "bootx64.efi", | ||
| "grubx64.efi", | ||
| "second.efi", | ||
| "HvLoader.efi", | ||
| "lxhvloader.dll", | ||
| ]; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.