/review 12
Private research annotation
Sign in to add a private research label or note.
- User
/review 12
- User
/clear clear
- User
review /review 12
Assistant
I'll review PR 12. Let me start by gathering the PR details and diff.
Assistant
The diff is large. Let me read the full diff.
Assistant
Let me verify a few correctness concerns by reading the relevant helpers.
Assistant
- User
Fix issue 1 so we don't carry that forward. Add comments on 2
Assistant
Before fixing, let me check whether the free-list zeroing gap also affects page-table intermediate allocation (which would make this more than cosmetic).
Assistant
This is more significant than my review stated.
ensure_next_table(addrspace.rs:273) allocates intermediate page tables viaalloc_frame()and explicitly assumes they come back zeroed (line 82: "alloc_frame zeroes the frame, so the L0 starts all-invalid"). Butalloc_frameonly zeroes on the bump path — free-list frames are returned with stale contents.So issue #1 is not just a data leak: once
pt_unmap→free_framepopulates the free list, a later allocation reused as an intermediate table would build page tables over garbage PTEs. It stays latent in 3.3 only because stub D's intermediate tables are built once at boot and the loop reuses leaf frames (LIFO) whichpt_mapfully overwrites. That means the fix belongs inalloc_frame, not inpt_map— fixing onlypt_mapleaves the intermediate-table hazard.Let me lay out the plan.
Assistant
Let me write the plan to the plan file.
Assistant
Now let me implement. First, the
alloc_framefree-list zeroing fix.Assistant
The
free_framedoc (lines 208-211) already promises alloc-side zeroing ("hand it back out (zeroed — we re-zero on the alloc side")) — the implementation just never honored it on the free-list path. Let me see the full free-list branch.Assistant
Now lightly reword the bump-path comment so it no longer implies free-list frames are left dirty:
Assistant
Now issue #2 — document the VMCTL trust model. Let me read the current module doc and
do_vmctltarget resolution.Assistant
Now the one-liner at target resolution in
do_vmctl:Assistant
Now verify. Run the host tests and the kernel build.
Assistant
28 passing. Now build the kernel and check for warnings.
Assistant
Clean build. Now the QEMU run to confirm 3.3 behavior is unchanged.
Assistant
All verification green. Summary of the changes:
Done
Issue #1 (fixed) —
kernel/src/mm/frame.rsRoot cause was deeper than the review stated:alloc_frame's free-list path returned frames with stale contents, while bothaddrspace::ensure_next_table(intermediate page tables) andVMCTL_PT_MAP(EL0 pages) assume a clean frame. Left unfixed, a freed frame reused as an intermediate table would seed page tables with garbage PTEs, and a leaf reused across address spaces would leak the prior owner's data. The doc already "re-zero on the alloc side" — the implementation just never honored it on the free-list path.- User
commit and push
Assistant
On the PR branch, two files changed. Let me stage and commit.
Assistant
Signed commit. Now push.
Assistant
Done. Committed and pushed to PR #12's branch.
- Commit
eb93b51— GPG-signed (good signature), onfeature/phase-3-3-sys-vmctl. - Pushed
e82bc6c..eb93b51toorigin. PR #12 now includes the two follow-up fixes; the diff there will update automatically.
Both review items are addressed: the free-list zeroing gap is closed at the allocator (covering both the intermediate-page-table hazard and the cross-AS leak), and the VMCTL trust model is documented. Verification (28 host tests, clean aarch64 build, unchanged QEMU behavior) ran before the commit.
- Commit