Skip to content

fix(libSceShare): return ERROR_INVALID_PARAM from status queries for unwritable pointers - #14973

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
fogydes:fix/libSceShare-pointer-validation
Nov 3, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
fogydes:fix/libSceShare-pointer-validation

Conversation

@fogydes

@fogydes fogydes commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What

In core/libs/prx/libSceShare/Export.cpp, sceShareGetCurrentStatus and sceShareGetRunningStatus wrote directly to caller-supplied guest pointers (status) using raw std::memset and *status = 0. When passed invalid or unmapped memory pointers (e.g. (ShareCurrentStatus*)0x10 or (uint32_t*)0x10), this caused an unhandled host access violation (0xc0000005).

This PR:

  1. Validates and writes status records in sceShareGetCurrentStatus and sceShareGetRunningStatus using GuestCopyOut_nid_no_patch preserving errno, returning ERROR_INVALID_PARAM (0x81960002) if copy-out fails.
  2. Updates core/libs/tests/GuestShare.cpp with negative assertions verifying that passing unwritable pointers returns ERROR_INVALID_PARAM.
  3. Documents in docs/dev/debt/libSceShare.md that returning ERROR_INVALID_PARAM for unwritable pointers in sceShareGetCurrentStatus and sceShareGetRunningStatus is a defensive host-protection fallback and console behaviour is unmeasured.

Tested

  • Windows 11 (x86_64, MinGW-w64 GCC 15.2.0).
  • Confirmed reproduction of unhandled host access violation 0xc0000005 (write of 0x10 on thread 12856) in test feat(libs): add underscore Ult, internal Fiber and POSIX rwlockattr exports #2565 guest_share on origin/main before applying the fix.
  • Verified test suite passes 100%: guest_share passed in 0.01s and neighbor guest_share_play passed in 0.04s.
  • Verified conventions check: python tools/check_conventions.py --base origin/main (0 findings).
  • Verified PR overlap: python tools/pr_overlap.py --branch fix/libSceShare-pointer-validation (0 overlaps found across 1,909 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

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

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 14212 docs/dev/debt/libSceShare.md

@oneandonlydean oneandonlydean self-assigned this Nov 3, 2026
@oneandonlydean
oneandonlydean merged commit e9fa4a9 into boykopovar:main Nov 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants