Commit Graph
257 Commits
Author SHA1 Message Date
Dean 55366489fb Merge pull request #7276 from T3cm0/bionic/coredump-exports
feat(libkernel): implement three coredump exports from the console module
2026-10-18 13:26:40 +13:00
Dean 3954aed289 Merge pull request #7289 from LaunchDoesntCode/fix/itimer-sigalrm-pending
fix(libkernel): leave a blocked SIGALRM expiry pending
2026-10-18 12:18:09 +13:00
Dean 51cee90311 Merge pull request #7295 from ionut27001/fix/libkernel-pshared-private-only
fix(libkernel): reject PTHREAD_PROCESS_SHARED as the PS5 does and add the missing pshared accessors
2026-10-18 12:02:32 +13:00
Dean fbb76ae3e6 Merge pull request #7095 from milescoviello/feat/sysarch-gsbase
feat(libkernel): read and set the GS base through sysarch
2026-10-18 11:18:15 +13:00
ionut27001andClaude Opus 5.5 c00c58ae34 fix(libkernel): reject PTHREAD_PROCESS_SHARED in pthread_condattr_setpshared and add pthread_condattr_getpshared
On a PS5 (firmware 12.70), of the values 0, 1, 2 and -1,
pthread_condattr_setpshared accepts only 0 and leaves the attribute
unchanged otherwise. pthread_condattr_getpshared reports 0 and returns
EINVAL for a null, uninitialized or destroyed attribute, also with a
null output. With an initialized attribute a null output crashes the
console; here it throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:50:09 +03:00
ionut27001andClaude Opus 5.5 bdf3adb379 feat(libkernel): add pthread_rwlockattr_getpshared and pthread_rwlockattr_setpshared
Measured on a PS5 (firmware 12.70): the getter reports 0, and of the
values 0, 1, 2 and -1 the setter accepts only 0 and checks the value
before the attribute. A null or uninitialized attribute, or a null
output, crashes the console; here it throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:50:09 +03:00
ionut27001andClaude Opus 5.5 db504f6b9c fix(libkernel): reject PTHREAD_PROCESS_SHARED in pshared setters as the PS5 does
On a PS5 (firmware 12.70), of the values 0, 1, 2 and -1,
pthread_spin_init, pthread_barrierattr_setpshared and
pthread_mutexattr_setpshared accept only PTHREAD_PROCESS_PRIVATE (0);
1, 2 and -1 return EINVAL and leave the attribute unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:49:58 +03:00
LaunchDoesntCodeandClaude Opus 5.5 1bc029da6d fix(libkernel): leave a blocked SIGALRM expiry pending
An ITIMER_REAL or alarm expiry while SIGALRM is blocked is marked on the
pending set of sigtimedwait instead of throwing, as kern_psignal leaves a
blocked signal pending. sigwait, sigwaitinfo and sigtimedwait take it,
repeated expiries merge into one pending signal, and unblocking it runs a
guest handler on the unblocking thread or, with the default disposition,
exits the process with status 142 as FreeBSD's default action does.

The expiry rechecks the mask after marking the signal, so an unblock that
races it does not leave SIGALRM pending while unblocked, and TakePending
clears the bit with the value it read so one signal is taken once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 16:22:59 -05:00
T3cm0andClaude Opus 5.5 70ff799fdb feat(libkernel): implement three coredump exports from the console module
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 16:17:05 -05:00
Dean af7972ce91 Merge pull request #7229 from nicolasfalesy/feat/libkernel-export-nmount
feat(libkernel): export nmount
2026-10-18 10:10:15 +13:00
Dean a3d2f6ef50 Merge pull request #7225 from nicolasfalesy/feat/libkernel-condattr-setpshared
feat(libkernel): implement pthread_condattr_setpshared
2026-10-18 10:09:16 +13:00
Dean dacd2e991c Merge pull request #7151 from Bonjourcestmatt/fix/socket-type-eprototype
fix(libkernel): return EPROTOTYPE for a socket type inet does not have
2026-10-18 09:51:50 +13:00
Dean 084bd39a08 Merge pull request #7133 from pushkarreddyy/fix/libkernel-write-throttling-null-efault
fix(libkernel): return EFAULT from sceKernelWriteThrottlingStatus for a null status
2026-10-18 09:45:24 +13:00
Dean 64df590f4c Merge pull request #7076 from AlexOfTheForest/fix/socket-write-space
fix(libkernel): report free send space for socket write events on Linux
2026-10-18 09:44:37 +13:00
Dean b95768d1b0 Merge pull request #6540 from JJenkx/fix/kernel-cpuset-thread-id
feat(libkernel): support cpuset affinity by guest thread ID
2026-10-18 09:43:55 +13:00
milescovielloandClaude Opus 5.5 d7c83db2a5 feat(libkernel): read and set the GS base through sysarch
sysarch's AMD64_GET_FSBASE, AMD64_GET_GSBASE and AMD64_SET_GSBASE now
follow FreeBSD 11's amd64 sysarch on Linux x86-64 through arch_prctl: the
GS base is the calling thread's, a base at or above VM_MAXUSER_ADDRESS
returns EINVAL and a null argument EFAULT. AMD64_SET_FSBASE, whose base
guest and host code share for their TLS, other operations and other hosts
still throw. Wine sets its TEB this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 20:43:32 +00:00
Dean e0045fb6ef Merge pull request #6518 from qpavyros/codex/mutexattr-invalid-attributes
fix(libkernel): return EINVAL for invalid mutex priority attributes
2026-10-18 09:41:01 +13:00
Dean b5e570d06a Merge pull request #7092 from milescoviello/fix/kevent-note-lowat
fix(libkernel): take NOTE_LOWAT on socket read and write events
2026-10-18 09:40:43 +13:00
Nicolas FalesyandClaude Opus 5.5 1ffffc318d feat(libkernel): export nmount
Prospero Themes (PPSA90210) imports nmount (3YnXspQNyw8) from libkernel
and fails to load without it:
"./app.elf: symbol lookup error: ./app.elf: undefined symbol: 3YnXspQNyw8".

