Commit Graph
450 Commits
Author SHA1 Message Date
Adrià 0c9c5db748 Merge pull request #12690 from MarcZX10/feat/host-system-report
feat(agc): host system report and an actionable missing-Vulkan-feature message
2026-10-30 02:52:18 +01:00
Adrià ec709cede3 Merge pull request #12436 from milescoviello/fix/vm-loadavg
fix(libkernel): answer vm.loadavg with the host's load averages
2026-10-30 02:31:30 +01:00
Adrià 184afa49ad Merge pull request #12563 from babyhuey/fix/setrlimit-efault
fix(libkernel): return EFAULT from setrlimit for an unreadable limit
2026-10-29 20:35:45 +01:00
MarcZX10 3a74ce471c feat(libkernel): export the host CPU probe to other libraries through extern C helpers
The patched libkernel does not hand its plain C++ functions to the other patched libraries: every cross-library call in the tree goes through an extern C helper with a _nid suffix. The host CPU probe had none, so a library that wants the CPU model or the missing feature list cannot reach it. These helpers return plain structs, as the application metadata helpers do.
2026-10-29 14:20:35 +00:00
Adrià cba260828e Merge pull request #11864 from ionut27001/fix/libkernel-get-app-info-layout
fix(libkernel): fill 0x58-byte sceKernelGetAppInfo record, throw for other pids
2026-10-29 14:33:12 +01:00
Adrià efc24518bc Merge pull request #11862 from ionut27001/fix/libkernel-setrlimit-store-limits
fix(libkernel): store setrlimit RLIMIT_CORE soft limit, ignore raised DATA/STACK hard limits
2026-10-29 13:47:57 +01:00
Adrià 5454cd2e45 Merge pull request #11130 from imellag/perf/macos-mimalloc
feat(libs): let relinked macOS games opt into mimalloc
2026-10-29 12:58:23 +01:00
Dean 3a2b919816 Merge pull request #11863 from ionut27001/fix/libkernel-soc-sensor-channels
fix(libkernel): return -49 from sceKernelGetSocSensorTemperature channel 64 as a PS5 payload process does
2026-10-29 12:17:03 +13:00
milescovielloandClaude Opus 5.5 ea0b9c1272 fix(libkernel): zero vm.loadavg's padding and clamp the scaled averages
GuestLoadAverage's braced initializer left its four bytes of padding after ldavg indeterminate, and the sysctl copies all 24 bytes to the guest. The scaled value of a load over UINT32_MAX / 2048 was converted out of range. The test now checks the padding and the exact fscale 2048 scaling against the host averages read just before and after the call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 20:32:29 +00:00
ionut27001 7dc80f7f37 fix(libkernel): fill 0x58-byte sceKernelGetAppInfo record, throw for other pids 2026-10-28 20:16:32 +02:00
babyhuey 24e823c688 fix(libkernel): return EFAULT from setrlimit for an unreadable limit
setrlimit read the guest rlimit struct directly, so a non-null pointer
into unmapped memory crashed the host. It now copies the struct in with
GuestCopyIn_nid_no_patch together with the existing null check, before
the resource check, as FreeBSD's sys_setrlimit copies in before
kern_setrlimit validates the resource, and fails with EFAULT.
2026-10-28 14:16:00 -04:00
Adrià 6eae433fad Merge pull request #11801 from jotitadev/fix/macos-waitpid-child-signals
fix(libkernel): report a child's stop and kill signals correctly on macOS hosts
2026-10-28 17:35:55 +01:00
Emanuele 4c75091972 feat(libs): let relinked macOS games opt into mimalloc 2026-10-28 14:50:31 +01:00
milescovielloandClaude Opus 5.5 ef9c7a06a5 fix(libkernel): answer vm.loadavg with the host's load averages
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 13:11:49 +00:00
Dean 846ae118f9 Merge pull request #11861 from ionut27001/fix/libkernel-sysconf-measured-names
fix(libkernel): sysconf answers the names a PS5 payload process answers
2026-10-28 22:52:41 +13:00
Dean e4a00a5ddb Merge pull request #12069 from dantdmdarealguy/fix/raise-terminating-target-windows
fix(libkernel): treat a raise target that is already terminating as exited on Windows
2026-10-28 22:45:45 +13:00
Dean a6816811f3 Merge pull request #10975 from xXPBSXx/fix/gettimeofday-itimer-efault
fix(libkernel): fail gettimeofday, getitimer, setitimer and the sceKernel time getters with EFAULT on an unusable pointer
2026-10-28 13:02:14 +13:00
Adrià 225ebc5eee Merge pull request #11264 from Gruzzberry/fix/sysctl-faults
fix(libkernel): fail sysctl and sysctlbyname with EFAULT on an unreadable or unwritable pointer
2026-10-27 21:16:21 +01:00
dantdmdarealguy 95a785104c fix(libkernel): treat a raise target that is already terminating as exited on Windows
SuspendThread fails with STATUS_THREAD_IS_TERMINATING for a thread that
has begun to exit while its handle is not signaled yet. TryDeliver took
only the signaled handle as an exit, so the raise deliverer, which keeps
sweeping a target in host code until delivery or exit, threw "cannot
suspend the target thread" and aborted the process when that target
exited in between. The suspension now reads the NTSTATUS from
NtSuspendThread and treats a terminating target as exited; other
failures still throw.

