Commit Graph
1098 Commits
Author SHA1 Message Date
Adrià 1aff97d3c8 Merge pull request #12093 from dantdmdarealguy/fix/kqueue-windows-snapshot-times
fix(libkernel): read a watched file's times again after its size on Windows
2026-10-29 21:20:39 +01:00
Adrià 43332e5f3b Merge pull request #11865 from ionut27001/fix/libkernel-sched-own-pid
fix(libkernel): sched_getparam reads out-of-range priorities, sched_setparam EPERM outside 256-767, own pid on the main thread
2026-10-29 20:34:52 +01:00
Adrià 9036e3c9e4 Merge pull request #12126 from morten-holm/fix/macos-host-stack-above-arena
fix(libkernel): move the macOS main stack out of the guest arena
2026-10-29 14:51:57 +01: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à 578b8311ac Merge pull request #11267 from kallmek3nny/feat/libkernel-sem-setname
feat(libkernel): implement sem_setname
2026-10-29 11:31:34 +01:00
Adrià 0e5dad41c2 Merge pull request #9575 from DavidSamir/feat/libkernel-kqueue-evclear
feat(libkernel): support EV_CLEAR on a kqueue watched by another kqueue
2026-10-29 11:23:08 +01:00
Adrià c70c75ad13 Merge pull request #9284 from DavidSamir/feat/libkernel-sys-ksem-unnamed
feat(libkernel): implement the unnamed ksem semaphores
2026-10-29 08:48:19 +01:00
Dean e0a11b3fba Merge pull request #9515 from EagleBearerYS/fix/libkernel-getsockopt-net-sockets
fix(libkernel): getsockopt reads options of libSceNet sockets
2026-10-29 18:49:11 +13: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
Dean d775fc5958 Merge pull request #11403 from MarcZX10/marc/fix-libkernel-shm-anon-windows
fix(libkernel): recognize Windows anonymous shared memory descriptors
2026-10-29 11:49:22 +13:00
Dean 319621ba2e Merge pull request #12339 from medazizktata/fix/windows-exec-shared-mapping
fix(libkernel): map shared memory and files executable on Windows
2026-10-29 07:28:16 +13:00
ionut27001 7dc80f7f37 fix(libkernel): fill 0x58-byte sceKernelGetAppInfo record, throw for other pids 2026-10-28 20:16:32 +02:00
Adrià 027989a44a Merge pull request #11858 from jotitadev/fix/macos-poll-hangup-both-directions
fix(libkernel): report POLLHUP on macOS only once both directions of a stream have ended
2026-10-28 18:20:12 +01:00
kenny soloandClaude Opus 5.5 20c9a93999 feat(libkernel): implement sem_setname
Keep a copy of the name with the semaphore and move the export from the libkernel_sys stub into libkernel next to the other sem_* exports.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-28 14:51:17 +01:00
Adrià 5b9e1a8652 Merge pull request #12242 from milescoviello/docs/kernel-debug-raise-exception
docs(libkernel): list sceKernelDebugRaiseException and its release-mode form as silent stubs
2026-10-28 14:47:54 +01:00
Adrià c8fc68ebe5 Merge pull request #12073 from milescoviello/docs/sanitizer-replace-tables
docs(libkernel): note how titles' libc reads the sanitizer replacement tables
2026-10-28 14:47:05 +01:00
Adrià 5ff3328652 Merge pull request #11937 from milescoviello/docs/map-direct-memory-protections
docs(libkernel): note the protections ten titles pass to sceKernelMapDirectMemory
2026-10-28 14:46:49 +01:00
MarcZX10 436769c634 fix(libkernel): recognize Windows anonymous shared memory descriptors 2026-10-28 13:04:38 +00:00
AdriàandClaude Sonnet 5.5 638996829b docs(libkernel): shorten the kevent on a kqueue debt entry
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 13:45:47 +01:00
AdriàandClaude Sonnet 5.5 7cdb7a8780 test(libkernel): shrink the cleared kqueue race, match watched notes by ident, correct the kqueue debt entry
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 13:45:37 +01:00
David 4c77b6ab65 feat(libkernel): support EV_CLEAR on a kqueue watched by another kqueue
FreeBSD re-evaluates a kqueue's EVFILT_READ note from kqueue_wakeup,
which runs whenever the watched kqueue queues a note, so an EV_CLEAR
note fires again only after such an activation. The equeue now counts
activations, and the EV_CLEAR note fires when the count moves while
notes are queued.
2026-10-28 13:44:50 +01:00
David 0e693817d8 docs(debt): list the unnamed ksem calls under Functional 2026-10-28 12:57:05 +01:00
David fd6513d6ff refactor(libkernel): move the unnamed ksem calls into libkernel
The PS5 3.20 export lists have ksem_* in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys, so titles importing them from libkernel did not find
them. Following pipe1os's review on #9284, also: ENOSPC from
ksem_init when no descriptor is left, the SEM_MAX limit of 30 with
ENOSPC, and dup/dup2 from a ksem id throwing as for a kqueue.
2026-10-28 12:57:04 +01:00
dantdmdarealguy a793bd1341 fix(libkernel): read a watched file's times again after its size on Windows
TakeSnapshot read FileBasicInfo and then FileStandardInfo. A truncate or
write landing between the two left a snapshot with the new size and the
old LastWriteTime, and the next poll reported the same size with a newer
LastWriteTime as NOTE_WRITE. guest_kqueue's FileWatch aborts on Windows
when that happens after its ftruncate to 0.

