docs(debt): note how a title calls sceKernelFtruncate #10121

Merged
xXPBSXx merged 3 commits from upstream-pr/10121 into main 2026-10-26 14:21:23 +00:00
xXPBSXx commented 2026-10-23 09:58:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-23T09:58:06Z.


What

The changed entry now reads:

ftruncate, truncate, sceKernelFtruncate (libkernel) extend a file on Windows with SetFileInformationByHandle (FileEndOfFileInfo), which reserves the clusters but writes no zero bytes, and report EFBIG for a length the volume cannot hold (ERROR_INVALID_PARAMETER on a disk file; seen with a length of INT64_MAX, the size from which NTFS refuses it was not measured) and ENOSPC when the free space is smaller. FreeBSD 11.4 makes the extension a hole on a file system that has them (ffs_truncate writes only the last block), so a length above the free space succeeds there. A write behind the end of the file still makes NTFS write zero bytes over the gap, as the file is not sparse. None of this was measured on a console. One title (PPSA04354) disassembled for this entry calls sceKernelFtruncate once (0xe9d4f2) with a 32-bit descriptor from an object field and a 64-bit length read from memory, and tests only the sign of the result: a negative one makes its function return 0 and store 14 in the object, whatever the error. Which lengths it passes was not examined.

Changed: docs/dev/debt/libkernel.md. No code change.

Method: Ghidra 12.1.4 headless on the unwrapped executable of the title named; the addresses are the call sites in that executable as Ghidra maps it, read from the instruction listing (static reading only, nothing run on a console). The listing and decompiled code are game code and are not attached.

Fixes: #10120

Tested

Documentation only. tools/check_conventions.py --base upstream/main passes; git merge-tree against main is clean. Every number in the sentence was recounted against the instruction listing. Not built, not run, no title run.

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 #10120
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4981022364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10121). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-23T09:58:06Z. --- ### What The changed entry now reads: > [ftruncate, truncate, sceKernelFtruncate](../../../core/libs/prx/libkernel/File/src/Stdio.cpp) (libkernel) extend a file on Windows with `SetFileInformationByHandle` (`FileEndOfFileInfo`), which reserves the clusters but writes no zero bytes, and report `EFBIG` for a length the volume cannot hold (`ERROR_INVALID_PARAMETER` on a disk file; seen with a length of `INT64_MAX`, the size from which NTFS refuses it was not measured) and `ENOSPC` when the free space is smaller. FreeBSD 11.4 makes the extension a hole on a file system that has them ([`ffs_truncate`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/ufs/ffs/ffs_inode.c) writes only the last block), so a length above the free space succeeds there. A write behind the end of the file still makes NTFS write zero bytes over the gap, as the file is not sparse. None of this was measured on a console. One title (PPSA04354) disassembled for this entry calls `sceKernelFtruncate` once (0xe9d4f2) with a 32-bit descriptor from an object field and a 64-bit length read from memory, and tests only the sign of the result: a negative one makes its function return 0 and store 14 in the object, whatever the error. Which lengths it passes was not examined. Changed: `docs/dev/debt/libkernel.md`. No code change. Method: Ghidra 12.1.4 headless on the unwrapped executable of the title named; the addresses are the call sites in that executable as Ghidra maps it, read from the instruction listing (static reading only, nothing run on a console). The listing and decompiled code are game code and are not attached. Fixes: #10120 ### Tested Documentation only. `tools/check_conventions.py --base upstream/main` passes; `git merge-tree` against `main` is clean. Every number in the sentence was recounted against the instruction listing. Not built, not run, no title run. ### 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 #10120 - [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-23 10:19:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T10:19:07Z.

Review: COMMENTED


I reviewed exact head b495f88512 and the linked issue #10120. The added PPSA04354 call-site observation is scoped carefully: one call, the argument sources, sign-only result handling, and the unexamined length range are all stated without treating it as console behavior. The overlap bot lists many edits to docs/dev/debt/libkernel.md, but the exact delta adds only this call-site detail to the ftruncate entry; I found no duplicate open PR for that observation. Local exact-head git diff --check upstream/main...HEAD and python3 tools/check_conventions.py --base upstream/main pass. Hosted eligibility, conventions, intake and labels checks pass; code build/tests are not applicable to this documentation-only change. No blocking issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5626910627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10121#pullrequestreview-5626910627). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T10:19:07Z. **Review:** COMMENTED --- I reviewed exact head b495f885127789557cd6c1b4e485501894d12821 and the linked issue #10120. The added PPSA04354 call-site observation is scoped carefully: one call, the argument sources, sign-only result handling, and the unexamined length range are all stated without treating it as console behavior. The overlap bot lists many edits to `docs/dev/debt/libkernel.md`, but the exact delta adds only this call-site detail to the ftruncate entry; I found no duplicate open PR for that observation. Local exact-head `git diff --check upstream/main...HEAD` and `python3 tools/check_conventions.py --base upstream/main` pass. Hosted eligibility, conventions, intake and labels checks pass; code build/tests are not applicable to this documentation-only change. No blocking issue found.
MarcZX10 commented 2026-10-23 12:51:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T12:51:35Z.

Review: APPROVED


Re-reviewed exact head e9b842569aaf59e5b1282b2637b10e94d589109b and linked issue #10120. The shortened debt note still records the observed single call site and sign-only result handling, while leaving the unexamined lengths explicit; the PR body identifies the source as static Ghidra disassembly. The exact-head eligibility, conventions and labels checks pass. This is documentation-only, so no runtime test applies. The overlapping debt-file edits are distinct and the PR remains mergeable.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5628457272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10121#pullrequestreview-5628457272). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T12:51:35Z. **Review:** APPROVED --- Re-reviewed exact head `e9b842569aaf59e5b1282b2637b10e94d589109b` and linked issue #10120. The shortened debt note still records the observed single call site and sign-only result handling, while leaving the unexamined lengths explicit; the PR body identifies the source as static Ghidra disassembly. The exact-head eligibility, conventions and labels checks pass. This is documentation-only, so no runtime test applies. The overlapping debt-file edits are distinct and the PR remains mergeable.
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!10121
No description provided.