fix(libkernel_sys): return EFAULT from uuidgen for an unwritable store #13187

Merged
DeveshB-1 merged 1 commit from upstream-pr/13187 into main 2026-11-01 21:58:38 +00:00
DeveshB-1 commented 2026-10-30 05:46:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DeveshB-1 on 2026-10-30T05:46:07Z.


What

uuidgen (core/libs/prx/libkernel_sys/Uuid.cpp) directly wrote to store[index] after only checking store == nullptr. Passing an unmapped, invalid, or unwritable pointer like (GuestUuid*)0x10 caused a host SIGSEGV segmentation fault.

  • Generates the requested UUIDs into a local buffer and writes them out via GuestCopyOut_nid_no_patch, returning EFAULT (14) on unmapped or unwritable addresses while preserving the state advance, matching FreeBSD 11 sys_uuidgen.
  • Adds regression test assertion for (GuestUuid*)0x10 in core/libs/tests/GuestKernelSysUuid.cpp.
  • Updates docs/dev/debt/libkernel_sys.md accordingly.

Tested

Arch Linux x86_64, GCC 15.2.1, Release, based on main 42d992b02a:

  • ctest --test-dir build -R '^guest_kernel_sys_uuid$' --repeat until-fail:3 -V: passed (3 of 3 runs).
  • Negative control: on main baseline with the new 0x10 test row, guest_kernel_sys_uuid deterministically crashed with SIGSEGV (***Exception: SegFault). With this PR, it passes cleanly.
  • python3 tools/check_conventions.py --base upstream/main: passed cleanly.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5080071428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13187). Originally posted by [DeveshB-1](https://github.com/DeveshB-1) on 2026-10-30T05:46:07Z. --- ### What `uuidgen` (`core/libs/prx/libkernel_sys/Uuid.cpp`) directly wrote to `store[index]` after only checking `store == nullptr`. Passing an unmapped, invalid, or unwritable pointer like `(GuestUuid*)0x10` caused a host `SIGSEGV` segmentation fault. - Generates the requested UUIDs into a local buffer and writes them out via `GuestCopyOut_nid_no_patch`, returning `EFAULT` (`14`) on unmapped or unwritable addresses while preserving the state advance, matching FreeBSD 11 `sys_uuidgen`. - Adds regression test assertion for `(GuestUuid*)0x10` in `core/libs/tests/GuestKernelSysUuid.cpp`. - Updates `docs/dev/debt/libkernel_sys.md` accordingly. ### 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. --> Arch Linux x86_64, GCC 15.2.1, Release, based on `main` `42d992b02a`: - `ctest --test-dir build -R '^guest_kernel_sys_uuid$' --repeat until-fail:3 -V`: passed (3 of 3 runs). - Negative control: on `main` baseline with the new `0x10` test row, `guest_kernel_sys_uuid` deterministically crashed with `SIGSEGV` (`***Exception: SegFault`). With this PR, it passes cleanly. - `python3 tools/check_conventions.py --base upstream/main`: passed cleanly. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!13187
No description provided.