docs(libkernel): record cleanup unwind and allocation limits #9298

Merged
UnhealthyKraken merged 1 commit from upstream-pr/9298 into main 2026-10-25 10:38:10 +00:00
UnhealthyKraken commented 2026-10-21 17:48:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-21T17:48:30Z.


What

Record the remaining limits of pthread_cleanup_push/pthread_cleanup_pop in libkernel's technical debt. #8428 reported that the firmware heap form sets an unwind-disabled flag, but the implementation does not model that flag. Runtime-created guest threads skip guest-frame unwinding on exit. The note attributes the firmware reading to that contributor and also distinguishes the current C++ allocation from FreeBSD's failure path; the console allocation-failure contract remains unverified.

Documentation only. No runtime or test source changes, and no new console measurement.

Tested

Windows x86-64, GCC 15.2, Release. Built affected libkernel/test targets on current main. guest_once, guest_pthread_cancel, guest_pthread_cancel_recovery and guest_pthread_cancel_recovery_coarse: 4/4 pass before and after this documentation change.

A local canonical-export probe passes 937 assertions across nine concurrent guest workers: mixed heap/caller records, LIFO cleanup before TLS destruction, execute-zero and nonzero pops, reentrant pop, callback identity, caller-record fields/padding and guard pages. This validates a current-model subset; it does not prove guest-frame unwinding, allocation-failure behavior or heap leak freedom. The probe is audit material outside this PR.

Checked the allocation statement against pinned FreeBSD 11.4 thr_clean.c and the unwind statement against the current thread-exit paths. Independent review qualified the exit statement to runtime-created threads because adopted POSIX threads can fall back to native pthread_exit. Conventions, whitespace and required overlap checks completed. No Linux or own PS5 run for this audit.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (libkernel documentation)
  • AI-assisted: yes (Codex); independently reviewed by another Codex agent
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4955918078 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9298). Originally posted by [UnhealthyKraken](https://github.com/UnhealthyKraken) on 2026-10-21T17:48:30Z. --- ### What Record the remaining limits of `pthread_cleanup_push`/`pthread_cleanup_pop` in libkernel's technical debt. #8428 reported that the firmware heap form sets an unwind-disabled flag, but the implementation does not model that flag. Runtime-created guest threads skip guest-frame unwinding on exit. The note attributes the firmware reading to that contributor and also distinguishes the current C++ allocation from FreeBSD's failure path; the console allocation-failure contract remains unverified. Documentation only. No runtime or test source changes, and no new console measurement. ### Tested Windows x86-64, GCC 15.2, Release. Built affected libkernel/test targets on current main. `guest_once`, `guest_pthread_cancel`, `guest_pthread_cancel_recovery` and `guest_pthread_cancel_recovery_coarse`: 4/4 pass before and after this documentation change. A local canonical-export probe passes 937 assertions across nine concurrent guest workers: mixed heap/caller records, LIFO cleanup before TLS destruction, execute-zero and nonzero pops, reentrant pop, callback identity, caller-record fields/padding and guard pages. This validates a current-model subset; it does not prove guest-frame unwinding, allocation-failure behavior or heap leak freedom. The probe is audit material outside this PR. Checked the allocation statement against pinned FreeBSD 11.4 `thr_clean.c` and the unwind statement against the current thread-exit paths. Independent review qualified the exit statement to runtime-created threads because adopted POSIX threads can fall back to native `pthread_exit`. Conventions, whitespace and required overlap checks completed. No Linux or own PS5 run for this audit. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (libkernel documentation) - [x] AI-assisted: yes (Codex); independently reviewed by another Codex agent
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9298
No description provided.