Skip to content

Comments

Parse attributes in extended VTL0 APIs#653

Open
femiatl wants to merge 1 commit intomainfrom
femia/lvbs/pagewalk
Open

Parse attributes in extended VTL0 APIs#653
femiatl wants to merge 1 commit intomainfrom
femia/lvbs/pagewalk

Conversation

@femiatl
Copy link
Contributor

@femiatl femiatl commented Feb 9, 2026

VTL0 sends data to the secure kernel during and after initial boot. Use the new attributes parameter to extend load_kdata, allowing it to process data after boot and use the improved format for sending data from VTL0. Small, simple data buffers like certificates can be sent efficiently with the same APIs used for larger aggregated data like module info.

The new data format is leveraged to reduce the size of the kernel string table passed from ~10MB (all of rodata) to ~250KB.

The validate_module and validate_kexec APIs are extended to use the new attributes.

@sangho2
Copy link
Contributor

sangho2 commented Feb 10, 2026

@femiatl Could you please resolve the conflicts such that CI can work on this PR.

@femiatl femiatl force-pushed the femia/lvbs/pagewalk branch 2 times, most recently from 5d880ea to 54e3a52 Compare February 11, 2026 02:45
VTL0 sends data to the secure kernel during and after initial boot.
Use the new attributes parameter to extend load_kdata, allowing it
to process data after boot and use the improved format for sending
data from VTL0. Small, simple data buffers like certificates can be
sent efficiently with the same APIs used for larger aggregated data
like module info.

The new data format is leveraged to reduce the size of the kernel
string table passed from ~10MB (all of rodata) to ~250KB.

The validate_module and validate_kexec APIs are extended to use the
new attributes.
@femiatl femiatl force-pushed the femia/lvbs/pagewalk branch from 54e3a52 to d4626b2 Compare February 11, 2026 02:49
@github-actions
Copy link

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/function_parameter_count_changed.ron

Failed in:
  litebox_platform_lvbs::mshv::vsm::mshv_vsm_protect_memory now takes 3 parameters instead of 2, in /home/runner/work/litebox/litebox/litebox_platform_lvbs/src/mshv/vsm.rs:259
  litebox_platform_lvbs::mshv::vsm::mshv_vsm_load_kdata now takes 3 parameters instead of 2, in /home/runner/work/litebox/litebox/litebox_platform_lvbs/src/mshv/vsm.rs:336

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/inherent_method_missing.ron

Failed in:
  Symbol::from_bytes, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/67aa94c6a750cd2791fe9edab62e6b29b9624493/litebox_platform_lvbs/src/mshv/vsm.rs:1778

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters, not counting the receiver (self) parameter.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/method_parameter_count_changed.ron

Failed in:
  litebox_platform_lvbs::mshv::vsm::SymbolTable::build_from_container now takes 2 parameters instead of 4, in /home/runner/work/litebox/litebox/litebox_platform_lvbs/src/mshv/vsm.rs:1844

@sangho2
Copy link
Contributor

sangho2 commented Feb 13, 2026

It seems that this change is based on new ABI to simplify data transfer. Good idea! As @tgopinath-microsoft noted in #652, this cannot be merged yet.

One overall feedback or requested change: This PR needs some detailed comments to explain new ABI and data structures. Also, some functions are with old comments (e.g., these functions no longer get nranges), and some other functions are without any comments.

@@ -254,12 +256,14 @@ pub fn mshv_vsm_end_of_boot() -> i64 {

/// VSM function for protecting certain memory ranges (e.g., kernel text, data, heap).
/// `pa` and `nranges` specify a memory area containing the information about the memory ranges to protect.
Copy link
Contributor

Choose a reason for hiding this comment

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

nranges is no longer used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the function parameter name, as well as the documentation for the changed functions

/// `pa` and `nranges` specify a memory area containing the information about the memory ranges to protect.
pub fn mshv_vsm_protect_memory(pa: u64, nranges: u64) -> Result<i64, VsmError> {
pub fn mshv_vsm_protect_memory(pa: u64, va: u64, attr: u64) -> Result<i64, VsmError> {
if attr == 0 {
Copy link
Contributor

@sangho2 sangho2 Feb 13, 2026

Choose a reason for hiding this comment

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

Fine for now, but breaking ABI change like this should be gracefully handled in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Let me update the PR with some doc for breaking API as well

}
}
let attr = HekiDataAttr::from_bytes(attr.to_le_bytes());
let data_type = attr.dtype_or_err().unwrap_or(HekiKdataType::Unknown);
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is unknown data, better to return an error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to remove the Unknown option from the kdata enum as well? Otherwise we still have to handle it in a match somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants