WIP: Enforce AP supervisor memory policy #144

Draft
erikinkinen wants to merge 6 commits from feature/ap-supervisor-memory-policy into feature/native-private-root-activation
Owner

Require an AP to match the retained BSP PAT and applicable MTRR policy before installing its final Kernel root. Set and read back supervisor write protection during genuine AP admission. Remove the unconditional PAT-slot rewrite so startup preserves the original cache policy.

Builds on #141; part of #11. See AP supervisor-memory admission.

  • Retain complete supported PAT/MTRR policy and refuse incompatible or unreadable firmware controls.
  • Preserve original cache typing and complete local cache/TLB and WP admission effects.
  • Complete matching-image 1/2/4-CPU readback, supervisor write-denial and failed-admission resource-retention acceptance.

Live PAT/MTRR retyping requires a separate coordinated protocol. Physical resource ownership and DMA isolation remain separate requirements.

Require an AP to match the retained BSP PAT and applicable MTRR policy before installing its final Kernel root. Set and read back supervisor write protection during genuine AP admission. Remove the unconditional PAT-slot rewrite so startup preserves the original cache policy. Builds on #141; part of #11. See [AP supervisor-memory admission](https://git.erikinkinen.fi/erix/kernel/src/branch/feature/ap-supervisor-memory-policy/docs/ap-memory-policy.md). - [x] Retain complete supported PAT/MTRR policy and refuse incompatible or unreadable firmware controls. - [x] Preserve original cache typing and complete local cache/TLB and WP admission effects. - [ ] Complete matching-image 1/2/4-CPU readback, supervisor write-denial and failed-admission resource-retention acceptance. Live PAT/MTRR retyping requires a separate coordinated protocol. Physical resource ownership and DMA isolation remain separate requirements.
erikinkinen added this to the Alpha 1 milestone 2026-11-13 16:07:04 +01:00
Retain the original BSP PAT and applicable MTRR controls instead of rewriting an assumed unused PAT slot. Refuse mismatched or unreadable policy before final root installation, and complete processor-local cache and supervisor write-protection readback while the genuine AP occupation is still preparing.
fix: Account for firmware memory type overrides at AP admission
Some checks failed
CI / markdown (push) Failing after 3s
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / test (push) Has been cancelled
ab69af1025
Retain AMD ASeg and TSeg redirection policy along with normal memory controls. Refuse Intel SMRR configurations until their model-specific firmware read contract exists instead of omitting their non-SMM effects or risking an unsupported MSR access.
docs: Wrap the AP firmware policy description
Some checks failed
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / test (push) Has been cancelled
ae498e3742
Keep the supported AMD memory-control description within the shared documentation format.
fix: Authenticate AP startup before memory policy effects
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / test (push) Successful in 8m21s
c93bfe6bba
Check the actual dispatched occupation, retained worker stack and original startup CR3 before cache and FP admission effects. Recheck that same source again at final root installation without constructing a separate acknowledgement or relaxing quarantine.
Compare the original HWCR table-walk cache bit without copying unrelated processor controls. Keep selector compatibility distinct from proof that the original effective memory type supports hardware table walks.
feat: Derive table walk selectors from original memory policy
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / test (push) Successful in 8m32s
61426f90d0
Prove the original physical page and heap alias use effective write-back memory through applicable fixed, variable and default MTRRs before choosing a compatible hardware walk selector. Refuse unsupported firmware overrides and preflight FP support before local cache effects; keep the source-data query closed to production until its original table owner is composed.
Author
Owner

The AP now verifies its dispatched startup source, owned worker stack and original CR3 before cache or FP effects. The shared policy also provides a physical-page table-walk selector query based on applicable MTRRs and the original PAT, with unsupported firmware overrides refused. Native 1/2/4-CPU acceptance remains open.

The AP now verifies its dispatched startup source, owned worker stack and original CR3 before cache or FP effects. The shared policy also provides a physical-page table-walk selector query based on applicable MTRRs and the original PAT, with unsupported firmware overrides refused. Native 1/2/4-CPU acceptance remains open.
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / test (push) Successful in 8m32s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'feature/ap-supervisor-memory-policy:feature/ap-supervisor-memory-policy'
git switch 'feature/ap-supervisor-memory-policy'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'feature/native-private-root-activation'
git merge --no-ff 'feature/ap-supervisor-memory-policy'
git switch 'feature/ap-supervisor-memory-policy'
git rebase 'feature/native-private-root-activation'
git switch 'feature/native-private-root-activation'
git merge --ff-only 'feature/ap-supervisor-memory-policy'
git switch 'feature/ap-supervisor-memory-policy'
git rebase 'feature/native-private-root-activation'
git switch 'feature/native-private-root-activation'
git merge --no-ff 'feature/ap-supervisor-memory-policy'
git switch 'feature/native-private-root-activation'
git merge --squash 'feature/ap-supervisor-memory-policy'
git switch 'feature/native-private-root-activation'
git merge --ff-only 'feature/ap-supervisor-memory-policy'
git switch 'feature/native-private-root-activation'
git merge 'feature/ap-supervisor-memory-policy'
git push origin 'feature/native-private-root-activation'
Sign in to join this conversation.
No description provided.