AnyPS5/core/libs/prx/libkernel
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
..
Aio/src fix(libkernel): preserve EINVAL in AIO completions 2026-10-10 08:42:19 +02:00
AppMetadata fix(kernel): skip the download0 mount when param.json cannot be read 2026-10-08 16:07:18 +02:00
Apr Merge pull request #2789 from tototomate123/fix/hfw-apr-split 2026-10-11 09:32:21 +02:00
DirectMemory fix(libkernel): keep stack protection inside the stack and never throw while restoring it 2026-10-11 02:28:03 -05:00
Equeue feat(libkernel): wake socket read and write events instead of polling 2026-10-11 01:54:15 +02:00
EventFlag/src feat(runtime): timed waits, sync primitive fixes, heap and RTC fixes, unattended-run switches 2026-09-26 19:00:39 -07:00
File fix(libkernel): translate scalar POSIX I/O errors 2026-10-11 10:50:48 +02:00
Module Merge pull request #3297 from SynnZer0/fix/libkernel-module-info-st-size 2026-10-11 10:45:21 +02:00
Pthread fix(libkernel): keep raises off unregistered threads and clamp the handler's MXCSR 2026-10-11 11:12:02 +02:00
Semaphore fix(libkernel): accept a zero count in sceKernelSignalSema 2026-10-10 16:12:43 +00:00
Socket fix(libkernel): saturate oversized select timeouts 2026-10-11 09:16:59 +02:00
SyncOnAddress/src feat(libkernel): implement sceKernelSyncOnAddressWait8 and sceKernelSyncOnAddressWait16 2026-10-06 04:30:12 +05:30
System/src fix(libkernel): keep raises off unregistered threads and clamp the handler's MXCSR 2026-10-11 11:12:02 +02:00
Time Merge pull request #2532 from hazzardouslysolid/fix/scaled-monotonic-origin 2026-10-11 10:41:55 +02:00
CMakeLists.txt feat(libkernel): deliver sceKernelRaiseException on Linux 2026-10-11 11:11:23 +02:00
KernelErrors.hpp refactor(kernel): share SCE kernel error codes through KernelErrors.hpp 2026-09-27 13:32:28 +07:00
Unimplemented.cpp feat(libkernel): implement thread cancellation 2026-10-10 11:32:09 +02:00