fix(libkernel): return EFAULT from sysctlnametomib for invalid memory pointers #13854

Merged
DeveshB-1 merged 1 commit from upstream-pr/13854 into main 2026-11-01 05:05:23 +00:00
DeveshB-1 commented 2026-10-31 09:33:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DeveshB-1 on 2026-10-31T09:33:26Z.


What

Safely copies name via CopyGuestPath_nid_no_patch, safely copies size in and out via GuestCopyIn_nid_no_patch and GuestCopyOut_nid_no_patch, and propagates copy-out errors in copyMib, returning -1 with EFAULT (14) if any pointer is unreadable or unwritable instead of faulting host memory. Updates the libkernel.md debt entry and adds guest pointer fault tests in GuestSystemConfiguration.cpp.

Tested

Linux (Arch Linux x86_64), ctest --test-dir build -R guest_system_configuration -V. Verified negative control crashes with SIGSEGV on unmodified code and passes deterministically with this change. Verified python3 tools/check_conventions.py --base origin/main and python3 tools/pr_overlap.py --branch fix/sysctlnametomib-efault (no overlap across 1,618 open PRs).

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:5096352437 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13854). Originally posted by [DeveshB-1](https://github.com/DeveshB-1) on 2026-10-31T09:33:26Z. --- ### What Safely copies `name` via `CopyGuestPath_nid_no_patch`, safely copies `size` in and out via `GuestCopyIn_nid_no_patch` and `GuestCopyOut_nid_no_patch`, and propagates copy-out errors in `copyMib`, returning -1 with `EFAULT` (14) if any pointer is unreadable or unwritable instead of faulting host memory. Updates the `libkernel.md` debt entry and adds guest pointer fault tests in `GuestSystemConfiguration.cpp`. ### Tested Linux (Arch Linux x86_64), `ctest --test-dir build -R guest_system_configuration -V`. Verified negative control crashes with `SIGSEGV` on unmodified code and passes deterministically with this change. Verified `python3 tools/check_conventions.py --base origin/main` and `python3 tools/pr_overlap.py --branch fix/sysctlnametomib-efault` (no overlap across 1,618 open PRs). ### 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
MarcZX10 commented 2026-10-31 09:36:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T09:36:09Z.

Review: APPROVED


Reviewed — looks good

The exact-head change routes guest name, size and MIB accesses through the guest-memory helpers, and its focused fault cases cover unreadable and unwritable pointers.

What I ran

Reviewed head dd46d6ada363d683bbf6dae6d79cf81dc4a7f930 against base c3c45d73abd34dca81da6bad87cb6d36ea437a66; the current-main merge preview was clean. Environment: Linux x86-64, Python 3.11.2. The no-build precheck's diff and conventions checks passed.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13854
python3 tools/pr_stack_check.py 13854 --repo boykopovar/AnyPS5

The precheck's ABI-audit and test-quality helper commands were unavailable in its isolated checkout. The PR reports ctest --test-dir build -R guest_system_configuration -V and a negative control; I did not run those locally. Hosted checks were still queued or running at review time.

Sources

Reviewed the pinned implementation and pointer fault tests.

Not verified

I did not build locally, run the CTest suite, independently reproduce the negative control, or verify console behavior. Hosted CI was not complete.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722196451 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13854#pullrequestreview-5722196451). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T09:36:09Z. **Review:** APPROVED --- # Reviewed — looks good The exact-head change routes guest name, size and MIB accesses through the guest-memory helpers, and its focused fault cases cover unreadable and unwritable pointers. ## What I ran Reviewed head `dd46d6ada363d683bbf6dae6d79cf81dc4a7f930` against base `c3c45d73abd34dca81da6bad87cb6d36ea437a66`; the current-main merge preview was clean. Environment: Linux x86-64, Python 3.11.2. The no-build precheck's diff and conventions checks passed. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13854 python3 tools/pr_stack_check.py 13854 --repo boykopovar/AnyPS5 ``` The precheck's ABI-audit and test-quality helper commands were unavailable in its isolated checkout. The PR reports `ctest --test-dir build -R guest_system_configuration -V` and a negative control; I did not run those locally. Hosted checks were still queued or running at review time. ## Sources Reviewed the pinned [implementation](https://github.com/boykopovar/AnyPS5/blob/dd46d6ada363d683bbf6dae6d79cf81dc4a7f930/core/libs/prx/libkernel/System/src/SystemConfiguration.cpp#L800-L860) and [pointer fault tests](https://github.com/boykopovar/AnyPS5/blob/dd46d6ada363d683bbf6dae6d79cf81dc4a7f930/core/libs/tests/GuestSystemConfiguration.cpp#L1125-L1138). ## Not verified I did not build locally, run the CTest suite, independently reproduce the negative control, or verify console behavior. Hosted CI was not complete.
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!13854
No description provided.