Sync ulitebox to latest main - #1301
Merged
Jay Bosamiya (Microsoft) (jaybosamiya-ms) merged 43 commits intoSep 5, 2026
Merged
Jay Bosamiya (Microsoft) (jaybosamiya-ms) merged 43 commits into
Jay Bosamiya (Microsoft) (jaybosamiya-ms) merged 43 commits into
Conversation
Pre-set the ACCESSED and DIRTY flags when creating page table entries, matching Linux’s `_KERNPG_TABLE` behavior. This avoids atomic read-modify-write operations by the CPU page-table walker on first access. Co-authored-by: Claude <noreply@anthropic.com>
This PR adds supports for generating identity signing key (IDK_S) to the OP-TEE shim. A new function, `generate_identity_signing_key`, generates an IDK_S key pair based on the platform's CSPRNG and writes the public portion of it to the VTL0-side buffer. Currently, it generates and returns an uncompressed SEC1 P-384 public key. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
This PR merges some operations to use a single `Handle` enum, rather than do them individually. This simplifies the `Backend` interface and also allows for supporting `chmod` of `/` (for example), which is needed as more backends move to the new design.
This PR switches our in-memory filesystem to the new core file system design (see #887). Concretely, it adds a `InMem` backend, migrates all old usage of `in_mem::FileSystem` to a resolver-backed one to use the new `InMem` backend, and then removes the old `in_mem::FileSystem`. It also revamps the in-mem backend initialization design, moving away from the ugly "temporarily change user and do operations" to an actual controlled initialization, which reduces the chances of footguns, and also makes future improvements easier :)
Require search/read perms on target/parents depending on situation
This PR separates the HEKI/HVCI features from `litebox_platform_lvbs`. It introduces a `litebox_service_heki` crate which hosts all HEKI/HVCI features (algorithms). This crate and the runner rely on `Vtl0Gate`, `Vtl0PrivilegedWrite`, and `Vtl1Gate` abstraction concretized by `litebox_platform_lvbs` to gate VTL0 interaction and self-protect VTL1. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
This PR fixes handling of OP-TEE `ldelf` segment padding. `ldelf` can place paddings (unmapped/free pages) before and after a segment. Previously, we assumed that the paddings of different segments are disjoint, but they are not. Also, since `ldelf` is unaware of the syscall trampoline, we should ignore a trampoline page when we deal with paddings. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Fix Python runner tests failing with: `ModuleNotFoundError: No module named 'encodings'` `rust-cache` removes staged files while preserving empty directory structures under `target/tmp`. The staging logic previously treated an existing destination directory as complete and skipped copying its contents. Add a cache-excluded completion marker after each Python directory is staged. Missing markers now trigger a fresh copy, covering empty, partial, and interrupted staging directories.
By storing a tiny bit of data, we don't need to bother grabbing a lock before we know which subsystem an FD belongs to when iterating, and can selectively only grab locks when pointing at the correct subsystem.
This PR switches our 9p filesystem to the new core file system design (see #887). Like prior migrations, it adds a new backend, migrates all old usages to a resolver-backed one to use the new backend, and then removes the old `FileSystem` object. Additionally, as a drive-by-fix, the old `read_dir`'s check reports every entry as a regular file (because it looked at `e.typ` rather than `e.qid.typ`); the new backend fixes this.
This PR fixes some rare deadlocks that occur on Windows. Specifically, a still-running thread races with process teardown, which on Windows can in rare cases get stuck. Doing a `join` fixes this. It also helps surface panics _if_ they occur on the thread.
The existing implementation of `box_new_zeroed` was unnecessarily complex. This PR simplifies it. Co-authored-by: Leon Schuermann <t-leonsc@microsoft.com>
This PR makes the OP-TEE shim's mmap allocate virtual addresses (VAs) from low to high addresses. OP-TEE allocates userspace VAs bottom-up, whereas LiteBox allocates them top-down. This mismatch can lead to incompatibilities (e.g., padding management). --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Fixes #1159: replace independently atomic resource-limit fields with an `RwLock`-protected array.
Fixes #1171: take the `raw_descriptor_store` write lock once in `sys_pipe2` and hold it across both inserts and the rollback, so the writer's slot cannot be recycled.
This PR fixes forced delivery of a signal. Two issues fixed: 1. `handle_exception_request` covers `SIGFPE`, `SIGTRAP`, and `SIGILL`, but `force_signal_with_info` asserts the signal is `SIGKILL` or `SIGSEGV`. 2. `siginfo_exception` is used to return `SigInfo` with a fixed code (`SI_KERNEL`), ignoring other codes like `FPE_INTDIV` and `ILL_ILLOPN`. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Move the TA UUID-to-binary map out of individual shim instances so TA binaries can be registered once and reused across instances. This global map is required to support Dyanamically Loading TAs and using them across sessions. Protect the map with a spin-based RwLock and expose shim methods for storing and retrieving TA binaries. Register the LVBS runner's embedded TA during BSP initialization and resolve new TA instances through the shared map. --------- Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
This PR pins GitHub Actions to full-length commit SHAs and adds a 7 day cooldown to Dependabot configuration for GitHub Actions. See more detail at https://aka.ms/action-pinning.
Update `actions/checkout` from 6.1.0 to 7.0.1, `actions/setup-node` from 6.5.0 to 7.0.0, `actions/cache` from 5.1.0 to 6.1.0 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Avoid panicking during initialization when an embedded TA binary is an empty placeholder. Fixes: e33f6ff: share TA binaries through a global UUID map Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
This PR removes the old layered file system, which had to deal with two different semantics with non-trivial complexity, instead to an overlay-based file system. This is aided by work I'd done to set up the ability to mount things (via the composer, #995), as well as a backend trait more amenable to the necessary composition (`Backend`, #887). With this PR, the last of the remaining layered file systems are removed.
This PR fixes the out-of-memory (OOM) handling of page-sized memory allocation. Currently, LiteBox's allocator panics when its page-sized memory allocation fails. This prevents us from using fallible APIs like `try_reserve` which expect the allocator reports OOM by returning `null`. Co-authored-by: Sangho Lee <sanghle@microsoft.com>
This PR mechanically removes the legacy `FileSystem` trait, so that everything is now based on the new `Backend`-based interface (#887). The relevant north interface now sits as inherent methods of `Resolver`.
This PR switches the file system resolver to explicit `Context`s, so that the underlying file system(s) and the context that they are used in are separated. Essentially, this means that nothing within the file system is itself aware of CWD (current working dir) or acting user now, and the `Context` object explicitly carries this. This means that the Linux shim no longer needs to maintain its own `cwd: String` field and manipulation of it, allowing resolution + permission decisions to live in one place. Along with this, I also updated the in-mem backend to use the resolver context rather than maintain its own user management, closing out yet another place of unnecessary duplication and potential inconsistency. Finally, as a drive-by fix: `getcwd` no longer returns a trailing `/`, making it more consistent with Linux.
…ns group (#1243) Update `taiki-e/install-action` from 2.86.3 to 2.86.5 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This PR prevents the exception fixup path from misclassifying asynchronous faults as memory faults. Currently, an asynchronous signal delivered during exception fixup execution is handled as a memory fault, causing `memcpy_fallible` to abort and the signal to be lost. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
When running on forks, the auth tokens do not allow the CI to put the normal automated semver comment, which makes it hard to keep track of when something actually might tweak semver behavior for PRs from a fork. This PR changes it so that when something is semver-changing, it requires a comment (which it gives precisely the comment to copy-paste into place) so actually succeed on a fork.
This PR uses `Arc` reference counters for LVBS/OP-TEE page tables to safely share them across cores. In particular, it makes the page-table lifetime/ownership explicit rather than relies on session-level serialization. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Fix #1170: keep FD allocation and exact replacement atomic under the raw descriptor table lock.
The old code assumed that `rsp` is restored to `host_sp` and then read thread context via `*rsp` to `rcx`, but `rsp` is actually assigned to `host_sp - EXCEPTION_RECORD`. This PR fixes it by directly assigning `*host_sp` to `rcx`.
…1257) This PR enables direct memory copy between VTL0 (normal world) and VTL1 (secure world) userspace. Currently, we should use in-VTL1-kernel (in-LiteBox) bounce buffers to copy data between these two foreign memory domains regardless of whether the kernel/LiteBox checks the content. This results in pure time delay and memory pressure. Note that this direct memory copy does not affect LiteBox's memory safety because both source and destination are not Rust (kernel) memory. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Fix #1172: hold the descriptor-table write lock across both socketpair fd insertions and rollback.
Store directory positions as shared entry metadata so duplicated descriptors share `getdents64` and `lseek` updates. Add a C regression test that runs on both host Linux and LiteBox. Fix #1262
) This PR lets LiteBox/LVBS secure kernel directly copy data between normal-world shared memory and TA memory without relying on kernel-owned bounce buffers. It does not harm our security guarantee because source and destination addresses as well as their data sizes are tightly checked. It still ensures that TAs never directly access normal-world memory. --------- Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Move clone stack validation before child TID allocation and `CLONE_PARENT_SETTID` publication. This prevents an invalid `clone3` call from exposing a TID for a child that was never created. Fixes #1266
This PR fixes a race in TA classification by rechecking the TA flags (i.e., single- or multi-instance). It eliminates a small window where a single-instance TA could be loaded more than once. Co-authored-by: Sangho Lee <sanghle@microsoft.com>
This PR fixes a few remaining stack alignment issues in LVBS boot trampolines. Co-authored-by: Sangho Lee <sanghle@microsoft.com>
Member
Author
|
Meant to be normally-merged, not squash-merged; I'll handle that once I get a CI green. |
Jay Bosamiya (Microsoft) (jaybosamiya-ms)
marked this pull request as ready for review
September 5, 2026 00:31
Jay Bosamiya (Microsoft) (jaybosamiya-ms)
force-pushed
the
jayb/resync-ulitebox-to-main
branch
from
September 5, 2026 00:40
502523d to
8dd8b2f
Compare
Jay Bosamiya (Microsoft) (jaybosamiya-ms)
force-pushed
the
jayb/resync-ulitebox-to-main
branch
from
September 5, 2026 01:00
9ba8fb6 to
04f3b35
Compare
|
🤖 SemverChecks 🤖 Click for details |
Jay Bosamiya (Microsoft) (jaybosamiya-ms)
merged commit Sep 5, 2026
18913eb
into
ulitebox
10 checks passed
Jay Bosamiya (Microsoft) (jaybosamiya-ms)
deleted the
jayb/resync-ulitebox-to-main
branch
September 5, 2026 01:19
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR resyncs
uliteboxto recent changes inmain, fixing conflicts, as well as fixing up code that needs updates due to recent changes on main. Last such sync was #1074.