fix(libkernel): retire stack metadata before releasing mappings #5597
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5597"
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 JJenkx on 2026-10-14T00:43:01Z.
What
A joined or retired Linux guest stack is unmapped before its host-page metadata is removed. Another thread can reuse the address between those operations and have its new stack guard rejected with
mprotect overlaps host-only guest thread stack pages.Remove the finished stack's metadata before returning its mapping to the allocator, in both joined-stack cleanup and detached-stack reaping. The native thread has already joined or disappeared from
/proc/self/taskat these points. Live-stack protection checks are preserved.Tested
guest_pthread_stack,guest_kernel_stack_protectandguest_ampr_threadseach pass 20 repetitions on the local combined integration: 60 successful runs, no skips. The protection test still rejects changes to live host-only pages.guest_ampr_threadswith the overlap error. The stale-entry ordering is proven by the regression; that CI abort's precise scheduling has not been reproduced.Checklist
feddf7f4c654; no equivalent open retirement-order fix foundStandalone full Linux and Windows validation passes for topic head
d1527840ea3.Standalone full CI: Linux 1043 passed / 46 skipped; Windows 720 passed / 389 skipped. Skipped cases remain unvalidated.