Skip to content

Conversation

@chris-oo
Copy link
Member

Add a simple bump allocator to allow openhcl_boot to decode protobuf payloads using mesh decode. Note that this PR only introduces the allocator, a follow up change will use it.

Add a new nightly cfg gate to allow running miri tests with nightly.

For now, add a small debug assertion enabled section that uses the allocator. This will be removed in the next change.

@chris-oo chris-oo requested a review from a team as a code owner September 22, 2025 16:54
Copilot AI review requested due to automatic review settings September 22, 2025 16:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a simple bump allocator to openhcl_boot to enable protobuf payload decoding using mesh decode. The allocator is designed for limited use during boot operations, particularly for servicing boot scenarios where protobuf data needs to be parsed from previous instances.

  • Adds a new BumpAllocator implementation with strict allocation controls
  • Reserves 16 pages of memory for the bootloader heap in both paravisor configurations
  • Introduces nightly Rust configuration support for allocator API features

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vm/loader/src/paravisor.rs Reserves 16 pages for bootshim heap and passes heap parameters to both paravisor configurations
vm/loader/loader_defs/src/shim.rs Adds heap offset and size fields to ShimParamsRaw structure
openhcl/openhcl_boot/src/main.rs Enables nightly feature gate and adds allocator/bump_alloc module
openhcl/openhcl_boot/src/host_params/shim_params.rs Processes heap parameters and creates MemoryRange for heap allocation
openhcl/openhcl_boot/src/host_params/dt.rs Initializes heap allocator and includes debug test code
openhcl/openhcl_boot/src/bump_alloc.rs Implements the complete bump allocator with safety controls and testing
openhcl/openhcl_boot/build.rs Adds cargo configuration for nightly feature support

@github-actions
Copy link

smalis-msft
smalis-msft previously approved these changes Sep 22, 2025
smalis-msft
smalis-msft previously approved these changes Sep 25, 2025
chris-oo added a commit that referenced this pull request Sep 25, 2025
The implementation for intrinsics in minimal_rt was incorrect. For
example, the inline asm block for `memcpy` correctly describes that
`rdi` will be clobbered by `rep movsb`, but `memcpy`'s API requires that
the return value is the _original_ destination pointer, not the
incremented pointer. Fix this by removing the mut on `dest` and
indicating to the compiler to discard the clobbered value.

It seems that in most cases, the compiler ignored the return value of
memcpy, except when #2031 was being added. Certain compilation options
or function implementations would cause the compiler to use the inlined
returned value of `memcpy` directly from the call to realloc, which
would then cause a later an assertion failure due to the pointer not
being what was expected and overlapping with the new destination.

Fix all the intrinsics in `minimal_rt` to correctly return the
unmodified `dest` or `ptr` as they should.
@chris-oo chris-oo merged commit a5e7f55 into microsoft:main Sep 29, 2025
70 of 74 checks passed
@chris-oo chris-oo deleted the bootshim-alloc-miri branch September 29, 2025 20:05
andyplank-msft pushed a commit to andyplank-msft/openvmm that referenced this pull request Nov 4, 2025
…osoft#2041)

The implementation for intrinsics in minimal_rt was incorrect. For
example, the inline asm block for `memcpy` correctly describes that
`rdi` will be clobbered by `rep movsb`, but `memcpy`'s API requires that
the return value is the _original_ destination pointer, not the
incremented pointer. Fix this by removing the mut on `dest` and
indicating to the compiler to discard the clobbered value.

It seems that in most cases, the compiler ignored the return value of
memcpy, except when microsoft#2031 was being added. Certain compilation options
or function implementations would cause the compiler to use the inlined
returned value of `memcpy` directly from the call to realloc, which
would then cause a later an assertion failure due to the pointer not
being what was expected and overlapping with the new destination.

Fix all the intrinsics in `minimal_rt` to correctly return the
unmodified `dest` or `ptr` as they should.
andyplank-msft pushed a commit to andyplank-msft/openvmm that referenced this pull request Nov 4, 2025
…osoft#2031)

Add a simple bump allocator to allow `openhcl_boot` to decode protobuf
payloads using mesh decode. Note that this PR only introduces the
allocator, a follow up change will use it.

Add a new nightly cfg gate to allow running miri tests with nightly. 

For now, add a small debug assertion enabled section that uses the
allocator. This will be removed in the next change.
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