fix(libSceAppContent): safely probe guest initialization and query pointers #18947

Closed
opened 2026-11-12 15:18:54 +00:00 by pushkarreddyy · 0 comments
pushkarreddyy commented 2026-11-12 15:18:54 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-11-12T15:18:54Z.


Description

In core/libs/prx/libSceAppContent/Export.cpp, several exports directly dereference guest-supplied input and output pointers without verifying their accessibility via GuestCopyIn_nid_no_patch / GuestCopyOut_nid_no_patch:

  1. sceAppContentInitialize:
    • Inspects initParam->reserved and bootParam->reserved1/2 via std::all_of and executes std::memset(bootParam, 0, sizeof(*bootParam)).
    • Inaccessible or unwritable guest pointers crash the host process with SIGSEGV rather than safely returning SCE_APP_CONTENT_ERROR_PARAMETER.
  2. sceAppContentGetPftFlag:
    • Writes *pftFlag = 0; without probing guest memory.
  3. sceAppContentGetAddcontInfoListByIroTag:
    • Writes *hitNum = 0; without probing guest memory.
  4. sceAppContentTemporaryDataGetAvailableSpaceKb:
    • Reads mountPoint->data directly and writes *availableSpaceKb = ... without probing.

Following the host safety precedent established in #18598 (sceAppContentTemporaryDataMount2), these entry points should safely probe guest pointers preserving caller errno across copy faults and return SCE_APP_CONTENT_ERROR_PARAMETER on invalid memory, backed by unit tests in core/libs/tests/GuestAppContent.cpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6352921117 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/18947). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-12T15:18:54Z. --- ### Description In `core/libs/prx/libSceAppContent/Export.cpp`, several exports directly dereference guest-supplied input and output pointers without verifying their accessibility via `GuestCopyIn_nid_no_patch` / `GuestCopyOut_nid_no_patch`: 1. `sceAppContentInitialize`: - Inspects `initParam->reserved` and `bootParam->reserved1/2` via `std::all_of` and executes `std::memset(bootParam, 0, sizeof(*bootParam))`. - Inaccessible or unwritable guest pointers crash the host process with SIGSEGV rather than safely returning `SCE_APP_CONTENT_ERROR_PARAMETER`. 2. `sceAppContentGetPftFlag`: - Writes `*pftFlag = 0;` without probing guest memory. 3. `sceAppContentGetAddcontInfoListByIroTag`: - Writes `*hitNum = 0;` without probing guest memory. 4. `sceAppContentTemporaryDataGetAvailableSpaceKb`: - Reads `mountPoint->data` directly and writes `*availableSpaceKb = ...` without probing. Following the host safety precedent established in #18598 (`sceAppContentTemporaryDataMount2`), these entry points should safely probe guest pointers preserving caller `errno` across copy faults and return `SCE_APP_CONTENT_ERROR_PARAMETER` on invalid memory, backed by unit tests in `core/libs/tests/GuestAppContent.cpp`.
Sign in to join this conversation.
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#18947
No description provided.