Mounting file systems is not supported, so it throws if called, like
execvp does for executable replacement. The title opens its theme
library without calling it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sovthwyu4H63RMbRVha2Sy
2026-10-17 14:08:53 -04:00
Nicolas FalesyandClaude Opus 5.5 05b457d49a feat(libkernel): implement pthread_condattr_setpshared
PSFlyCast (PPSA99247) imports pthread_condattr_setpshared (3BpP850hBT4)
from libkernel and fails to load without it:
"./app.elf: symbol lookup error: ./app.elf: undefined symbol: 3BpP850hBT4".

The attribute stores PTHREAD_PROCESS_PRIVATE (0) or
PTHREAD_PROCESS_SHARED (1); a null or uninitialized attribute and any
other value return EINVAL without changing it, following FreeBSD 11
libthr thr_condattr.c and pthread_mutexattr_setpshared here. Sharing
across processes is not modeled, as for mutexes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sovthwyu4H63RMbRVha2Sy
2026-10-17 14:06:11 -04:00
mattogepetoandClaude Opus 5.5 8f0caa1796 docs(libkernel): move the socket type debt entry away from other changes
The entry sat right after "connect to AF_UNSPEC", where the open #6884 adds
its own entry, so whichever merges second would conflict. Move it after the
mlockall entry, which no open pull request changes. The text is unchanged.

