AnyPS5/core/libs/prx/libkernel/System/src
Claude c356112f32 fix(libkernel): keep raises off unregistered threads and clamp the handler's MXCSR
Two defects found in review of the Linux delivery:

A raise right after scePthreadCreate reached the new thread before
RunThread set currentThread, so scePthreadSelf() in the handler adopted
a second handle, and could deadlock on glibc's thread lock when the
signal interrupted pthread_getattr_np. The creator now blocks all
signals around the std::thread construction, so the child starts with
them blocked, and RunThread restores the creator's mask once the thread
is registered, as libthr does. A raise in that window stays pending and
is delivered just before the entry runs.

A handler that set reserved MXCSR bits made rt_sigreturn fail with
SIGSEGV. The MXCSR the handler leaves is now masked with the frame's
MXCSR_MASK (0xffbf when it reads 0), as FreeBSD's fpusetregs does, on
both platforms; Windows also keeps CONTEXT.MxCsr equal to
FltSave.MxCsr.

guest_raise_exception raises right after each of 50 thread creations and
checks scePthreadSelf() in the handler, and its context round trip sets
a reserved MXCSR bit and FZ and checks that only FZ is kept.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LwJx7AHrSUaMGSpEGhL1Kb
2026-10-11 11:12:02 +02:00
..
Coredump.cpp refactor(libkernel): name the Jrs7UUkGOFo Coredump stub by its NID 2026-10-08 17:24:26 +09:00
Exception.cpp fix(libkernel): keep raises off unregistered threads and clamp the handler's MXCSR 2026-10-11 11:12:02 +02:00
Notification.cpp feat(libs): implement homebrew libc and kernel runtime exports 2026-10-05 22:40:16 -03:00
Process.cpp feat(libkernel): implement getppid 2026-10-11 04:30:52 -04:00
Rtld.cpp build(windows): guard NOMINMAX in Rtld.cpp 2026-10-07 15:00:08 +02:00
Sandbox.cpp feat(libkernel): implement sceKernelGetFsSandboxRandomWord 2026-10-08 21:39:11 +02:00
Sanitizer.cpp feat(libkernel): implement disabled address sanitizer state + replacement tables 2026-09-27 11:43:36 +03:00
SignalSets.cpp feat(libkernel): implement siglongjmp 2026-10-11 03:25:07 +09:00
Signals.cpp fix(libkernel): name pthread_kill's errors and test the signal range edge 2026-10-10 21:11:29 -04:00
SoftwareVersion.cpp feat(libkernel): implement sceKernelGetAllowedSdkVersionOnSystem 2026-10-11 03:48:47 -04:00
SystemConfiguration.cpp feat(libkernel): support kern.rng_pseudo in sysctlbyname 2026-10-11 09:51:22 +02:00