Read FileBasicInfo again after FileStandardInfo and retry until both
reads agree. The window NTFS itself leaves, a truncate's new
LastWriteTime shown before its new size, stays and is listed in the
libkernel debt.
2026-10-28 11:42:55 +01:00
Mohamed Aziz Ktata dbd826bc88 fix(libkernel): map shared memory and files executable on Windows
A guest mmap with PROT_EXEC and MAP_SHARED of a shared-memory object or a regular file threw on Windows. The section is now created from a handle reopened with GENERIC_EXECUTE, as PAGE_EXECUTE_READ or PAGE_EXECUTE_READWRITE, the owner ACE of named objects grants execute with read, and a writable shared mapping of a read-only descriptor fails with EACCES, as FreeBSD 11.4 shm_mmap and vn_mmap do.

Fixes #12337
2026-10-28 11:14:08 +01: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 bc7cc27e55 Merge pull request #10856 from Felipebmaitan/feat/guest-signal-cancellation
fix(libkernel): avoid cancellation wakeups during thread exit
2026-10-28 22:52:08 +13:00
Dean 4a6693acf8 Merge pull request #12083 from KernelPanicNT/fix/libkernel-mutexattr-setkind-any-kind
fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
2026-10-28 22:46:46 +13:00
Adrià e52fd8377d Merge pull request #11897 from ionut27001/docs/libkernel-payload-measurements
docs(libkernel): record PS5 results for two libkernel exports
2026-10-28 10:33:32 +01:00
Adrià ab168194d4 Merge pull request #11732 from milescoviello/docs/virtualquery-title-reads
docs(libkernel): note the sceKernelVirtualQuery fields seven titles read
2026-10-28 10:09:05 +01:00
harisibrar1andClaude Opus 5.5 5bb96d08ad docs(libkernel): keep the map protection debt entry under the length limit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 01:28:34 -04:00
harisibrar1 6413eacf9d Merge remote-tracking branch 'origin/main' into fix/map-undefined-protection-einval
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-28 01:28:03 -04:00
milescovielloandClaude Opus 5.5 9a12233a76 docs(libkernel): list sceKernelDebugRaiseException and its release-mode form as silent stubs
Both log their arguments and the caller and return. Note what the
titles' bundled libc.prx passes them and that three of its
sceKernelDebugRaiseException calls are followed by ud2 in every build
checked, so the guest reaches that ud2 here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 04:25:31 +00:00
Yunus Shaikh 4432e8aa57 Merge main into fix/libkernel-getsockopt-net-sockets 2026-10-27 21:03:12 -07:00
Felipebmaitan 4ba0a6f9c4 chore: integrate current main for guest-signal-cancellation 2026-10-28 00:48:38 -03:00
Dean Galvin 97f1d41a2c Revert "Merge pull request #10809 from frankea/fix/direct-memory-12gib"
This reverts commit 780b33aea3, restoring the 13824 MiB direct memory pool.

