fix(libkernel_sys): answer every pathconf name as the console's UFS mount does #10196

Merged
orezraey merged 3 commits from upstream-pr/10196 into main 2026-10-26 15:58:03 +00:00
orezraey commented 2026-10-23 12:58:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-23T12:58:38Z.


What

pathconf measured on a retail PS5 (firmware 13.60) through libkernel_sys.sprx's own pathconf from a payload process, over every name from 0 to 70 on 22 paths. The sources and console logs are in this gist (ppathconf2, ppathconf3).

The answer depends on the mount. The console has at least five sets: /data and /user; /, /system, /hostapp, /preinst and /update; tmpfs (/system_tmp, /mnt/sandbox, /mnt/usb0); devfs (/dev/null); and UFS (/system_data).

AnyPS5 already answered with FreeBSD's UFS constants, and those match /system_data for every name it answered. It threw for the rest; they now return what /system_data returns:

  • _PC_ALLOC_SIZE_MIN, _PC_REC_INCR_XFER_SIZE, _PC_REC_MIN_XFER_SIZE and _PC_MIN_HOLE_SIZE: 65536;
  • _PC_REC_XFER_ALIGN: 16384;
  • _PC_ACL_PATH_MAX: 3;
  • _PC_ACL_EXTENDED, _PC_MAC_PRESENT and _PC_ACL_NFS4: 0;
  • _PC_MAX_CANON, _PC_MAX_INPUT, _PC_VDISABLE and _PC_ASYNC_IO: EINVAL.

The lookup errors already matched: EFAULT for a null path, ENOENT for an empty or missing one, ENOTDIR under a file, and ENAMETOOLONG for 1024 bytes or a component over 255.

Not followed: /app0, /savedata0, /temp0 and /download0 do not exist in a payload process, so what a title sees there is unknown. The debt entry lists how the other mounts differ.

Tested

  • Head after merging main (f26434afa3, with #10706): 88bf509e20. The test takes its declarations from the library headers and drops the unused PathconfThrows. guest_kernel_sys passes three runs in a row on Windows (MinGW) and on Linux (WSL Ubuntu, GCC); public_headers audit and check_conventions pass.
    Windows 11, MinGW (winlibs).
  • guest_kernel_sys checks every newly answered name for a file and a directory through pathconf, fpathconf and _fpathconf, and EINVAL for the four names above (_PC_ASYNC_IO stays 200112 for the descriptor forms). It throws on main and passes three runs in a row with the change.
  • tools/check_conventions.py passes.
  • #10060 landed first, so main is merged in and these values now live in its PathConfigurationValue. fpathconf and _fpathconf on a file or directory answer them too, since FreeBSD 11's kern_fpathconf asks the same VOP_PATHCONF; pipes and _PC_ASYNC_IO keep #10060's handling.

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: #11296 (fpathconf's return), #10427, #9442, #9713; #9442, #9713 edit the same lines too (merge order only); #10706 edits the same lines too (merge order only); lands before #11032, which changes PathConfigurationValue too (Gruzzberry agreed to refresh it)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4983096692 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10196). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-23T12:58:38Z. --- ### What `pathconf` measured on a retail PS5 (firmware 13.60) through `libkernel_sys.sprx`'s own `pathconf` from a payload process, over every name from 0 to 70 on 22 paths. The sources and console logs are in [this gist](https://gist.github.com/orezraey/908d1fe8647c30fdfdded255cc004e16) (`ppathconf2`, `ppathconf3`). **The answer depends on the mount.** The console has at least five sets: `/data` and `/user`; `/`, `/system`, `/hostapp`, `/preinst` and `/update`; tmpfs (`/system_tmp`, `/mnt/sandbox`, `/mnt/usb0`); devfs (`/dev/null`); and UFS (`/system_data`). AnyPS5 already answered with FreeBSD's UFS constants, and those match `/system_data` for every name it answered. It threw for the rest; they now return what `/system_data` returns: - `_PC_ALLOC_SIZE_MIN`, `_PC_REC_INCR_XFER_SIZE`, `_PC_REC_MIN_XFER_SIZE` and `_PC_MIN_HOLE_SIZE`: 65536; - `_PC_REC_XFER_ALIGN`: 16384; - `_PC_ACL_PATH_MAX`: 3; - `_PC_ACL_EXTENDED`, `_PC_MAC_PRESENT` and `_PC_ACL_NFS4`: 0; - `_PC_MAX_CANON`, `_PC_MAX_INPUT`, `_PC_VDISABLE` and `_PC_ASYNC_IO`: `EINVAL`. The lookup errors already matched: `EFAULT` for a null path, `ENOENT` for an empty or missing one, `ENOTDIR` under a file, and `ENAMETOOLONG` for 1024 bytes or a component over 255. **Not followed:** `/app0`, `/savedata0`, `/temp0` and `/download0` do not exist in a payload process, so what a title sees there is unknown. The debt entry lists how the other mounts differ. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Head after merging `main` (`f26434afa3`, with #10706): `88bf509e20`. The test takes its declarations from the library headers and drops the unused `PathconfThrows`. `guest_kernel_sys` passes three runs in a row on Windows (MinGW) and on Linux (WSL Ubuntu, GCC); `public_headers` audit and `check_conventions` pass. Windows 11, MinGW (winlibs). - `guest_kernel_sys` checks every newly answered name for a file and a directory through `pathconf`, `fpathconf` and `_fpathconf`, and `EINVAL` for the four names above (`_PC_ASYNC_IO` stays 200112 for the descriptor forms). It throws on `main` and passes three runs in a row with the change. - `tools/check_conventions.py` passes. - #10060 landed first, so main is merged in and these values now live in its `PathConfigurationValue`. `fpathconf` and `_fpathconf` on a file or directory answer them too, since FreeBSD 11's `kern_fpathconf` asks the same `VOP_PATHCONF`; pipes and `_PC_ASYNC_IO` keep #10060's handling. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #11296 (`fpathconf`'s return), #10427, #9442, #9713; #9442, #9713 edit the same lines too (merge order only); #10706 edits the same lines too (merge order only); lands before #11032, which changes `PathConfigurationValue` too (Gruzzberry agreed to refresh it) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 13:01:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T13:01:04Z.

Review: DISMISSED


Reviewed exact head 9fc8d159bdecb858e6a72741b0822fd7b58d1171. The measured /system_data values are narrowly applied to names that were previously unimplemented, while the existing lookup-error behavior remains covered; the added test cases exercise file and directory paths, and hosted eligibility/conventions/labels/report checks pass. One contribution-rule item remains unresolved: the PR itself says #10060 moves the same pathconf switch into PathConfigurationValue and that the second branch must carry the first branch’s values, but the checklist still says Depends on: none and the body records no agreement with #10060’s author. Please coordinate the landing order with that author and update the dependency line accordingly, preserving both sets of behavior whichever lands second. I am not asking either author to close work; this is only the required overlap sequencing.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5628564503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10196#pullrequestreview-5628564503). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T13:01:04Z. **Review:** DISMISSED --- Reviewed exact head `9fc8d159bdecb858e6a72741b0822fd7b58d1171`. The measured `/system_data` values are narrowly applied to names that were previously unimplemented, while the existing lookup-error behavior remains covered; the added test cases exercise file and directory paths, and hosted eligibility/conventions/labels/report checks pass. One contribution-rule item remains unresolved: the PR itself says #10060 moves the same `pathconf` switch into `PathConfigurationValue` and that the second branch must carry the first branch’s values, but the checklist still says `Depends on: none` and the body records no agreement with #10060’s author. Please coordinate the landing order with that author and update the dependency line accordingly, preserving both sets of behavior whichever lands second. I am not asking either author to close work; this is only the required overlap sequencing.
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!10196
No description provided.