Skip to content

sidecar: Zero the assist page during ap entry - #4067

Closed
smalis-msft wants to merge 1 commit into
microsoft:mainfrom
smalis-msft:sidecar-zero
Closed

sidecar: Zero the assist page during ap entry#4067
smalis-msft wants to merge 1 commit into
microsoft:mainfrom
smalis-msft:sidecar-zero

Conversation

@smalis-msft

Copy link
Copy Markdown
Contributor

Ensure that the assist page is zeroed out before being enabled with the hypervisor, preventing potential issues from stale data left over from previous boots.

Copilot AI review requested due to automatic review settings July 28, 2026 21:25
@smalis-msft
smalis-msft requested a review from a team as a code owner July 28, 2026 21:25
@github-actions github-actions Bot added the unsafe Related to unsafe code label Jul 28, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 hardens OpenHCL sidecar x86_64 AP startup by ensuring the per-VP Hyper-V assist page is cleared before it is ever enabled for hypervisor consumption, preventing stale data from influencing hypervisor behavior across boots.

Changes:

  • Zero the VP assist page during ap_entry() bootstrapping, alongside existing zeroing of the register and command pages.
  • Document why this is necessary (hypervisor may consume fields the kernel never writes) and why the write is safe at that point.

@smalis-msft smalis-msft added the backport_1.8.2607 Change should be backported to the release/1.8.2607 branch label Jul 28, 2026
@github-actions

Copy link
Copy Markdown

Comment on lines +109 to +118
// Zero the assist page as well. It may hold data from a previous boot, and
// the hypervisor consumes fields this kernel never writes, such as the VTL
// return actions it parses on every VTL return.
//
// SAFETY: the assist page has not been enabled with the hypervisor yet, so
// it is not concurrently accessed.
unsafe {
(*addr_space::assist_page().cast::<[u8; PAGE_SIZE]>()).fill(0);
}

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 don't think there's much point in doing this, given that we subsequently tell the hypervisor to enable the assist page (which maps a new page on top of this memory).

@smalis-msft smalis-msft removed the backport_1.8.2607 Change should be backported to the release/1.8.2607 branch label Jul 30, 2026
@smalis-msft
smalis-msft deleted the sidecar-zero branch July 30, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants