fix(libkernel): return EFAULT from truncate, utimes, mkdir, rmdir, and rename for a null path #7114

Merged
pushkarreddyy merged 2 commits from upstream-pr/7114 into main 2026-10-17 15:46:59 +00:00
pushkarreddyy commented 2026-10-17 12:10:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T12:10:00Z.


What

Following @oneandonlydean's review directive in #7114:
Folds #7110 (sceKernelTruncate, sceKernelUtimes), #7113 (sceKernelMkdir, sceKernelRmdir), and #7114 (sceKernelRename) together into this single PR, building cleanly on top of companion PR #7108 (sceKernelStat, sceKernelUnlink).

Like FreeBSD 11 (kern/vfs_syscalls.c), null path pointers reject early with EFAULT (0x8002000e) instead of throwing unhandled exceptions at runtime.

Closes #7110.
Closes #7113.

Tested

  • python tools/check_conventions.py --base origin/main passes with 0 findings.
  • core/libs/tests/GuestPosixScalarIo.cpp unit tests cover null path rejection for all 5 functions returning 0x8002000e.

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: #7108
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4899931847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7114). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T12:10:00Z. --- ### What Following @oneandonlydean's review directive in #7114: Folds #7110 (`sceKernelTruncate`, `sceKernelUtimes`), #7113 (`sceKernelMkdir`, `sceKernelRmdir`), and #7114 (`sceKernelRename`) together into this single PR, building cleanly on top of companion PR #7108 (`sceKernelStat`, `sceKernelUnlink`). Like FreeBSD 11 (`kern/vfs_syscalls.c`), null path pointers reject early with `EFAULT` (`0x8002000e`) instead of throwing unhandled exceptions at runtime. Closes #7110. Closes #7113. ### Tested - `python tools/check_conventions.py --base origin/main` passes with 0 findings. - `core/libs/tests/GuestPosixScalarIo.cpp` unit tests cover null path rejection for all 5 functions returning `0x8002000e`. ### 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: #7108 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
oneandonlydean commented 2026-10-17 12:17:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T12:17:28Z.


Thanks @pushkarreddyy, this looks right too: GUEST_EFAULT is already defined, and the throw becomes an error. But #7108, #7110, #7113 and this one all add lines at the same spots in GuestPosixScalarIo.cpp, so every pair of them conflicts. To keep it simple: #7108 merges first, then one PR that folds #7110, #7113 and #7114 together, rebased on main after #7108. You can close the other two once the combined one is up (or reuse one of them). We'll run CI once on that head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233783047 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7114#issuecomment-6233783047). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T12:17:28Z. --- Thanks @pushkarreddyy, this looks right too: `GUEST_EFAULT` is already defined, and the throw becomes an error. But #7108, #7110, #7113 and this one all add lines at the same spots in `GuestPosixScalarIo.cpp`, so every pair of them conflicts. To keep it simple: #7108 merges first, then one PR that folds #7110, #7113 and #7114 together, rebased on main after #7108. You can close the other two once the combined one is up (or reuse one of them). We'll run CI once on that head.
pushkarreddyy commented 2026-10-17 12:21:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T12:21:59Z.


Thanks @oneandonlydean! Acknowledged — I have this folded together with #7110 and #7113 on a clean branch rebased on latest main, and will close this once #7108 merges.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233822413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7114#issuecomment-6233822413). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T12:21:59Z. --- Thanks @oneandonlydean! Acknowledged — I have this folded together with #7110 and #7113 on a clean branch rebased on latest main, and will close this once #7108 merges.
github-actions[bot] commented 2026-10-17 12:42:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T12:42:46Z.


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
PR 6484 core/libs/prx/libkernel/File/src/Stdio.cpp L1273-1291

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6044 core/libs/tests/GuestPosixScalarIo.cpp
PR 6222 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6287 core/libs/prx/libkernel/File/src/Stdio.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234011927 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7114#issuecomment-6234011927). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-17T12:42:46Z. --- <!-- 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 | |---|---|---|---| | [PR 6484](https://www.github.com/boykopovar/AnyPS5/pull/6484) | `core/libs/prx/libkernel/File/src/Stdio.cpp` [L1273-1291](https://github.com/boykopovar/AnyPS5/blob/82f0c9aec9fc963a61d13c62084ce08f3cd093ab/core/libs/prx/libkernel/File/src/Stdio.cpp#L1273-L1291) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestPosixScalarIo.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 6287](https://www.github.com/boykopovar/AnyPS5/pull/6287) | `core/libs/prx/libkernel/File/src/Stdio.cpp` |
pushkarreddyy commented 2026-10-17 14:06:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T14:06:25Z.


Hi @oneandonlydean,

Done! Following your directive:

  • Combined and folded #7110, #7113, and #7114 together into this PR (#7114), rebased cleanly on top of companion PR #7108.
  • Covers sceKernelTruncate, sceKernelUtimes, sceKernelMkdir, sceKernelRmdir, and sceKernelRename with full unit test coverage in GuestPosixScalarIo.cpp.
  • Closed PR #7110 and PR #7113 to keep the queue clean and conflict-free.

Ready for single CI run whenever convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234860203 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7114#issuecomment-6234860203). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T14:06:25Z. --- Hi @oneandonlydean, Done! Following your directive: - Combined and folded #7110, #7113, and #7114 together into this PR (#7114), rebased cleanly on top of companion PR #7108. - Covers sceKernelTruncate, sceKernelUtimes, sceKernelMkdir, sceKernelRmdir, and sceKernelRename with full unit test coverage in GuestPosixScalarIo.cpp. - Closed PR #7110 and PR #7113 to keep the queue clean and conflict-free. Ready for single CI run whenever convenient!
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!7114
No description provided.