Commit Graph
1450 Commits
Author SHA1 Message Date
Dean 5b5786fae2 Merge pull request #14854 from kallmek3nny/feat/libkernel-kevent-proc-exit-self
feat(libkernel): accept EVFILT_PROC with NOTE_EXIT on the calling process
2026-11-06 23:03:13 +13:00
Dean 9ee97cb451 Merge pull request #15064 from JJenkx/fix/dmem-size-from-flexible
feat(libkernel): optionally report direct memory as the game budget less the configured flexible memory
2026-11-06 22:16:01 +13:00
Dean Galvin 1de3c88c5c Merge branch 'main' 2026-11-06 21:59:04 +13:00
Dean Galvinandslopgobblercobbler 51ca3cbef0 docs(libkernel): point the barrier count check at _pthread_barrier_init
The FreeBSD permalink in the pthread_barrier debt entry covered _pthread_barrier_destroy; the count check it describes is at lines 97 to 104.

Co-authored-by: slopgobblercobbler <[email protected]>
2026-11-06 19:09:29 +13:00
slopgobblercobbler 405310c630 fix(libkernel): validate memory pointers and argument bounds in pthread barrier 2026-11-06 05:55:51 +01:00
Dean Galvin 4492567a14 Merge branch 'main' 2026-11-06 13:07:38 +13:00
Dean b077c1b3a0 Merge pull request #15890 from Retr0G28/fix/ioctl-scenet-socket
fix(libkernel): pass ioctl on a sceNetSocket socket to libSceNet
2026-11-06 12:17:31 +13:00
Evrim Cicek 11f2ffcc40 fix(libkernel): end a blocked receive on Windows when its socket is shut for reading 2026-11-05 17:48:43 +03:00
Dean f305293bb0 Merge pull request #15698 from javierUDP/fix/macos-exec-path-after-stack-move
fix(libkernel): keep the process start block mapped when the main stack moves
2026-11-06 01:29:35 +13:00
Dean fc147beeaa Merge pull request #15149 from 011010/fix/macos-activity-real-runtime
fix(tests): run the macOS game-mode activity against the real runtime
2026-11-05 21:47:04 +13:00
Dean 1e24993fa3 Merge pull request #11223 from Ragbie/fix/poll-after-shut-rd
fix(libkernel): report a socket shut for reading in poll and select and wake their waiters
2026-11-05 17:28:28 +13:00
Dean 051d531d1b Merge pull request #14493 from AlexWhitehouse/fix/libkernel-windows-sparse-truncate
fix(libkernel): leave Windows truncate extensions as sparse holes
2026-11-05 17:27:50 +13:00
Dean 56d300218d Merge pull request #14320 from DeveshB-1/fix/notification-request-efault
fix(libkernel): return EFAULT from sceKernelSendNotificationRequest for invalid memory
2026-11-05 16:59:38 +13:00
Adrià 0540ef0ef2 Merge pull request #13995 from xXPBSXx/docs/libkernel-virtualquery-size
docs(libkernel): name what the emulators do for the size and flags of sceKernelVirtualQuery
2026-11-05 03:15:11 +01:00
Dean a82a382fa8 Merge pull request #13336 from malekaifa/fix/sync-on-address-unreadable
fix(libkernel): return EFAULT for unreadable wait addresses
2026-11-05 12:42:55 +13:00
Retr0 69470e7075 fix(libkernel): pass ioctl on a sceNetSocket socket to libSceNet 2026-11-05 00:11:22 +02:00
Dean 9e70d97449 Merge pull request #13953 from pushkarreddyy/fix/ksem-getvalue-efault
fix(libkernel): return EFAULT from ksem_getvalue for invalid memory pointers
2026-11-05 08:19:49 +13:00
Dean 045eda43dc Merge pull request #12854 from slopgobblercobbler/fix/libkernel-mincore-error-parity
fix(libkernel): enforce FreeBSD 11.4 error precedence and vector copyout in mincore
2026-11-05 08:19:30 +13:00
Dean 5e2f04007b Merge pull request #9326 from erickerxhalli/feat/libkernel-mutex-prioceiling
feat(libkernel): implement pthread_mutex_getprioceiling and setprioceiling
2026-11-05 08:19:17 +13:00
Dean df721d53f2 Merge pull request #7192 from Jev1337/feat/libkernel-host-fault-exception-handlers
feat(libkernel): deliver host faults to sceKernelInstallExceptionHandler handlers
2026-11-05 08:19:08 +13:00
pushkarreddyy ad7b2988b5 docs(libkernel): document EFAULT memory validation fallback in ksem_getvalue 2026-11-04 23:13:27 +05:30
Dean 92cdaf6337 Merge pull request #11624 from Felipebmaitan/feat/windows-guest-gs-state
feat(libkernel): maintain per-thread guest GS bases on Windows
2026-11-05 06:35:52 +13:00
Dean 6863f295a9 Merge pull request #10749 from ycbuzi/refactor/siginterrupt-libc-internal
refactor(libSceLibcInternal): serve siginterrupt from libSceLibcInternal
2026-11-05 06:35:30 +13:00
javierUDP dd5ee9e4c6 fix(libkernel): keep the process start block mapped when the main stack moves
On macOS under Rosetta, Aps5StartGuest moves the main thread off the host
stack and releases the old range to the guest arena. dyld keeps its own
pointers into the process start block at the top of that range and offers
no call that redirects them, where argv and environ have one:
_NSGetExecutablePath copies the path string out of the block on every
call, so the first call after the move read unmapped memory and the
process died with KERN_PROTECTION_FAILURE. A title does not have to call
it: libxpc reaches it from xpc_connection_resume, and ShaderCacheDirectory
calls it for the shader disk cache.