guest_raise_exiting_thread raises at 32 threads per round that block in
a host wait and exit after it, for 100 rounds.
2026-10-27 13:38:04 -05:00
Adrià a1053d987b Merge pull request #11273 from Gruzzberry/fix/signal-pointer-faults
fix(libkernel): fail the signal action, mask, stack and pending calls with EFAULT on an unusable pointer
2026-10-27 17:55:35 +01:00
ionut27001 bfbe4043c9 fix(libkernel): store setrlimit RLIMIT_CORE soft limit, ignore raised DATA/STACK hard limits
Probe p87_libkernel lines 7-27: a payload process on a PS5 returns 0 and keeps the limits for a raised RLIMIT_DATA or RLIMIT_STACK hard limit, and reads back RLIMIT_CORE soft limits.
2026-10-27 15:50:28 +02:00
ionut27001 1004bb6828 fix(libkernel): return -49 from sceKernelGetSocSensorTemperature channel 64 as a PS5 payload process does
Probe p83_libkernel; channels 3 to 63 keep throwing.
2026-10-27 12:00:15 +02:00
ionut27001 e984b14b3f fix(libkernel): sysconf answers the names a PS5 payload process answers 2026-10-27 12:00:08 +02:00
Jota 5e75bae0ce fix(libkernel): keep the host signal numbers in waitpid on macOS hosts
waitpid translated the stop and termination signal of a child from the
Linux numbering to the FreeBSD one on every non-Windows host. Darwin
already numbers its signals like FreeBSD, so on macOS the translation
broke them: a child stopped by SIGSTOP (17) was reported as stopped by
20, SIGBUS (10) as 30, SIGSYS (12) as 31, and a child killed by SIGUSR1 (30)
made waitpid report a missing guest equivalent.

macOS now passes the host signal through. The spawn test finds its own
executable with _NSGetExecutablePath on macOS instead of /proc/self/exe,
and also checks a child killed by SIGUSR1, whose number differs between
Linux and FreeBSD and which macOS used to reject.
2026-10-27 05:05:29 -03:00
GruzzberryandClaude Sonnet 5.5 4d8fa35a5e fix(libkernel): fail sysctl and sysctlbyname with EFAULT on an unreadable or unwritable pointer
FreeBSD 11.4's sys___sysctl and userland_sysctl copy the name and the
old length in, and copy the value and the length out, so a bad pointer
gives EFAULT in that order. sysctl dereferenced them directly, and
sysctlbyname read its name with strcmp.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 08:30:17 +01:00
Adrià FranchandClaude Sonnet 5.5 7554d2095c fix(libkernel): keep swapcontext's finish helper externally linked
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 06:14:13 +01:00
Yunus Shaikh 8f007d234a feat(libkernel_sys): implement sigreturn
sigreturn applies FreeBSD 11's amd64 sys_sigreturn checks:
- EFAULT for a null context;
- EINVAL for unknown mc_flags, and for rflags bits outside
  PSL_USERCHANGE that differ from the current flags;
- set_fpcontext's FPU format and ownership cases.
It then restores the context through the path setcontext uses, which
now lives in RestoreContext. A non-user %cs and an extended FPU state
still throw.
2026-10-27 06:14:13 +01:00
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
xXPBSXx 506d69b015 Merge main (e0b13f2990) into fix/gettimeofday-itimer-efault
The only conflict is sceKernelGettimezone in Time.cpp: main now reports the host zone, so the zone is built from that into a local and copied out with the checked write.
2026-10-26 20:49:00 +01: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 Sonnet 5.5 1fbf3a42d2 fix(libkernel): fail the signal action, mask, stack and pending calls with EFAULT on an unusable pointer
FreeBSD 11.4's sys_sigaction, sys_sigprocmask and sys_sigaltstack copy
their input in before validating it and copy the old value out after
the change, and sys_sigpending copies out; a bad pointer gives EFAULT.
The guest pointers were dereferenced directly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-26 09:28:04 +00:00
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