libkernel: pthread and sce cancellation state and type getters fault on unwritable pointers #13568

Closed
opened 2026-10-30 18:30:49 +00:00 by pushkarreddyy · 0 comments
pushkarreddyy commented 2026-10-30 18:30:49 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-30T18:30:49Z.


Environment

  • AnyPS5 commit: 0a90776f7f (main)
  • Title: PS5 system software / pthread cancellation callers

Describe the bug

scePthreadSetcancelstate, scePthreadSetcanceltype, pthread_setcancelstate_nid_postfix, and pthread_setcanceltype_nid_postfix write old_state and old_type directly to guest pointers without copy safety verification. If an unwritable non-null pointer (e.g. into read-only memory or unmapped space) is provided, the host crashes with SIGSEGV instead of returning SCE_KERNEL_ERROR_EFAULT (0x8002000e) or POSIX 14 (EFAULT).

Expected behavior

Unwritable old_state or old_type pointers should fail copy-out via GuestCopyOut_nid_no_patch, preserve the caller's cancellation state/type untouched, and return SCE_KERNEL_ERROR_EFAULT / 14 (EFAULT).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6124838823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/13568). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-30T18:30:49Z. --- ### Environment - AnyPS5 commit: 0a90776f7f (main) - Title: PS5 system software / pthread cancellation callers ### Describe the bug `scePthreadSetcancelstate`, `scePthreadSetcanceltype`, `pthread_setcancelstate_nid_postfix`, and `pthread_setcanceltype_nid_postfix` write `old_state` and `old_type` directly to guest pointers without copy safety verification. If an unwritable non-null pointer (e.g. into read-only memory or unmapped space) is provided, the host crashes with `SIGSEGV` instead of returning `SCE_KERNEL_ERROR_EFAULT` (`0x8002000e`) or POSIX `14` (`EFAULT`). ### Expected behavior Unwritable `old_state` or `old_type` pointers should fail copy-out via `GuestCopyOut_nid_no_patch`, preserve the caller's cancellation state/type untouched, and return `SCE_KERNEL_ERROR_EFAULT` / `14` (`EFAULT`).
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#13568
No description provided.