fix(libkernel): reject empty filesystem paths #3465

Merged
MarcZX10 merged 1 commit from upstream-pr/3465 into main 2026-10-11 11:50:57 +00:00
MarcZX10 commented 2026-10-11 11:00:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T11:00:52Z.


What

Reject empty pathnames in the remaining kernel filesystem calls that otherwise resolve an empty string to the guest working directory. sceKernelStat, sceKernelUnlink, sceKernelCheckReachability, sceKernelRename, sceKernelRmdir, sceKernelChmod, sceKernelTruncate and sceKernelUtimes now return ENOENT. Add regression coverage for each operation. This follows the separate sceKernelOpen fix in #3428 and addresses the follow-up noted in #3308.

Tested

  • Linux Release: built guest_filesystem_tests.
  • ctest --test-dir build-followup --output-on-failure --repeat until-fail:3 -R '^guest_filesystem$' --no-tests=error passed three runs.
  • Negative control: the test fails at the new sceKernelStat("") assertion against current main without this patch.
  • python3 tools/check_conventions.py --base upstream/main passed; git diff --check passed.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818566182 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3465). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T11:00:52Z. --- ### What Reject empty pathnames in the remaining kernel filesystem calls that otherwise resolve an empty string to the guest working directory. `sceKernelStat`, `sceKernelUnlink`, `sceKernelCheckReachability`, `sceKernelRename`, `sceKernelRmdir`, `sceKernelChmod`, `sceKernelTruncate` and `sceKernelUtimes` now return `ENOENT`. Add regression coverage for each operation. This follows the separate `sceKernelOpen` fix in #3428 and addresses the follow-up noted in #3308. ### Tested - Linux Release: built `guest_filesystem_tests`. - `ctest --test-dir build-followup --output-on-failure --repeat until-fail:3 -R '^guest_filesystem$' --no-tests=error` passed three runs. - Negative control: the test fails at the new `sceKernelStat("")` assertion against current `main` without this patch. - `python3 tools/check_conventions.py --base upstream/main` passed; `git diff --check` passed. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 11:44:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T11:44:12Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3485 core/libs/prx/libkernel/File/src/Open.cpp L251-252
core/libs/prx/libkernel/File/src/Stdio.cpp L698-699, L1001-1002, L1014-1015, L1038-1039
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108666585 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3465#issuecomment-6108666585). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T11:44:12Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3485 | `core/libs/prx/libkernel/File/src/Open.cpp` [L251-252](https://github.com/boykopovar/AnyPS5/blob/b33b1b8e666b7c1523ec30c41deac262ef987dd2/core/libs/prx/libkernel/File/src/Open.cpp#L251-L252)<br>`core/libs/prx/libkernel/File/src/Stdio.cpp` [L698-699](https://github.com/boykopovar/AnyPS5/blob/b33b1b8e666b7c1523ec30c41deac262ef987dd2/core/libs/prx/libkernel/File/src/Stdio.cpp#L698-L699), [L1001-1002](https://github.com/boykopovar/AnyPS5/blob/b33b1b8e666b7c1523ec30c41deac262ef987dd2/core/libs/prx/libkernel/File/src/Stdio.cpp#L1001-L1002), [L1014-1015](https://github.com/boykopovar/AnyPS5/blob/b33b1b8e666b7c1523ec30c41deac262ef987dd2/core/libs/prx/libkernel/File/src/Stdio.cpp#L1014-L1015), [L1038-1039](https://github.com/boykopovar/AnyPS5/blob/b33b1b8e666b7c1523ec30c41deac262ef987dd2/core/libs/prx/libkernel/File/src/Stdio.cpp#L1038-L1039) | | |
adriadam10 commented 2026-10-11 11:50:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:50:54Z.


Checked on Linux: guest_filesystem passes with the change and fails with the non-test changes reverted. The empty-path checks match FreeBSD namei (sys/kern/vfs_lookup.c, empty pathnames are refused with ENOENT), and the test covers every call touched. No overlap with other open PRs; merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108719453 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3465#issuecomment-6108719453). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:50:54Z. --- Checked on Linux: `guest_filesystem` passes with the change and fails with the non-test changes reverted. The empty-path checks match FreeBSD `namei` (`sys/kern/vfs_lookup.c`, empty pathnames are refused with ENOENT), and the test covers every call touched. No overlap with other open PRs; merging once CI is green.
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!3465
No description provided.