Commit Graph
1437 Commits
Author SHA1 Message Date
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
JJenkxandClaude Opus 5.5 db14f7a49d fix(libkernel): keep sceKernelRaiseException pending on a suspended thread on Windows
On Windows, sceKernelRaiseException threw for a thread created suspended
and not resumed yet. FreeBSD libthr starts such a thread with signals
blocked and restores its mask on resume, so the signal stays pending and
is delivered on that thread once it runs.

The raise is now recorded in the thread's pendingException with a
compare-exchange, and the thread exchanges it for -1 when it leaves the
creation wait and delivers it to itself before its start routine. Both
sides use one atomic, so a raise racing a resume is either taken by the
thread or, after it started, delivered as for a running thread. Raises
while pending are merged, as for a standard signal.

guest_pthread_create_suspended now runs the deferred-delivery case on
every host, with a second raise while the thread is suspended.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 13:39:50 -04:00
MarcZX10 f49b753ec2 docs(debt): record that APS5_GAME_MODE makes no request on Windows
Windows keeps the timer-resolution opt-out in Time.cpp; nothing else is
requested or measured.
2026-10-29 17:16:53 +00:00
MarcZX10 a17b8e9f3e docs(debt): record that the macOS Game Mode itself is not requested
Only an activity is held; whether the system treats the title as a game is
unmeasured.
2026-10-29 17:16:53 +00:00
MarcZX10 14c5870127 docs(debt): record that the macOS activity backend was never run on macOS
The option values, the message casts and the effect on a title are
unverified.
2026-10-29 17:16:52 +00:00
MarcZX10 65417fb3f9 docs(debt): record the GameMode ABI source and that no daemon was run
The backend was tested only against fixture libraries.
2026-10-29 17:16:52 +00:00
MarcZX10 2488eec39f docs(debt): record the Linux exits that skip the GameMode release
An immediate exit and a crash end the request through the daemon, whose
delay is unmeasured.
2026-10-29 17:16:52 +00:00
MarcZX10 a1ac026ee4 docs(debt): record that APS5_GAME_MODE is off by default because its effect is unmeasured
Say why auto is not the default and that the benefit of on is unmeasured.
2026-10-29 17:16:52 +00:00
KernelPanicNT 602fc9c55a feat(libkernel): throw for a null pthread_condattr_getclock output
pthread_condattr_getclock reached NotImplemented_nid_no_patch for a null
output pointer with a valid attribute. Measured as a payload process on
a device, that call faults, as does scePthreadCondattrGetclock in the
same case, so both now throw std::invalid_argument. Every other measured
result of the condition attribute clock getters and setters already
matched. The test covers every invalid clock ID from -1 to 16.
2026-10-29 14:33:36 +00:00
hugodearaujo 7348d46be0 Merge main into fix/linux-guest-main-stack
# Conflicts:
#	core/libs/prx/libkernel/CMakeLists.txt
2026-10-29 11:21:10 -03:00
ntamas94andClaude Opus 5.5 da7581eec4 fix(libkernel): report a 64 KiB st_blksize for directories
A PS4 Pro (firmware 10.71) reports st_blksize 0x10000 from stat and fstat
for /app0, its subdirectories and the system library directory. Titles
size one getdents buffer from it: CUSA18659's CryPak reads st_blksize +
264 bytes once, so the 512 reported here cut its shader directory listing
short. Directories, app0.zar ones included, now report 0x10000; /data
directories (0x8000 on the console) and files are recorded as debt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:17:34 +01:00
Oleg d0157c7d1b test(libkernel): cover the prefixed APR batch resolve without sizes 2026-10-29 15:09:11 +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
Hedi Trigui 59c9c7cfac fix(libkernel): validate posix_madvise address against user-map minimum and add regression tests 2026-10-29 14:32:53 +01:00
Hedi Trigui bbb4d05d42 feat(libkernel): implement posix_madvise 2026-10-29 14:14:36 +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
JJenkxandClaude Opus 5.5 dc1d801c4c fix(libkernel): map Windows shared memory with the regular file checks
On Windows, mmap sent a shared memory descriptor straight to the shared
file mapper, skipping the checks and the private path that a regular
file descriptor takes. A private mapping of a named or anonymous object
then failed with EOPNOTSUPP, and a writable shared mapping of a
read-only descriptor failed with EIO instead of EACCES. Shared memory
objects are files on Windows, so they now take the same access checks
and the same private copy as a regular file; only the directory, device
and file-type refusals stay limited to other descriptors.

guest_named_shm_windows_mapping covers shared mappings through two
descriptors, pread and pwrite against them, an offset mapping, a private
mapping, read-only mappings and the mappings after shm_unlink.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 08:47:28 -04:00
p3nicillinandClaude Opus 5.5 7c97d68937 fix(libkernel): throw for every set size the console was not measured with
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:18:00 +00:00
p3nicillinandClaude Opus 5.5 615414a7db docs(libkernel): keep the getaffinity entry apart from the cpuset entry
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:18:00 +00:00
p3nicillinandClaude Opus 5.5 b4861eb197 fix(libkernel): answer pthread_getaffinity_np for the console's set sizes
PS5_PayloadSDK measured in a title (firmware 12.09) that
pthread_getaffinity_np answers sets of 8 and 16 bytes and returns ERANGE
for 32 bytes or more, so FreeBSD's 32-byte cpuset_t is refused. The call
accepted exactly 32 bytes and refused every other size. Sizes under 8
keep ERANGE; 17 to 31 bytes, between the measured sizes, throw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:18:00 +00:00
p3nicillinandClaude Opus 5.5 4cf7411a46 feat(libkernel): add sceKernelGetExecutableModuleHandle
Return the main program's handle, the first one sceKernelGetModuleList
lists and one sceKernelGetModuleInfo accepts. reSOT (PPSA99023) imports
it from libkernel and passes the handle to sceKernelGetModuleInfo to find
its own code segment; before this its eboot failed to load on the
unresolved import.

