Skip to content

Use physical pointer abstraction in LVBS#817

Open
sangho2 wants to merge 16 commits into
mainfrom
sanghle/lvbs/vmap_copy
Open

Use physical pointer abstraction in LVBS#817
sangho2 wants to merge 16 commits into
mainfrom
sanghle/lvbs/vmap_copy

Conversation

@sangho2
Copy link
Copy Markdown
Contributor

@sangho2 sangho2 commented Apr 28, 2026

This PR lets LVBS use physical pointer abstraction to access VTL0 memory. This is equivalent to the OP-TEE shim's normal-world memory access such that it is not only safer than the legacy memory copy functions but also supporting non-contiguous physical pages. This PR and physical address range lock (next PR) will enable memory-safe VTL0 memory access (i.e., drop unsafe from read/write methods).

@sangho2 sangho2 added the must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. label Apr 28, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch 2 times, most recently from 29c61b5 to e42c3a0 Compare May 1, 2026 15:51
@sangho2 sangho2 changed the title [DRAFT] Use physical pointer abstraction in HVCI/HEKI Use physical pointer abstraction in HVCI/HEKI May 1, 2026
@sangho2 sangho2 changed the title Use physical pointer abstraction in HVCI/HEKI Use safe physical pointer abstraction in HVCI/HEKI May 1, 2026
@sangho2 sangho2 removed the must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. label May 1, 2026
@sangho2 sangho2 marked this pull request as ready for review May 1, 2026 20:11
@sangho2 sangho2 added must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. and removed must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. labels May 1, 2026
@sangho2 sangho2 changed the title Use safe physical pointer abstraction in HVCI/HEKI Use physical pointer abstraction in HVCI/HEKI May 1, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 8b9b1f7 to 3a833f2 Compare May 15, 2026 16:40
@sangho2 sangho2 changed the title Use physical pointer abstraction in HVCI/HEKI Use physical pointer abstraction in LVBS May 15, 2026

/// Provider for physical page mapping operations used by physical pointers.
pub trait PhysMapProvider<const ALIGN: usize> {
fn validate_unowned(_pages: &PhysPageAddrArray<ALIGN>) -> Result<(), PhysPointerError> {
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.

Add a comment for this trait method?

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.

This is just a proxy. Let me add a link to

fn validate_unowned(&self, _pages: &PhysPageAddrArray<ALIGN>) -> Result<(), PhysPointerError> {

use crate::mshv::ringbuffer::set_ringbuffer;
use crate::{
debug_serial_println,
Vtl0PhysConstPtr, Vtl0PhysMutPtr, debug_serial_println,
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.

We use both Vtl0 and NormalWorld?

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.

Yes. It depends on context LVBS/HVCI/HEKI vs OP-TEE.

@sangho2 sangho2 added must-not-merge:undergoing-restructuring Known deeper set of changes are happening on this PR before it is mergeable again and removed must-not-merge:undergoing-restructuring Known deeper set of changes are happening on this PR before it is mergeable again labels May 15, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 24fcce1 to 3dc8650 Compare May 21, 2026 20:28
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from c6fd071 to 24e1d87 Compare May 21, 2026 20:58
@github-actions
Copy link
Copy Markdown

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

Click for details
--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/feature_missing.ron

Failed in:
  feature optee_syscall in the package's Cargo.toml

--- 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.47.0/src/lints/inherent_method_missing.ron

Failed in:
  LinuxKernel::copy_from_vtl0_phys, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_platform_lvbs/src/lib.rs:750
  LinuxKernel::copy_to_vtl0_phys, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_platform_lvbs/src/lib.rs:790
  LinuxKernel::copy_slice_to_vtl0_phys, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_platform_lvbs/src/lib.rs:825
  LinuxKernel::copy_slice_from_vtl0_phys, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_platform_lvbs/src/lib.rs:860

--- failure module_missing: pub module removed or renamed ---

Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/module_missing.ron

Failed in:
  mod litebox_shim_optee::ptr, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_shim_optee/src/ptr.rs:4

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself 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.47.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_shim_optee::ptr::PhysMutPtr, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_shim_optee/src/ptr.rs:112
  struct litebox_shim_optee::NormalWorldMutPtr, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_shim_optee/src/ptr.rs:112
  struct litebox_shim_optee::ptr::PhysConstPtr, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_shim_optee/src/ptr.rs:496
  struct litebox_shim_optee::NormalWorldConstPtr, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/9b32e257edc7c69db649c183b89a402e2ca2cdf2/litebox_shim_optee/src/ptr.rs:496

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