fix(libkernel): place Linux guest thread stacks inside application area #4283
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4283"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T04:09:13Z.
What
Carries Tamalero's Linux guest thread stack implementation from issue #3283, preserving the original implementation commit author (Cesar Rodriguez). A separate follow-up commit tracks each live guest stack's full host mapping and rejects
mprotectranges that overlap its host-only prefix or suffix, including the guard page. This prevents generic guest allocation paths from making those pages writable while preserving valid protection changes inside the guest-visible stack.The stack-protection regression checks a guard-only range and a range crossing from outside into the guest stack. The Linux post-join assertion accepts the reserved
PROT_NONEstate used by the guest arena, and the subsequent stack-reuse test still exercises the address.Tested
guest_kernel_stack_protect_testsandguest_kernel_is_stack_tests; CTest passed 2/2, conventions passed, and the baselineguest_kernel_stack_protecttest passed on that base.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T04:10:08Z.
The conventions run reported the PR sections as empty because the parser expects level-2/3 headings named What, Tested, and Checklist. I updated the body to use the repository template headings and verified the parser now reads all three sections as nonempty. The original run is not rerunnable according to GitHub, so this comment records the correction; a new commit or body-triggered workflow run may be needed to refresh that check.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T04:14:41Z.
All build checks have now completed successfully (including Windows relinker). The only remaining failed status is the original conventions run, which reported empty sections from the initial
###headings. The PR body now uses the repository##headings; I verified the parser reads What, Tested, and Checklist as nonempty. GitHub disallows rerunning the original run with my permissions.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:25:43Z.
Please rebase onto main instead of merging it in (c05000db6 is a merge commit) and force-push. That also re-runs the conventions check, which is still red from the first description.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:17:51Z.
You are right: the current branch includes merge commit c05000db6, so it does not meet the rebase requirement. I will rebase the PR commits onto current main, force-push the branch, and then check that the conventions run reflects the corrected PR description.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:32:43Z.
Rebased both commits onto current
mainwithout a merge commit and force-pushed the updated branch. The previous Linux results were from before this rebase; I updated the PR description so it does not present them as validation of the new head. CI should rerun against the rebased commits.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T13:45:53Z.
Checked on Linux: build and the libs ctest scope pass (146/146),
guest_kernel_is_stackandguest_kernel_stack_protectpass and both fail without the non-test changes. The Linux-only code sits under__linux__; Windows only gets theGuestThreadStackHostRangeOverlapsstub. Rebased without a merge commit as requested. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:06:40Z.
The full Build failed on Windows in
guest_kernel_stack_protect(failed at line 90,Require(hostGuard != 0)): the new host-guard check looks for a non-writable host page below the guest stack, which only exists with the Linux stack mapping; Windows keeps its normal thread stacks.Added one commit on top,
test(libkernel): check the host-only stack guard on Linux only, that puts that block under#ifdef __linux__, and rebased onto current main. Build and the libs ctest scope pass (146/146). Merging once the full Build is green.