Skip to content

Implement internal Hermit image mode#1296

Draft
fogti wants to merge 2 commits intohermit-os:mainfrom
fogti:hermit-image-intern
Draft

Implement internal Hermit image mode#1296
fogti wants to merge 2 commits intohermit-os:mainfrom
fogti:hermit-image-intern

Conversation

@fogti
Copy link
Copy Markdown
Contributor

@fogti fogti commented Mar 9, 2026

Unfortunately, as there is no working Hermit Kernel side implementation yet, this can't be tested yet.

This is the Uhyve counterpart to hermit-os/loader#511.

@fogti fogti added enhancement New feature or request rust Pull requests that update Rust code feature/file system blocked labels Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 25.64103% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.45%. Comparing base (3dcc4a3) to head (b24f56f).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/vm.rs 18.51% 66 Missing ⚠️
src/params.rs 8.33% 11 Missing ⚠️
src/fdt.rs 64.70% 6 Missing ⚠️
src/bin/uhyve.rs 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1296      +/-   ##
==========================================
- Coverage   76.72%   75.45%   -1.27%     
==========================================
  Files          29       29              
  Lines        4266     4356      +90     
==========================================
+ Hits         3273     3287      +14     
- Misses        993     1069      +76     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fogti fogti force-pushed the hermit-image-intern branch from 5ebe71d to f4967e0 Compare March 9, 2026 16:08
libc::mprotect(
&mut mem_slice[0] as *mut u8 as *mut libc::c_void,
aligned_image_len,
libc::PROT_READ | libc::PROT_EXEC,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Albeit the kernel should under no circumstances try to write to the image, afaik we shouldn't prohibit it from executing parts of it (e.g. libraries).

}
}

/// Specify the way an Hermit image should be provided to the Hermit Kernel
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Specify the way an Hermit image should be provided to the Hermit Kernel
/// Specify the way an Hermit image should be handled by Uhyve.


/// Let the Hermit kernel handle the Hermit image provision.
///
/// This should be faster on average, but requires an Hermit kernel that supports it.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// This should be faster on average, but requires an Hermit kernel that supports it.
/// This should be faster on average, but requires an Hermit kernel that supports it and reduces the effective memory of the kernel.

// insert Hermit image tree into file map
file_mapping.add_hermit_image(&buf_decompressed[..])?;
}
use crate::params::HermitImageMode;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use can also go to the top of the file, right?

Copy link
Copy Markdown
Member

@jounathaen jounathaen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good. Just a few nitpicks from my side

@fogti
Copy link
Copy Markdown
Contributor Author

fogti commented Mar 13, 2026

btw. the only reason why I used the maybe_ prefix was because that was also used elsewhere.

It might be a good idea to get rid of it basically everywhere (tho particularly when used as struct field names and such).

@fogti fogti force-pushed the hermit-image-intern branch from f4967e0 to b24f56f Compare March 20, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked enhancement New feature or request feature/file system rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants