Commit Graph
418 Commits
Author SHA1 Message Date
Adrià 60bb466419 Merge pull request #10505 from maximilianfv/fix/libkernel-macos-itimer-terminate
fix(libkernel): reach the guest terminate handler from an ITIMER_REAL expiry on macOS
2026-10-27 04:51:54 +01:00
Dean 169f3e3e73 Merge pull request #10666 from WallisSkill/fix/libkernel-raise-at-guest-return
fix(libkernel): deliver a raised exception at the guest return of a thread in host code
2026-10-27 14:59:25 +13:00
Dean 8600cbc763 Merge pull request #11108 from orezraey/fix/libkernel-nice-stays-zero-measured-ps5
fix(libkernel): keep the nice value at 0 after setpriority as measured on a PS5
2026-10-27 11:00:52 +13:00
Dean 2da4d74cac Merge pull request #11025 from orezraey/fix/libkernel-sw-version-block-measured-ps5
fix(libkernel): accept any block size and a null block in the system software version getters as measured on a PS5
2026-10-27 10:59:21 +13:00
Dean 3c4aab5acc Merge pull request #10830 from babyhuey/feat/libkernel-kern-proc-pid
feat(libkernel): answer kern.proc.pid for the calling process
2026-10-27 10:54:49 +13:00
Dean 1ede81d911 Merge pull request #11078 from slopgobblercobbler/feat/libkernel-sysconf-limits
feat(libkernel): implement additional sysconf limits
2026-10-27 10:37:14 +13:00
Dean dd87687627 Merge pull request #10671 from pushkarreddyy/feat/libkernel-sys-kernel-queries
feat(libkernel): implement sysKernel update version and mode queries
2026-10-27 10:31:00 +13:00
Dean 927f3b9346 Merge pull request #11167 from Ragbie/fix/windows-sigtimedwait-precision
fix(libkernel): wait for sigtimedwait timeouts with the precise timed wait on Windows
2026-10-27 05:44:58 +13:00
Adrià 5bdda3661e Merge pull request #10132 from orezraey/fix/libkernel-sysctl-system-measured-ps5
fix(libkernel): report the sysctl system strings and integers a PS5 reports
2026-10-26 16:48:57 +01:00
review 044e52a2f0 Merge commit 'refs/review/9669/head' into HEAD 2026-10-26 14:10:41 +01:00
WallisSkillandClaude Opus 5.5 8aafe2440d fix(libkernel): take a return breakpoint hit that a disarm cleared under it
A raise delivered some other way (the deliverer sampled the target in guest
code and redirected it) disarms the return breakpoint by clearing DR0 and
DR7 with SetThreadContext. When the target reaches the armed return address
at the same moment, the debug exception is already raised but the context
Windows hands to the handler carries the cleared registers: DR0, DR6 and DR7
are 0. ReturnBreakHandler required DR6.B0, so it declined, and the unhandled
EXCEPTION_SINGLE_STEP ended the process with 0x80000004. Under parallel load
guest_raise_in_host_code failed this way 18 times in 900 runs; a diagnostic
in the declining branch showed every failure at an address armed earlier on
that same thread, with no live return break, DR0 = DR6 = DR7 = 0 and TF
clear.

The ring of armed addresses now records the thread with each address. A
single-step that has TF clear, no breakpoint hit in DR6 and no breakpoint
enabled in DR7, at an address this library armed on the faulting thread, is
taken as that disarmed return breakpoint and continues; any other
single-step is left to the next handler. A DR0 hit is likewise matched
against the addresses armed on the faulting thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 19:43:00 +07:00
orezraeyandClaude Opus 5.5 db07b6737d Merge main into fix/libkernel-sysctl-system-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 09:20:00 -03:00
WallisSkillandClaude Opus 5.5 540364a24f fix(libkernel): queue a raise's APC only for a thread in a libkernel wait
A target in host code got the delivery as an APC as well as through the
return breakpoint and the sampling. An APC runs in any alertable wait,
so host code that waits alertably while holding a lock would have run
the guest handler inside that wait with the lock held. The APC is now
queued only while the target is in a libkernel wait (Pthread waitCount),
the point where the handler already ran before; a target elsewhere in
host code takes the delivery when it returns into guest code.

guest_raise_leaves_host_code adds a target in an alertable
WaitForSingleObjectEx: each raise must return in under 500 ms and the
handler must run in the executable after the wait was released. The
earlier behaviour (an APC for every host-code target) fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 19:06:33 +07:00
WallisSkillandClaude Opus 5.5 1b9c5feb30 fix(libkernel): deliver a raised exception at the guest return of a thread in host code
RaiseOn suspended the target and, while it sat in host code, resampled
it until a 50 ms limit and then redirected it into the handler there.
A handler that waits, as Unity's GC thread-stop handler does, then held
whatever host lock the thread had: in Graveyard Keeper 2 a job worker
stopped inside shader specialization kept the shader registration lock,
another worker blocked on that lock never ran its own stop, and the
load froze with 39 of 40 threads acknowledged (about 1 in 15 loads).