With the pool at 12288 MiB, Astro Bot (PPSA21564) can no longer load its
level: DirectMemoryAllocator asserts "Can't allocate direct memory" for a
64 MB VideoPlayerTexture with 12228 of 12288 MB in use, then the process
faults about 26 s in (2 of 2 runs, RTX 4090, Linux, main cccdaa2734).
The same tree with only this merge reverted runs the full 150 s with no
direct memory assert (2 of 2 runs).
2026-10-28 15:45:26 +13:00
Dean 780b33aea3 Merge pull request #10809 from frankea/fix/direct-memory-12gib
fix(libkernel): report 12 GiB of direct memory, as a PS5 does
2026-10-28 13:49:57 +13:00
Dean b3b449cfe4 Merge pull request #8916 from Henryisdjfunkyho/fix/cancellable-timed-sleeps
fix(libkernel): wake timed sleeps for thread cancellation
2026-10-28 13:48:32 +13:00
Dean e778405b5b Merge pull request #11592 from alvaroelpob/fix/libkernel-condattr-getclock-einval
fix(libkernel): fail pthread_condattr_getclock with EINVAL for a null attribute
2026-10-28 13:04:04 +13:00
Dean ba8845d2e7 Merge pull request #9442 from Gruzzberry/feat/lchflags
feat(libkernel_sys): implement lchflags
2026-10-28 13:00:19 +13:00
Morten HolmandClaude Sonnet 5.5 3b1697cf1c fix(libkernel): move the macOS main stack out of the guest arena
Under Rosetta the main thread stack lies at about 12 GiB, inside the guest
arena, where a title can map fixed addresses; a fixed mapping over it
aborts with a host region overlap.

- Aps5StartGuest moves the main thread onto a 16 MiB stack at
  0x600000000000 when the old stack overlaps a host region of the arena.
  It copies argv, environ, the program name and the initial block off the
  old stack, then frees the old stack and releases its range to the arena.
- The guest thread keeps the stack size of the original main thread.
- The arena gets GuestArenaOverlapsHostRegion and
  GuestArenaReleaseHostRegion for POSIX hosts.
- guest_main_stack_move starts the guest, then requires the main thread
  outside the arena, a fixed mapping where the old stack was, and argv and
  the environment intact.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 22:55:41 +01:00
Adrià 4a6005955f Merge pull request #10898 from imellag/feat/libkernel-memory-protection-macos
feat(libkernel): guest memory protection and VirtualQuery on macOS hosts
2026-10-27 21:42:24 +01: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
KernelPanicNT 625a3fbb62 fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
scePthreadMutexattrSetkind called NotImplemented_nid_no_patch for a kind
outside 1 to 4. Firmware 13.42's libkernel, run in an emulator, makes it
call pthread_mutexattr_setkind_np, which stores any kind as a signed
16-bit value and returns 0, and turns a null attribute's -1 with errno 22
into 0x8001FFFF. It now forwards to pthread_mutexattr_setkind_np and
converts the result with sceKernelError, so a null attribute or object
still returns 0x8001FFFF and now also sets errno 22.

An out-of-range kind is refused by scePthreadMutexInit with 0x80020016,
leaving the mutex untouched, as measured for the same module.
scePthreadMutexattrGetkind is unchanged; kind 0 now reaches it and
returns 0.
2026-10-27 19:24:23 +00:00
KernelPanicNT 9ed4377be4 Merge main into fix/libkernel-mutexattr-setkind-any-kind 2026-10-27 19:22:42 +00:00
milescovielloandClaude Opus 5.5 c7f22c2778 docs(libkernel): note how titles' libc reads the sanitizer replacement tables
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 18:51:10 +00:00
Adrià e2a5118839 Merge pull request #11047 from imellag/feat/libkernel-macho-tls
feat(libkernel): thread-local storage for Mach-O guests
2026-10-27 15:18:46 +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
Adrià a40ad89e2c Merge pull request #11236 from orezraey/fix/libkernel-kqueue-timer-readd-measured-ps5
fix(libkernel): accept EVFILT_TIMER re-adds with a time unit or on a disabled timer as measured on a PS5
2026-10-27 14:28:05 +01:00