Skip to content

Add arch-specific provider; remove PunchthroughProvider#806

Open
jaybosamiya-ms wants to merge 4 commits into
mainfrom
jayb/arch-specific-provider
Open

Add arch-specific provider; remove PunchthroughProvider#806
jaybosamiya-ms wants to merge 4 commits into
mainfrom
jayb/arch-specific-provider

Conversation

@jaybosamiya-ms

@jaybosamiya-ms jaybosamiya-ms commented Apr 24, 2026

Copy link
Copy Markdown
Member

This PR removes the last vestiges of the PunchthroughProvider, moving out architecture-specific register management into its own trait. For now, I've only added support for x86-64's fsbase/gsbase, with platforms deciding which ones they'd like to support and which ones they do not want to support. Currently, the kernel platforms explicitly do an unimplemented! for the gsbase (see #806 (comment)).

@jaybosamiya-ms jaybosamiya-ms marked this pull request as ready for review April 24, 2026 01:27
@jaybosamiya-ms jaybosamiya-ms force-pushed the jayb/arch-specific-provider branch 3 times, most recently from 2542f06 to 8f4da91 Compare April 24, 2026 01:31
Comment thread litebox_platform_linux_kernel/src/lib.rs Outdated
Comment thread litebox_platform_linux_kernel/src/lib.rs Outdated
Comment thread litebox_platform_lvbs/src/lib.rs Outdated
Comment thread litebox_platform_lvbs/src/lib.rs Outdated

@wdcui wdcui left a comment

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.

I left some comments below. Will have some offline discussion with you.

Comment thread litebox_common_linux/src/errno/mod.rs Outdated
Comment thread litebox_platform_linux_kernel/src/lib.rs Outdated
litebox::platform::ArchSpecificRegister::GsBase => {
// GS base is used internally by this platform to hold the host
// TLS base across the guest/host fs-gs swap, so it is not
// directly programmable by the guest.

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.

Why would you expect the guest to call this platform trait?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks! The guest program may invoke SYS_arch_prctl syscall, which the shim needs to handle, and that eventually invokes the platform trait. I'm adding some more comments towards this at the trait itself.

@jaybosamiya-ms jaybosamiya-ms force-pushed the jayb/arch-specific-provider branch from 8f4da91 to 548de6f Compare June 4, 2026 20:44
@jaybosamiya-ms jaybosamiya-ms force-pushed the jayb/arch-specific-provider branch from df107cb to 76bbc4d Compare June 4, 2026 20:53
@jaybosamiya-ms

Copy link
Copy Markdown
Member Author

This PR has been in limbo for a little while. I've now added some more clarity to the docs, and switched a couple of things to unimplemented! where it did not make sense for this PR to be blocked on that (the gsbase stuff were changes that I'd introduced to show more of how things might be used, but the exact implementation is not critical to this refactoring, so I've punted that for later). Hopefully once we can merge this one in, we can fill out the unimplemented!s separately if/when we actually hit them in practice.

@jaybosamiya-ms jaybosamiya-ms requested a review from wdcui June 4, 2026 20:56
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

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

Click for details
--- failure enum_missing: pub enum removed or renamed ---

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

Failed in:
  enum litebox::platform::EitherError, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:209
  enum litebox::platform::trivial_providers::ImpossiblePunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:48
  enum litebox::platform::trivial_providers::ImpossiblePunchthrough, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:40
  enum litebox::platform::PunchthroughError, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:198

--- 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.48.0/src/lints/struct_missing.ron

Failed in:
  struct litebox::platform::trivial_providers::IgnoredPunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:85
  struct litebox::platform::trivial_providers::IgnoredPunchthroughProvider, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:66
  struct litebox::platform::trivial_providers::IgnoredPunchthrough, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:77
  struct litebox::platform::trivial_providers::ImpossiblePunchthroughProvider, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/trivial_providers.rs:26

--- failure trait_added_supertrait: non-sealed trait added new supertraits ---

Description:
A non-sealed trait added one or more supertraits, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-tighten
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/trait_added_supertrait.ron

Failed in:
  trait litebox::platform::Provider gained ArchSpecificProvider in file /home/runner/work/litebox/litebox/litebox/src/platform/mod.rs:29

--- failure trait_method_missing: pub trait method removed or renamed ---

Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/trait_method_missing.ron

Failed in:
  method clear_guest_thread_local_storage of trait ThreadLocalStorageProvider, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:684

--- failure trait_missing: pub trait removed or renamed ---

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

Failed in:
  trait litebox::platform::PunchthroughProvider, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:156
  trait litebox::platform::Punchthrough, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:191
  trait litebox::platform::PunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox/src/platform/mod.rs:173

--- failure trait_removed_supertrait: supertrait removed or renamed ---

Description:
A supertrait was removed from a trait. Users of the trait can no longer assume it can also be used like its supertrait.
        ref: https://doc.rust-lang.org/reference/items/traits.html#supertraits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.48.0/src/lints/trait_removed_supertrait.ron

Failed in:
  supertrait litebox::platform::PunchthroughProvider of trait Provider in file /home/runner/work/litebox/litebox/litebox/src/platform/mod.rs:29

--- failure enum_missing: pub enum removed or renamed ---

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

Failed in:
  enum litebox_common_linux::PunchthroughSyscall, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_common_linux/src/lib.rs:2988

--- 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.48.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_common_linux::UserDescFlags, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_common_linux/src/lib.rs:1132
  struct litebox_common_linux::UserDesc, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_common_linux/src/lib.rs:1125

--- 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.48.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_platform_linux_kernel::LinuxPunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_platform_linux_kernel/src/lib.rs:57

--- 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.48.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_platform_linux_userland::PunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_platform_linux_userland/src/lib.rs:1287

--- 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.48.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_platform_lvbs::LinuxPunchthroughToken, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-main/84f28ec743c369a9c8d81f9f732e00d61463d575/litebox_platform_lvbs/src/lib.rs:410

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.

4 participants