docs(libkernel): drop stale mlockall, open file limit and protection bit claims #9363

Merged
thuanquang merged 1 commit from upstream-pr/9363 into main 2026-10-25 10:44:37 +00:00
thuanquang commented 2026-10-21 19:20:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T19:20:53Z.


What

Four statements in docs/dev/debt/libkernel.md no longer match main; each is replaced with what main does now, and nothing else in the entries changes.

  • mlockall, munlockall: "On main, XPSemu (PPSA97358) fails to load at these imports (mlockall #4386, munlockall)". Both imports are exported now. mlockall_nid_postfix is at core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp:311 (a7ea2bdcaa, #4386) and munlockall_nid_postfix is at :320 (e03e6f7a4e, #5663). Both sit in the extern "C" block with no platform guard, and their NIDs, x7g7Ebeo8-U and NpLBpgVV7PU, are the two XPSemu imports those commits name. e03e6f7a4e wrote this sentence, so it described main before #5663 merged. Now: "XPSemu (PPSA97358) imports mlockall and munlockall".
  • pthread_atfork: "; XPSemu currently stops first at the unresolved mlockall import (#4386)". mlockall is exported at core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp:311. It came from a7ea2bdcaa in #4386, which merged (bc1ded3a18) before #4377 (8d455b8018, merge 40047f46bd) added this clause, so the clause was already stale when it landed. The remaining text, "current-main runtime reachability is unverified", still records the open gap. Now: "" (clause removed).
  • getdtablesize: "The guest limit is the host's soft limit, raised to the hard limit when libkernel loads only on Linux: core/libs/prx/libkernel/File/src/OpenFileLimit.cpp is __linux__-only, so on macOS the guest gets whatever soft limit the host process inherited." core/libs/prx/libkernel/File/src/OpenFileLimit.cpp:1 is now #if defined(__linux__) || defined(__APPLE__). Lines :16-26 set both limits at load to the hard limit, which on macOS is first lowered to kern.maxfilesperproc (0cb9d92b56, #6836). The getrlimit entry already gives these per-host values. The guest limit equals the host's soft limit only off Windows (core/libs/prx/libkernel/System/src/Process.cpp:754-758); Windows uses a fixed 8192 (:751-753). Now: "On Linux and macOS the guest limit is the host's soft limit."
  • LinuxProtFromSce: "protection bits 0x100 and 0x200 are accepted and assumed not to affect host CPU access; host protection is derived only from the read, write and execute bits". core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp:271-272 map prot & 0x113 to host read and prot & 0x222 to host read/write, so 0x100 and 0x200 grant host access like the GPU bits. That changed in b567bb8eed (#900), which merged after #550 (49b2f9e49b) wrote this entry. The 'Memory protection bits 0x100 and 0x200' entry (docs/dev/debt/libkernel.md:57) already says this and gives its sources, so the whole bullet goes. Now: "" (bullet removed).

Tested

Docs only; nothing was built or run. On origin/main 0ae788741d, I read PosixMemory.cpp (the mlockall and munlockall exports at :311 and :320, in the extern C block from :147 with no guard after :229), OpenFileLimit.cpp, Process.cpp:748-762 and 827-837 (the guest RLIMIT_NOFILE and getdtablesize) and DirectMemory.cpp:265-275 (LinuxProtFromSce); I also checked each change's commits and merge order and recomputed the mlockall and munlockall NIDs with the tools/nid_names.py algorithm (x7g7Ebeo8-U, NpLBpgVV7PU). Rebased on main 0ae788741d: #10136 rewrote the neighbouring close, sceKernelClose entry, which stays as main has it. Of the cited source files only Process.cpp changed since 6ef5a1c4c9 (#8537, #8985, #8986, #9218); its open file limit code only moved, and the 'Memory protection bits' entry is now at :57. Each statement was found by a read-only sweep of the debt files and confirmed by two independent verifier passes and a final check on current main. No open pull request edits these sentences: tools/pr_overlap.py --branch on 0ae788741d found no overlap, and I checked by hand the diffs of the 33 open PRs that edit this file but could not be compared because they conflict with main.

  • python tools/check_conventions.py --base origin/main with this title and body: 0 errors and 1 debt-length warning, for entries that were already over 1000 characters: mlockall, munlockall (1067 characters before, 1034 after this change).
  • Not tested: behaviour on any machine; this changes text only.

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
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4957091642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9363). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-21T19:20:53Z. --- ### What Four statements in `docs/dev/debt/libkernel.md` no longer match `main`; each is replaced with what `main` does now, and nothing else in the entries changes. - **mlockall, munlockall**: "On main, XPSemu (PPSA97358) fails to load at these imports (mlockall #4386, munlockall)". Both imports are exported now. `mlockall_nid_postfix` is at core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp:311 (a7ea2bdcaa, #4386) and `munlockall_nid_postfix` is at :320 (e03e6f7a4e, #5663). Both sit in the `extern "C"` block with no platform guard, and their NIDs, x7g7Ebeo8-U and NpLBpgVV7PU, are the two XPSemu imports those commits name. e03e6f7a4e wrote this sentence, so it described main before #5663 merged. Now: "XPSemu (PPSA97358) imports `mlockall` and `munlockall`". - **pthread_atfork**: "; XPSemu currently stops first at the unresolved `mlockall` import (#4386)". `mlockall` is exported at core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp:311. It came from a7ea2bdcaa in #4386, which merged (bc1ded3a18) before #4377 (8d455b8018, merge 40047f46bd) added this clause, so the clause was already stale when it landed. The remaining text, "current-main runtime reachability is unverified", still records the open gap. Now: "" (clause removed). - **getdtablesize**: "The guest limit is the host's soft limit, raised to the hard limit when libkernel loads only on Linux: `core/libs/prx/libkernel/File/src/OpenFileLimit.cpp` is `__linux__`-only, so on macOS the guest gets whatever soft limit the host process inherited." core/libs/prx/libkernel/File/src/OpenFileLimit.cpp:1 is now `#if defined(__linux__) || defined(__APPLE__)`. Lines :16-26 set both limits at load to the hard limit, which on macOS is first lowered to `kern.maxfilesperproc` (0cb9d92b56, #6836). The getrlimit entry already gives these per-host values. The guest limit equals the host's soft limit only off Windows (core/libs/prx/libkernel/System/src/Process.cpp:754-758); Windows uses a fixed 8192 (:751-753). Now: "On Linux and macOS the guest limit is the host's soft limit." - **LinuxProtFromSce**: "protection bits 0x100 and 0x200 are accepted and assumed not to affect host CPU access; host protection is derived only from the read, write and execute bits". core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp:271-272 map `prot & 0x113` to host read and `prot & 0x222` to host read/write, so 0x100 and 0x200 grant host access like the GPU bits. That changed in b567bb8eed (#900), which merged after #550 (49b2f9e49b) wrote this entry. The 'Memory protection bits 0x100 and 0x200' entry (docs/dev/debt/libkernel.md:57) already says this and gives its sources, so the whole bullet goes. Now: "" (bullet removed). ### Tested Docs only; nothing was built or run. On origin/main 0ae788741d, I read PosixMemory.cpp (the mlockall and munlockall exports at :311 and :320, in the extern C block from :147 with no guard after :229), OpenFileLimit.cpp, Process.cpp:748-762 and 827-837 (the guest RLIMIT_NOFILE and getdtablesize) and DirectMemory.cpp:265-275 (LinuxProtFromSce); I also checked each change's commits and merge order and recomputed the mlockall and munlockall NIDs with the tools/nid_names.py algorithm (x7g7Ebeo8-U, NpLBpgVV7PU). Rebased on `main` 0ae788741d: #10136 rewrote the neighbouring `close, sceKernelClose` entry, which stays as `main` has it. Of the cited source files only Process.cpp changed since 6ef5a1c4c9 (#8537, #8985, #8986, #9218); its open file limit code only moved, and the 'Memory protection bits' entry is now at :57. Each statement was found by a read-only sweep of the debt files and confirmed by two independent verifier passes and a final check on current `main`. No open pull request edits these sentences: `tools/pr_overlap.py --branch` on 0ae788741d found no overlap, and I checked by hand the diffs of the 33 open PRs that edit this file but could not be compared because they conflict with `main`. - `python tools/check_conventions.py --base origin/main` with this title and body: 0 errors and 1 `debt-length` warning, for entries that were already over 1000 characters: mlockall, munlockall (1067 characters before, 1034 after this change). - Not tested: behaviour on any machine; this changes text only. ### 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 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!9363
No description provided.