A target in host code is never redirected now. The raise queues the
delivery as an APC (taken when the thread waits alertably), arms a
debug register 0 execute breakpoint at the frame's return address into
guest code (found with the image's own .pdata and RtlVirtualUnwind,
stopping at frames that push a machine frame, guarded against faults),
and hands the target to a host deliverer thread that keeps sampling it.
The first of the three to reach the thread delivers, through one taken
flag per delivery. A target in guest code is still redirected at once;
a target inside NtContinue still makes the raise throw after 1 s.

guest_raise_leaves_host_code checks that a handler never runs in host
code, for a target blocked in WaitForSingleObject and one busy in
MultiByteToWideChar, and that each raise of the blocked one returns in
under 500 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 19:06:32 +07:00
Dean 7704178631 Merge pull request #11182 from orezraey/fix/libkernel-soc-sensor-order-measured-ps5
fix(libkernel): check the SoC sensor channel before the pointer and set errno as measured on a PS5
2026-10-27 01:02:19 +13:00
Dean 0a1496c148 Merge pull request #11170 from orezraey/fix/libkernel-sysctl-toplevel-measured-ps5
fix(libkernel): resolve sysctl top-level names and fail absent top-level MIBs with ENOENT as measured on a PS5
2026-10-27 01:01:03 +13:00
orezraeyandClaude Opus 5.5 65172ff414 Merge main into fix/libkernel-sw-version-block-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 08:56:51 -03:00
fogydes 719701a68e fix(libkernel): follow the measured exec lookup and image checks 2026-10-26 16:19:46 +05:30
fogydes 23dc69a2e3 fix(libkernel): return EBADF for an exec null path as measured on the console 2026-10-26 15:06:01 +05:30
GruzzberryandClaude Opus 5.5 d49b9b6f25 feat(libkernel_sys): implement setlogin
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 09:26:45 +00:00
fogydes cc46172855 fix(libkernel): keep the host runtime variables in the exec replacement environment 2026-10-26 14:51:38 +05:30
fogydes d53bb5a1fa fix(libkernel): align the exec arguments with FreeBSD 11.4 2026-10-26 14:51:38 +05:30
fogydes f53346a288 feat(libkernel): implement execv, execvp and execve process replacement 2026-10-26 14:51:38 +05:30
Dean 690c9c29c2 Merge pull request #10921 from MarcZX10/marc/fix-sysctl-copyout-null-source
fix(libkernel): skip the sysctl copy-out when no bytes are copied
2026-10-26 22:05:30 +13:00
Dean a0c85ea99b Merge pull request #10501 from harisibrar1/fix/pselect-pending-signal-eintr
fix(libkernel): return EINTR from pselect when its mask unblocks a pending signal
2026-10-26 18:26:20 +13:00
Dean 0ce4b82c2d Merge pull request #10243 from orezraey/fix/libkernel-rtld-thread-atexit-measured-ps5
fix(libkernel): answer the thread atexit references as measured on a PS5
2026-10-26 16:23:13 +13:00
harisibrar1 7784604b0b Merge remote-tracking branch 'origin/main' into fix/pselect-pending-signal-eintr
# Conflicts:
#	core/libs/prx/libkernel/System/src/Signals.cpp
2026-10-25 19:35:03 -04:00
Evrim Cicek d94c409f1f fix(libkernel): wait for sigtimedwait timeouts with the precise timed wait on Windows 2026-10-26 01:47:03 +03:00
slopgobblercobbler eb54ed35d4 feat(libkernel): implement additional sysconf limits
Implement POSIX / FreeBSD 11.4 limits in sysconf: _SC_CHILD_MAX (2) via getrlimit RLIMIT_NPROC, _SC_NGROUPS_MAX (4) returning 1023 (KERN_NGROUPS), _SC_STREAM_MAX (26) via getrlimit RLIMIT_NOFILE bounded by SHRT_MAX, _SC_HOST_NAME_MAX (72) returning 255 (MAXHOSTNAMELEN - 1), and _SC_LOGIN_NAME_MAX (73) returning 33.
2026-10-25 22:58:38 +01:00
orezraeyandClaude Opus 5.5 625dbb4cd9 fix(libkernel): throw for SoC sensor channels 3 to 64 instead of reporting them invalid
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:45:23 -03:00
Adrià 26ba9b6b71 Merge pull request #9499 from EagleBearerYS/fix/libkernel-signal-handler-mask
fix(libkernel): block a signal while its handler runs and honour SA_RESETHAND
2026-10-25 22:05:12 +01:00
orezraeyandClaude Opus 5.5 32e1371697 fix(libkernel): check the SoC sensor channel before the pointer and set errno as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:42:22 -03:00
orezraeyandClaude Opus 5.5 65d87b4ecb fix(libkernel): resolve sysctl top-level names and fail absent top-level MIBs with ENOENT as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:22:26 -03:00
Adrià aeff26bd97 Merge pull request #9573 from zaryabzip/feat/pthread-create-suspended
feat(libkernel_sys): create threads suspended and resume them
2026-10-25 20:21:07 +01:00
orezraeyandClaude Opus 5.5 fc938dcedb fix(libkernel): throw on PRIO_PGRP and PRIO_USER setpriority until measured
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:27:28 -03:00
orezraeyandClaude Opus 5.5 2a0604d3e9 fix(libkernel): keep the nice value at 0 after setpriority as measured on a PS5
On PS5 firmware 13.60 setpriority(PRIO_PROCESS, 0, v) returns 0 for -25,
-5, 5 and 25, and getpriority keeps returning 0. setpriority keeps its
target checks and returns 0 without storing the value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 14:48:57 -03:00
orezraeyandClaude Opus 5.5 83780cc1a0 Merge main into fix/libkernel-sw-version-block-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 14:11:20 -03:00
Adrià 08f2d02a56 Merge pull request #9171 from DavidSamir/feat/libkernel-sys-getlogin-futimesat
feat(libkernel): implement getlogin
2026-10-25 17:54:15 +01:00
zaryabzip 0b60e97834 feat(libkernel_sys): create threads suspended and resume them
Implement pthread_attr_setcreatesuspend_np, pthread_resume_np,
pthread_resume_all_np and pthread_multi_np with the sce forms
scePthreadAttrSetcreatesuspend, scePthreadResume, scePthreadResumeAll
and scePthreadMulti, following FreeBSD 11.4 libthr and the firmware
13.42 libkernel_sys module. A thread created suspended waits before its
start routine, outside any cancellation point, until it is resumed.
sceKernelRaiseException throws on Windows for a thread still suspended
at creation.
2026-10-25 21:51:02 +05:00
Yunus Shaikh f5757aab98 fix(libkernel): restore a handler's signal bit when the handler replaces the mask
A handler that read the mask and put it back with SIG_SETMASK stored its
own signal, which sigprocmask reports from the hold, in the process mask
and cleared the hold, so the signal stayed blocked after the handler
returned. pselect, setcontext and a siglongjmp inside the handler replace
the mask the same way. When the handler's own thread releases a hold, the
signal now gets back its bit from before the handler when the handler
returns, as FreeBSD's sigreturn puts back the mask from before it. A mask
another thread sets meanwhile is kept.
2026-10-25 09:49:35 -07:00
Adrià c661d9fae2 Merge pull request #9133 from fogydes/feat/libSceLibcInternal-posix-spawn
feat(libSceLibcInternal): implement posix_spawn process creation and reaping
2026-10-25 17:38:41 +01:00
pushkarreddyy 2ba10cd6bb refactor(libkernel): align sysKernel queries with firmware 13.42 disassembly 2026-10-25 21:07:36 +05:30
orezraeyandClaude Opus 5.5 92448b72f9 fix(libkernel): accept any block size and a null block in the system software version getters as measured on a PS5
On PS5 firmware 13.60 sceKernelGetProsperoSystemSwVersion and
sceKernelGetSystemSwVersion return 0 for every value in the leading size
field, keep it, write the string and the packed version, and return 0
without writing for a null block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 11:19:52 -03:00
Adrià FranchandClaude Sonnet 5.5 f63b27bdaa feat(libkernel): implement getlogin
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-25 15:07:38 +01:00
Yunus Shaikh 8be8dc83af Merge main into fix/libkernel-signal-handler-mask
Main's #10706 moves the declarations of exported functions and their types
into the libraries' public headers, and gives WaitForPendingInSet a
KernelTimespec timeout. The merge keeps this branch's DeliverUnblockedPending
and ChangeBlockedMask with main's KernelTimespec. It takes main's side of
the declarations in GuestSignalSets.cpp, whose setjmp and longjmp this
branch had added and libc's Api.hpp now declares. GuestSignalHandlerMask.cpp
includes the libkernel and libc public headers in place of its own
declarations and GuestSignalSet and GuestSigaction types, as the
public_headers audit requires.
2026-10-25 07:05:46 -07:00
fogydes 0514307ab8 fix(libkernel): translate waitpid child statuses to the guest numbering 2026-10-25 13:57:18 +01:00
fogydes 723d932f73 feat(libSceLibcInternal): implement posix_spawn process creation and reaping 2026-10-25 13:57:17 +01:00
David 5881575782 refactor(libkernel): export swapcontext from libkernel directly
The PS5 3.20 export lists have swapcontext in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys. The assembly entry in UserContext.cpp now is
swapcontext_nid_postfix, and the libkernel_sys jump stub is gone.
2026-10-25 13:04:08 +01:00
David ad0d4f5995 feat(libkernel_sys): implement swapcontext 2026-10-25 13:04:08 +01:00
orezraeyandClaude Opus 5.5 b3b0760369 Merge main into fix/libkernel-rtld-thread-atexit-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 08:05:05 -03:00