docs(libkernel): name what FreeBSD and the emulators do for an unaligned sceKernelMunmap length #13866

Merged
xXPBSXx merged 2 commits from upstream-pr/13866 into main 2026-11-01 04:50:15 +00:00
xXPBSXx commented 2026-10-31 10:14:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-31T10:14:29Z.


What

Adds one entry to the libkernel technical debt: sceKernelMunmap fails a length that is not a multiple of the 16 KiB guest page with EINVAL, which was taken over from an earlier throw and which no console run has checked. FreeBSD 11.4's kern_munmap (vm_mmap.c#L535-L542) rounds the address down and the length up instead, shadPS4 and fpPS4 round as well, and KytyPS5 does not check the alignment. The guest munmap already rounds like FreeBSD (#10550); sceKernelMunmap has its own path. The entry does not say which behaviour is right and no code or test changes. Forty of the 53 local titles import sceKernelMunmap.

Tested

Documentation only. tools/check_conventions.py --base upstream/main passes. Based on main 809c7fa2df, and it merges with main 2db749ef2e without a conflict (checked 2026-10-31 10:12 UTC). I read FreeBSD's vm_mmap.c (the blob matches release/11.4.0) and the three emulators at the commits named in the entry (KytyPS5 5e837a9beac82c031868eaad9348d6a48245fb99, shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81, fpPS4 04cefd43e6fddd1ab033e7980cd356d14c964905), and our DoMunmap and munmap_nid_postfix. Not run: a build or a test, because nothing but the debt file changes.

Overlap

Checked on 2026-10-31 against main 809c7fa2dfb1b21e2b31b3114b7d51bc14ee88ab (1591 open pull requests, listed at 06:39 UTC; the merge checks ran from 08:54 UTC to 09:05 UTC). I took the changed files of each from git diff --name-only against its merge base (one ref, #13454, could not be fetched; the GitHub file list shows it does not change docs/dev/debt/libkernel.md). 92 of them change that file. git merge-tree of this head with each of the 92: 39 conflict, and every one of the 39 also conflicts with main on its own, so none conflicts because of this entry. I put the line after the Locked memory on macOS entry because, after the mincore entry, it conflicted with #12854 and #11042, which each change a neighbouring line. Checked once more on 2026-10-31 at 09:59 UTC against main 2db749ef2e: of the 63 pull requests opened since 06:30 UTC, five change that file (#13790, #13798, #13824, #13832, #13854) and none of them conflicts with this entry.

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

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5096615356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13866). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-31T10:14:29Z. --- ### What Adds one entry to the libkernel technical debt: `sceKernelMunmap` fails a length that is not a multiple of the 16 KiB guest page with `EINVAL`, which was taken over from an earlier throw and which no console run has checked. FreeBSD 11.4's `kern_munmap` ([vm_mmap.c#L535-L542](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/vm/vm_mmap.c#L535-L542)) rounds the address down and the length up instead, shadPS4 and fpPS4 round as well, and KytyPS5 does not check the alignment. The guest `munmap` already rounds like FreeBSD (#10550); `sceKernelMunmap` has its own path. The entry does not say which behaviour is right and no code or test changes. Forty of the 53 local titles import `sceKernelMunmap`. ### Tested Documentation only. `tools/check_conventions.py --base upstream/main` passes. Based on `main` `809c7fa2df`, and it merges with `main` `2db749ef2e` without a conflict (checked 2026-10-31 10:12 UTC). I read FreeBSD's `vm_mmap.c` (the blob matches `release/11.4.0`) and the three emulators at the commits named in the entry (KytyPS5 5e837a9beac82c031868eaad9348d6a48245fb99, shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81, fpPS4 04cefd43e6fddd1ab033e7980cd356d14c964905), and our `DoMunmap` and `munmap_nid_postfix`. Not run: a build or a test, because nothing but the debt file changes. ### Overlap Checked on 2026-10-31 against `main` `809c7fa2dfb1b21e2b31b3114b7d51bc14ee88ab` (1591 open pull requests, listed at 06:39 UTC; the merge checks ran from 08:54 UTC to 09:05 UTC). I took the changed files of each from `git diff --name-only` against its merge base (one ref, #13454, could not be fetched; the GitHub file list shows it does not change `docs/dev/debt/libkernel.md`). 92 of them change that file. `git merge-tree` of this head with each of the 92: 39 conflict, and every one of the 39 also conflicts with `main` on its own, so none conflicts because of this entry. I put the line after the `Locked memory on macOS` entry because, after the `mincore` entry, it conflicted with #12854 and #11042, which each change a neighbouring line. Checked once more on 2026-10-31 at 09:59 UTC against `main` `2db749ef2e`: of the 63 pull requests opened since 06:30 UTC, five change that file (#13790, #13798, #13824, #13832, #13854) and none of them conflicts with this entry. ### 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 AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-31 10:16:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T10:16:03Z.

Review: APPROVED


Reviewed — looks good

This documentation-only change accurately distinguishes the current sceKernelMunmap behavior from the cited alternatives and does not claim the unmeasured console behavior is settled.

What I ran

Reviewed head d7ce0daa231696bfa8ba305d47789025a0151dad against base 049619c202f00698b6d559817577726fbeb1ca4d; the merge preview was clean. Environment: Linux x86_64, Python 3.11.2. I ran:

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13866

Results

Check Result
Diff check and conventions/template Passed
Current-base merge preview Clean
Build/tests Not applicable; only a debt-documentation line changed
Hosted CI Still queued at final check
Unedited convention check output
All conventions checks passed.

Not verified

The precheck's test-quality heuristic could not run because tools/pr_test_quality.py is absent from its isolated PR checkout. No build or test was run, and hosted checks were queued. Neither limitation affects this documentation-only diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722312552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13866#pullrequestreview-5722312552). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T10:16:03Z. **Review:** APPROVED --- # Reviewed — looks good This documentation-only change accurately distinguishes the current `sceKernelMunmap` behavior from the cited alternatives and does not claim the unmeasured console behavior is settled. ## What I ran Reviewed head `d7ce0daa231696bfa8ba305d47789025a0151dad` against base `049619c202f00698b6d559817577726fbeb1ca4d`; the merge preview was clean. Environment: Linux x86_64, Python 3.11.2. I ran: ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13866 ``` ## Results | Check | Result | |---|---| | Diff check and conventions/template | Passed | | Current-base merge preview | Clean | | Build/tests | Not applicable; only a debt-documentation line changed | | Hosted CI | Still queued at final check | <details> <summary>Unedited convention check output</summary> ```text All conventions checks passed. ``` </details> ## Not verified The precheck's test-quality heuristic could not run because `tools/pr_test_quality.py` is absent from its isolated PR checkout. No build or test was run, and hosted checks were queued. Neither limitation affects this documentation-only diff.
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!13866
No description provided.