Written with AI assistance (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 16:41:52 +02:00
mattogepetoandClaude Opus 5.5 a6c123ca4a fix(libkernel): return EPROTOTYPE for a socket type inet does not have
socket() returned EPROTONOSUPPORT for every socket type it does not create.
FreeBSD 11.4's socreate returns EPROTOTYPE when no protocol is found, the
protocol is 0 and the type is not 0, and EPROTONOSUPPORT when a protocol was
given. Its inet domain (in_proto.c) has SOCK_RAW entries in every kernel and
a SOCK_SEQPACKET entry only with SCTP, and no SOCK_RDM or other type.

Return EPROTOTYPE for a type the inet domain never has, such as SOCK_RDM,
with protocol 0. SOCK_RAW and SOCK_SEQPACKET keep EPROTONOSUPPORT, since
whether the console creates them is not known. Test the unknown types and
mismatched protocols for AF_INET and AF_INET6, and list the socket types and
families that are not created in the library's technical debt file.

Written with AI assistance (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 16:00:45 +02:00
pushkarreddyy a295b771eb fix(libkernel): return EFAULT from sceKernelWriteThrottlingStatus for a null status 2026-10-17 18:31:54 +05:30
milescovielloandClaude Opus 5.5 91fbafd94a fix(libkernel): keep refusing a read low-water mark above 1 on non-stream sockets
On Linux, FIONREAD on a datagram socket reports the next datagram only,
where FreeBSD's sbavail counts every queued byte, so a read mark above 1
there could never fire. kevent now throws for it as before; stream
sockets and marks of 1 are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 11:20:03 +00:00
milescovielloandClaude Opus 5.5 e1d4ccba49 fix(libkernel): take NOTE_LOWAT on socket read and write events
kevent threw for NOTE_LOWAT. On a socket's EVFILT_READ it now sets the
low-water mark as FreeBSD 11's filt_soread does: the event fires once the
buffered bytes reach it, or at end of file or on a listening socket, and
a later change of the knote replaces it. EVFILT_WRITE takes a mark of 1,
where the host's writability stands in for a free byte; other write marks
and marks below 1 still throw. A pipe ignores the mark, as filt_piperead
does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:58:41 +00:00
Alexej Szpevák f2d3980f5e fix(libkernel): report free send space for socket write events on Linux
A socket's EVFILT_WRITE and sceKernelAddWriteEvent reported the whole SO_SNDBUF in data, however much was already queued. FreeBSD 11.4's filt_sowrite reports sbspace, the space still free. On Linux the queued bytes from SIOCOUTQ are now taken off SO_SNDBUF. Windows has no query for the queued bytes and macOS is not wired up, so both keep reporting SO_SNDBUF; the debt entry says so.
2026-10-17 12:28:11 +02:00
Alexej Szpevák 41ec785705 fix(libkernel): answer F_GETLK with F_UNLCK on Linux and macOS
fcntl threw for F_GETLK with an F_UNLCK request on the hosts that use POSIX locks, as Linux's F_GETLK rejects that type. FreeBSD 11.4's kern_fcntl accepts it and lf_getlock reports the first overlapping lock that lf_blocks lets conflict: another owner's lock, one of the two being a write lock. For an F_UNLCK request that is exactly another owner's write lock, the same set an F_RDLCK request finds, so the host is asked with F_RDLCK and the reply is written back as for the other types.
2026-10-17 12:00:21 +02:00
Adrià 8730dde45f Merge pull request #5973 from pipe1os/feat/libkernel-kevent-pipe-read
feat(libkernel): support EVFILT_READ on the read end of a pipe
2026-10-17 06:53:33 +02:00
Dean dbcb802e15 Merge pull request #6750 from LeandroLP23/docs/debt-thread-priority-gap
docs(debt): record that guest thread priorities are not applied to host threads
2026-10-17 16:46:01 +13:00
Dean dfdc3dec4d Merge pull request #5280 from santhoshkumar-dev/codex/sandbox-ca-trust
feat(libkernel): serve the sandbox CA bundle from host TLS roots
2026-10-17 16:35:44 +13:00
Dean f99f3d1dca Merge pull request #6694 from MarcZX100/codex/coredump-config-dump-mode-6688
fix(libkernel): export sceCoredumpConfigDumpMode as an explicit stub
2026-10-17 16:34:12 +13:00
Santhosh Kumar eb26fb97f8 fix(libkernel): filter sandbox TLS roots and preserve path overrides 2026-10-17 02:25:41 +00:00
screammandClaude Fable 5.1 9f4a8d6ec5 feat(libkernel): serve the console CA list from the host trust store
Titles that bundle OpenSSL load the console's CA file from the sandbox
directory and fail every HTTPS request without it. ProsperoRadio
(PPSA99001, libcurl 8.18.0 + OpenSSL 3.5.2) on main + #4796 + #4525:

  [ProsperoRadio][http] https://all.api.radio-browser.info/json/servers: Problem with the SSL CA cert (path? access rights?) (error adding trust anchors from file: /gkbHtXc3Wq/common/cert/CA_LIST.cer)

SwanStation (PPSA98510) stops on the same file (#5001).

The guest path resolver now accepts exact-path providers, and libkernel
registers one for /<sceKernelGetFsSandboxRandomWord()>/common/cert/CA_LIST.cer.
On first use it writes a PEM bundle once per process to
cert_cache/CA_LIST.cer in the run directory, read-only: on Windows the
current user's ROOT and CA system stores, elsewhere SSL_CERT_FILE or the
first distro bundle that exists. Without a certificate the path keeps
resolving under the guest root and does not exist, as before. Every other
path under the sandbox word is unchanged. The console file's format and
the rest of its common/cert directory are unverified and recorded in
docs/dev/debt/libkernel.md.

With this change, #4796, #4525 and #5025 on Windows 11, 60 s each:

  [ProsperoRadio][http] 11846160 bytes in 1458 ms: 1161 passes, 803 waits (679 woken) for 1428 ms
  [ProsperoRadio][catalog] page offset=0 bytes=11846160 objects=10000 accepted=9549 total=9549
  ...
  [ProsperoRadio][catalog] page offset=60000 bytes=1712035 objects=1494 accepted=1436 total=59371

  [SwanStationPS5] update: latest 1.2.5, this 1.1.3, available
  [SwanStationPS5] gamedb: index written

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-17 02:24:02 +00:00
Dean 72a848ca52 Merge pull request #4533 from Roojool/contrib/g07-pthread-getname
fix(libkernel): answer pthread_getname_np for a joined thread with ESRCH
2026-10-17 13:05:38 +13:00
Adrià 2fab88d102 Merge pull request #5945 from ErenYeager1836/feat/libkernel-sysctl-pagesize
feat(libkernel): report hw.pagesize through sysctl and sysctlnametomib
2026-10-16 22:31:11 +02:00
Adrià 93eca8f7be Merge pull request #5902 from pushkarreddyy/feat/libkernel-setrlimit-nofile
feat(libkernel): allow lowering rlim_cur for RLIMIT_NOFILE in setrlimit
2026-10-16 21:54:11 +02:00
Adrià bafd3227a6 Merge pull request #5901 from KernelPanicNT/feat/libkernel-coredump-thread-context-info
feat(libkernel): answer sceCoredumpGetThreadContextInfo outside the coredump handler
2026-10-16 21:54:05 +02:00
Adrià bc9833e39b Merge pull request #5887 from leorossi2005/feat/libkernel-umtx-microsecond-timeout
feat(libkernel): support microsecond timeout in size-0 _umtx_op
2026-10-16 21:43:51 +02:00
Adrià FranchandClaude 825b7934e7 docs(debt): cite FreeBSD's hw.pagesize OID, note the unmeasured PS5 value
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-16 20:55:50 +02:00
Nithishvelan M 76e05544a9 feat(libkernel): report hw.pagesize through sysctl and sysctlnametomib 2026-10-16 20:55:46 +02:00
Alexej Szpevák d97d6efb1b fix(libkernel): refuse descriptor calls on app0.zar files
flock, fstatfs, ftruncate, fsync, fdatasync, getdirentries, fchmod, futimes and mmap on an archived descriptor acted on its null device and succeeded or failed with an unrelated errno. They now throw NotImplemented, each covered by the kernel archive test; mmap is noexcept, so its refusal is checked through the terminate handler.
2026-10-16 20:03:32 +02:00
Alexej Szpevák 9b911ed510 feat(libkernel): serve app0.zar files through the file calls
sceKernelOpen and open give an archived file a read-only null-device descriptor. Reads, positioned, vectored and AIO reads, seeks, fstat and FIONREAD are served from the archive; dup, dup2 and F_DUPFD share the position. sceKernelStat and sceKernelCheckReachability see archived paths.

Writing opens fail with EROFS, O_CREAT|O_EXCL with EEXIST and O_DIRECTORY on a file with ENOTDIR. Opening an archived directory or one merged with the disk throws until getdents can list it.
2026-10-16 20:03:32 +02:00
pushkarreddyy 2de10e35ff feat(libkernel): allow lowering rlim_cur for RLIMIT_NOFILE in setrlimit 2026-10-16 20:33:46 +05:30
LeandroLP23andClaude Opus 5.5 10e5b42ea9 docs(debt): record that guest thread priorities are not applied to host threads
The sched_get_priority_max/min entry was rewritten by each fix that
matched a PS5 measurement, until it described only behaviour that now
matches the console. What remains is the gap no entry named: the
priorities are recorded and reported but never reach the host
scheduler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:33:28 +02:00
TamaleroandClaude Opus 5.5 ae5046eeb2 feat(libkernel): add sceCoredumpConfigDumpMode as a throwing stub
PPSA16833 imports it from libkernel, and its executable does not load
while no library exports the NID. The signature is unknown, so it throws
if called, like sceCoredumpWriteUserString.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:57:24 -07:00
Felipe Arce 46d49131e7 feat(libkernel): support EVFILT_READ on the read end of a pipe
kevent threw for any descriptor that is not a guest socket. The read end
of a pipe now gets the descriptor knote, following FreeBSD 11's
filt_piperead: data is the number of buffered bytes and EV_EOF is set
once the write end is closed. GuestSockets::Ready falls back to the new
PipeReadState for a descriptor that is not a socket, and WaitAny waits on
the pipe with ppoll on Linux or in 1 ms WSAPoll slices on Windows, only
when the queue holds a pipe. On Windows the equeue waker now starts
Winsock itself, since a queue can wait on a pipe before any socket exists.
2026-10-15 21:56:19 +00:00
Adrià f35c13fc95 Merge pull request #5833 from Ondra97/codex/fix-windows-vector-io-lock
fix(libkernel): serialize Windows vectored file transfers
2026-10-15 23:15:38 +02:00
Adrià f27697f083 Merge pull request #5847 from akkadbakkad89/feat/kevent-ev-flags
feat(libkernel): implement kevent EV_DISABLE, EV_DISPATCH and EV_FORCEONESHOT
2026-10-15 23:01:10 +02:00
JJenkx 7777219ee1 feat(libkernel): support cpuset affinity by guest thread ID 2026-10-15 15:25:34 -04:00
Codex ced0305455 fix(libkernel): return EINVAL for invalid mutex priority attributes 2026-10-15 21:34:35 +03:00