The PS5 3.20 export lists have it in libkernel as well as libkernel_sys,
and on Windows a libkernel import never reaches libkernel_sys, so the
throwing libkernel_sys stub moves to libkernel as pselect did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:17:59 +00:00
Nixitov d4d53e2dea docs(libkernel): trim the ProtectDirectMemoryForPID debt entry
AI-assisted: yes
2026-10-29 13:02:54 +01:00
Nixitov ea1f12ccd8 docs(libkernel): cite the sources of both direct memory exports
Rewrite the sceKernelProtectDirectMemoryForPID debt entry around the
prototype and console reading published with MihawkOS, and record the
assumption behind forwarding sceKernelAllocateDirectMemoryForApp.

AI-assisted: yes
2026-10-29 12:57:47 +01:00
Nixitov bf1ae46389 feat(libkernel): export sceKernelAllocateDirectMemoryForApp and sceKernelProtectDirectMemoryForPID
MihawkOS (PPSA99170, mihawk-99/PS5_MihawkOS v4.0.0-alpha-4) imports both
from libkernel; only libkernel_sys declared them, so the loader stopped.

AI-assisted: yes
2026-10-29 12:17:40 +01:00
Yunus Shaikh e6d4929f65 Merge main into fix/libkernel-sema-handoff
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-29 03:40:31 -07: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
Alexandre Figueiredo 8b626e3074 fix(libkernel): start guest threads with the x87 control word 0x037f 2026-10-29 10:12:26 +00: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 Galvin 182c8be217 Merge main into fix/open-create-trailing-slash 2026-10-29 20:35:24 +13: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
milescovielloandClaude Opus 5.5 1e19b327f7 fix(libkernel): refuse a JIT shared memory descriptor in SCM_RIGHTS, and use the renamed kqueue check
sceKernelJitCreateSharedMemory's size object and maximum protection live
in libkernel's g_jitDescriptors, which the receive side of SCM_RIGHTS
doesn't fill, so a received JIT descriptor failed
sceKernelJitMapSharedMemory with EBADF (XairRrR's review). Passing one
now throws, with the random device and directory cases; IsJitSharedMemory
answers it. The merge of main brought #11296's rename of
IsKqueueDescriptor to IsKqueueDescriptor_nid_no_patch, which the kqueue
check now calls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 05:47:55 +00:00
milescoviello 9409deaa87 Merge remote-tracking branch 'upstream/main' into feat/scm-rights 2026-10-29 05:47:11 +00:00
milescovielloandClaude Opus 5.5 b9e987b82e fix(libkernel): refuse to pass a guest kqueue, a random device or a directory in SCM_RIGHTS
A guest kqueue and a guest /dev/urandom are /dev/null placeholders with
their behaviour in libkernel's tables, and a guest directory descriptor
keeps its reading state there too. sendmsg sent the placeholder, and the
receiver got a descriptor that failed kevent or read as empty. FreeBSD's
unp_internalize returns EOPNOTSUPP for a kqueue (no DFLAG_PASSABLE), so a
kqueue now gets that; a random device or a directory throws.

A zero-byte sendmsg carrying descriptors on a stream socket returned 0
and lost them, as Linux sends no record without data. It throws now.
FreeBSD sends the control data alone there.

guest_socket_rights checks the kqueue refusal and that the next send on
the pair arrives without control data.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 04:21:45 +00:00
milescovielloandClaude Opus 5.5 20d8e0c35d docs(libkernel): list a failed getloadavg next to Windows in vm.loadavg's debt entry
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 03:48:30 +00: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
ruby_scandxXPBSXx 55e1557a1f fix(libkernel): clear reported local address after UDP disconnect
Preserve the local port while reporting a wildcard address after a datagram association is dissolved. Share the state across descriptor aliases and clear it on a successful bind or reconnect.

Adapted from the fix branch linked in issue #8681, with expanded binding, reconnect and descriptor-alias regression coverage.

Co-authored-by: xXPBSXx <[email protected]>
2026-10-28 13:36:25 -03: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
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
simnJS 215192dd37 feat(libkernel_sys): answer sceKernelIsNeoMode from the param.sfo Neo-mode attribute
A title with param.sfo gets bit 23 (0x00800000) of its ATTRIBUTE key,
the PS4 Pro (Neo) mode support flag, and 0 without the key, as shadPS4
answers on a Neo console; sceKernelHasNeoMode and sceKernelIsAuthenticNeo
already report one. A title with param.json still throws: what a PS5
application gets is unknown. The param.sfo parser now reads ATTRIBUTE and
libkernel exposes it to the other libraries.
2026-10-28 14:10:21 +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