Release the old stack only up to the pages that hold the block, and only
while argv still points into the stack. They are the top two pages, 8 KiB
of the 8372224-byte stack here, so a title that fixes a mapping over that
range now fails with a host region overlap; the rest is free as before.

guest_main_stack_move asked for a 64 KiB guest mapping aligned down from
a local of main, which falls inside the kept pages. It now probes the
64 KiB below them, requires the kept pages to be refused, and calls
_NSGetExecutablePath after the move, which segfaults without this change.
2026-11-04 04:22:23 -03:00
Cesar MoraandClaude Opus 5.5 cd4549d0cc fix(libs): ship mimalloc's licence and document the inherited preload
The release archives carry mimalloc's binaries on Linux and Windows, so
they now also carry its MIT licence as libs/licenses/mimalloc.txt, and
packaging fails without it. USAGE.md and ENVIRONMENT.md say that
APS5_MIMALLOC and LD_PRELOAD stay set after the restart and state the
memory cost measured with it, and the restart's debt entry says that
only the log-file copy is handed back before execv.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015W3M6NbYpmwWkzkL8YNLaF
2026-11-03 23:18:32 -06:00
Cesar MoraandClaude Opus 5.5 468c07712c feat(libs): let relinked Linux games opt into mimalloc
With APS5_MIMALLOC set, libkernel restarts the title with
libmimalloc.so from libs/ first in LD_PRELOAD, as it does on macOS
with DYLD_INSERT_LIBRARIES. The macOS restart becomes one
implementation with platform pieces (MimallocRestart.cpp): on Linux
the executable is the target of /proc/self/exe and the arguments
those of /proc/self/cmdline. The restart is a priority 101
constructor, so it runs before libkernel's other initializers. It
gives the standard streams back from an ANYPS5_LOG_FILE copy before
execv, which also fixes the macOS restart under that variable, and
refuses a path the preload list cannot hold.

The build copies libmimalloc.so beside the libraries except in ASan
and TSan builds, the Linux release archives ship it, and the restart
tests run on Linux too, with a new case for ANYPS5_LOG_FILE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015W3M6NbYpmwWkzkL8YNLaF
2026-11-03 23:18:20 -06:00
hugodearaujo 3a781a01fa docs(debt): state that APR priorities are unordered and a wait by id covers one buffer 2026-11-03 20:51:59 -03:00
hugodearaujo f06738e1c8 docs(debt): record the APR submit priority queues 2026-11-03 20:15:59 -03:00
Jevro1337andClaude Opus 5.5 e1d324824c docs(libkernel): state the open gaps of fault delivery first
Cut the two longest exception handler entries under the 1000 character
limit: the mapping entry keeps the unverified protection fault signal and
what counts as title code, the Linux entry keeps what a later guest signal,
the conversion stubs and older glibc change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 21:01:18 +01:00
Jevro1337andClaude Opus 5.5 2c7e139d93 perf(libkernel): find the object of a faulting address with _dl_find_object
dladdr1 searches the object's symbol table, which made every host fault
chained past an installed handler about 8 us slower on Linux. glibc 2.35
and later answer the same question with _dl_find_object, which is also
async-signal-safe; older glibc keeps dladdr1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 21:01:18 +01:00
Jevro1337andClaude Opus 5.5 33ec8a1b92 test(libkernel): cover exception handlers that return without fixing the fault
A handler that returns the context unchanged runs again on the same fault,
a handler that fixes the page with mprotect and returns lets the store
complete, and a handler that removes itself and returns ends the process
with the fault (checked in a child process, so a loop fails on a timeout).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 21:01:17 +01:00
Jevro1337andClaude Opus 5.5 ab363feecc feat(libkernel): deliver host faults to sceKernelInstallExceptionHandler handlers
A handler installed for SIGILL, SIGFPE, SIGBUS or SIGSEGV now receives
the faults raised in title code instead of the process ending, with
mc_trapno, mc_addr and mc_err filled as FreeBSD 11's amd64 trap() does.
On Windows the crash reporter's vectored handler offers unclaimed faults
to libkernel, which redirects the thread to a stub that runs the handler
outside the exception dispatcher; on Linux chained host signal handlers
classify faults by REG_TRAPNO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 21:01:15 +01:00
Felipebmaitan 41bbc32070 chore: refresh GS state with current main 2026-11-03 14:34:25 -03:00
bluandClaude Opus 5.5 24497b2406 Merge branch 'main' into refactor/siginterrupt-libc-internal
Resolves docs/dev/debt/libkernel.md: main's sigaction entry (SIGPIPE outside Windows) and this branch's signal entry, which points to libSceLibcInternal for siginterrupt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:23:38 -07:00
Dean 31ab214934 Merge pull request #11002 from SandstromPL/fix/libkernel-guest-sigpipe
fix(libkernel): let a guest ignore or catch SIGPIPE on Linux
2026-11-04 05:43:27 +13:00
Dean 206e72c90b Merge pull request #15137 from pushkarreddyy/feat/libkernel-sandbox-app0-alias
feat(libkernel): alias title sandbox app0 path to application directory
2026-11-03 21:11:30 +13:00
Dean 8b82678900 Merge pull request #10025 from mehmetbayoglu/fix/libkernel-amm-prt-zero-page
fix(libkernel): map unbacked AMM PRT pages to one read-only zero page on Windows
2026-11-03 21:09:48 +13:00
Dean 91ca312437 Merge pull request #9242 from DavidSamir/feat/libkernel-sys-tcgetsid
feat(libkernel): implement tcgetsid
2026-11-03 21:09:31 +13:00
Dean a74a4c370c Merge pull request #14310 from XatiX/fix/libkernel-net-socket-forwards
fix(libkernel): forward socket calls on sceNetSocket descriptors to libSceNet
2026-11-03 21:08:43 +13:00
Dean 8835460b5e Merge pull request #7532 from hugodearaujo/fix/linux-guest-main-stack
fix(linux): enter the guest entry on a main stack at the console's address
2026-11-03 21:07:51 +13:00
Dean Galvin a39b825599 Merge commit 'd1ae628bc2f62459cce1e9872ba5632c938c71f2' into HEAD
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-11-03 18:18:49 +13:00
Dean a03cc0dde6 Merge pull request #14885 from oneandonlydean/carry-7135
fix(libkernel): follow kern_cpuset for the base cpuset, level checks and interrupt targets
2026-11-03 18:14:20 +13:00
Dean b955001c4d Merge pull request #15030 from Gruzzberry/fix/sysctl-overcommit-eperm
fix(libkernel): fail a vm.overcommit write with EPERM
2026-11-03 18:13:26 +13:00
Dean e41879d2b7 Merge pull request #14876 from roboterspinne/fix/libkernel-ipv6-unspecified-connect
fix(libkernel): connect an AF_INET6 socket to ::1 when the address is unspecified, as FreeBSD does
2026-11-03 18:11:16 +13:00
Dean 7a3d08c1c3 Merge pull request #14875 from roboterspinne/fix/libkernel-tcp-multicast-address
fix(libkernel): fail bind and connect of a stream socket to a multicast address with EAFNOSUPPORT
2026-11-03 18:11:11 +13:00
Dean 79b49a50c6 Merge pull request #14710 from ahmadmuj/fix/anyps5-apr-guest-copyout
fix(libkernel): return EFAULT from APR file size and stat queries for an unwritable output
2026-11-03 18:09:40 +13:00
Dean 48dd279a37 Merge pull request #13950 from pushkarreddyy/fix/usercontext-efault
fix(libkernel): return EFAULT from context operations for invalid memory pointers
2026-11-03 18:09:35 +13:00
Dean 10921ef452 Merge pull request #12560 from Kikoarl/fix/win32-verbatim-path-dos-devices
fix(libkernel): preserve DOS device names and trailing dots or spaces on Windows
2026-11-03 18:09:19 +13:00
Dean Galvin df788026b6 fix(libkernel): refuse cpuset sizes the console rejects and record the EPERM difference
cpuset_getaffinity and cpuset_setaffinity return ERANGE from 24 bytes, as a PS5 payload process did (rooklz sweep, #7135 comment 6391606624: 8 to 16 accepted, below 8 and from 24 up ERANGE), and throw for the unmeasured 17 to 23, as pthread_getaffinity_np does. The tests that used 32 bytes use 16 and pin 7, 24, 32 and 64 to ERANGE. The setter entry records that the console answers EPERM for a CPU outside the process's set where this clips and returns 0.
2026-11-03 15:15:35 +13:00
Dean Galvin cc73f16c59 fix(libkernel): answer CPU_LEVEL_ROOT and test the cpuset sizes the console accepts
cpuset_getaffinity at CPU_LEVEL_ROOT returns 0xffff, as a PS5 payload process read it (rooklz, #7135 comment 6390891591), instead of throwing; the target is checked as at the other levels. The level 2 base-set test now passes 8 and 16 bytes, which the console accepts (it returns ERANGE from 24 bytes), instead of depending on the 32 bytes it rejects. The debt entry records the root measurement and that the title root set is unmeasured.
2026-11-03 15:11:23 +13:00