Commit Graph
318 Commits
Author SHA1 Message Date
Dean Galvin 2f45a312d0 Merge main into fix/setrlimit-nproc 2026-10-23 15:50:49 +13:00
Dean 5c8e38018d Merge pull request #8986 from MarcZX10/codex/getrlimit-pointer-safety
fix(libkernel): check getrlimit output pointers
2026-10-23 15:46:51 +13:00
Dean 39e971a2ea Merge pull request #8985 from MarcZX10/codex/groups-pointer-safety
fix(libkernel): return EFAULT for invalid group pointers
2026-10-23 14:05:39 +13:00
Dean 895f47f4ee Merge pull request #8866 from ycbuzi/feat/libkernel-sigintr
feat(libkernel): export _sigintr and let signal honour it
2026-10-23 12:19:08 +13:00
Dean 8964c12d5c Merge pull request #9218 from slopggobblercobbler81/feat/libkernel-setresuid-setresgid
feat(libkernel): implement setresuid and setresgid
2026-10-23 11:10:12 +13:00
Dean fe8b9b5ddd Merge pull request #8906 from hypermoist/fix/coredump-set-user-data-type
fix(libkernel): give sceCoredumpSetUserDataType its signature and result
2026-10-23 09:41:20 +13:00
Dean 2369fdd77a Merge pull request #8539 from billythemenace2/fix/kernel-raise-host-code-limit
fix(libkernel): retry a failed thread context read during a raise
2026-10-22 17:59:55 +13:00
hypermist 1f8d4769b4 Merge remote-tracking branch 'upstream/main' into fix/coredump-set-user-data-type
# Conflicts:
#	core/libs/prx/libkernel/System/src/Coredump.cpp
#	core/libs/tests/GuestCoredumpUserData.cpp
2026-10-22 15:54:42 +13:00
blu c08e752fef Merge branch 'boykopovar:main' into feat/libkernel-sigintr 2026-10-21 19:03:58 -07:00
boykopovar f4447aa252 fix(kernel): restore coredump registration and file flag validation 2026-10-21 21:55:33 +03:00
boykopovar b9fb0d2897 fix(kernel): restore signed coredump attachment lengths 2026-10-21 21:55:32 +03:00
boykopovar ee76c0cd98 fix(kernel): restore coredump buffer validation and data type argument 2026-10-21 21:55:30 +03:00
Adrià b4d10586ef Merge pull request #8411 from xXPBSXx/fix/sigaction-reject-undefined-flags
fix(libkernel): reject undefined sa_flags in sigaction with EINVAL
2026-10-21 20:10:35 +02:00
Adrià e09b022ea9 Merge pull request #8407 from xXPBSXx/fix/sigprocmask-never-block-kill-stop
fix(libkernel): never block SIGKILL and SIGSTOP in sigprocmask and sigsuspend
2026-10-21 20:08:51 +02:00
slopggobblercobbler81 d28c74af94 feat(libkernel): implement setresuid and setresgid
Follow FreeBSD 11.4 sys_setresuid and sys_setresgid (sys/kern/kern_prot.c):
accept real, effective, and saved user and group IDs for the guest process,
which is assumed to run as root with IDs 0. Setting an ID to 0 or -1 (unchanged)
is accepted without changing credentials and returns 0; any other value throws.
Cover both in guest_credentials test and update libkernel debt documentation.
2026-10-21 17:25:25 +02:00
MarcZX10 29d50d189e fix(libkernel): check getrlimit output pointers 2026-10-21 08:38:01 +00:00
MarcZX10 67db9d371f test(libkernel): cover invalid group credential pointers 2026-10-21 08:31:59 +00:00
MarcZX10 91b2911ca1 fix(libkernel): check guest pointers in group credentials 2026-10-21 08:31:44 +00:00
MarcZX10 afc7e26ce9 fix(libkernel): return EFAULT for invalid getresid pointers 2026-10-21 08:08:35 +00:00
hypermistandClaude Opus 5.5 c680e28f4f fix(libkernel): give sceCoredumpSetUserDataType its signature and result
The call threw for lack of a signature. In the PS5 12.00 libkernel it takes
one int, passes it to syscall 601 (command 29) and returns the raw kernel
result. No dump is produced here, so it returns 0, as
sceCoredumpConfigDumpMode does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 18:28:51 +13:00
slopggobblercobbler81 aab806939e feat(libkernel): implement getresuid and getresgid
Follow FreeBSD 11.4 sys_getresuid and sys_getresgid (sys/kern/kern_prot.c):
retrieve real, effective, and saved user and group IDs for the guest process,
which is assumed to run as root with IDs 0. Pointers that are not null receive 0,
null pointers are ignored, and 0 is returned leaving errno unchanged on success.
Cover both in guest_credentials test and update libkernel debt documentation.
2026-10-21 06:56:42 +02:00
bluandClaude Fable 5.1 e38179eaab feat(libkernel): export _sigintr and let signal honour it
The public SDK's libkernel, libkernel_sys and libkernel_web stub tables declare _sigintr, the
sigset_t that FreeBSD's libc shares between signal and siginterrupt, and no built library
provided it (#8846). libkernel now exports the 16-byte object, zero at start, and signal records
a handler with SA_RESTART unless its signal is in the set, as lib/libc/gen/signal.c does.

siginterrupt, which fills the set, is a libSceLibcInternal export; libc does not link libkernel
and cannot reach the dispositions, so it stays out and a debt entry for signal says so.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-20 20:41:54 -07:00
Dean cd700fe9ec Merge pull request #8793 from xXPBSXx/fix/pthread-kill-ended-thread-esrch
fix(libkernel): let pthread_kill with signal 0 report ESRCH for a thread that has ended
2026-10-21 15:27:29 +13:00
Dean c5d841ed94 Merge pull request #8732 from DoubleAAGuy/feat/libkernel-osreldate-sysctl
feat(libkernel): expose kern.osreldate sysctl
2026-10-21 14:27:39 +13:00
xXPBSXxandClaude Sonnet 5.5 79569a7a3d fix(libkernel): let pthread_kill with signal 0 report ESRCH for a thread that has ended
pthread_kill(thread, 0) returned 0 for every handle other than the caller's before it asked whether the thread was still alive. FreeBSD's _pthread_kill looks the thread up with _thr_find_thread before it checks for signal 0, so the call answers ESRCH for a thread that has ended or was never a thread. The liveness check now runs before the signal 0 shortcut; the calling thread still answers 0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-21 02:29:54 +02:00
Dean da5ea87cd6 Merge pull request #8455 from hypermoist/feat/libkernel-create-uuid-v4
feat(libkernel): implement sceKernelCreateUuidV4
2026-10-21 13:11:28 +13:00
Dean f41c5bef2b Merge pull request #8637 from billythemenace2/fix/kernel-raise-system-call-wait
fix(libkernel): keep waiting while a raise target is inside a system call
2026-10-21 13:11:08 +13:00
Hermes Agent 0273c1479f feat(libkernel): expose kern.osreldate sysctl 2026-10-20 18:29:40 -04:00
Dean 5e113d91f9 Merge pull request #8414 from xXPBSXx/fix/raise-signal-zero
fix(libkernel): let raise(0) check the calling thread and return 0
2026-10-21 09:03:51 +13:00
billythemenace2andClaude Opus 5.5 681926e085 fix(libkernel): keep waiting while a raise target is inside a system call
Since #8512 a raise redirects a target running host code once 50 ms have
passed since the raise began. A target inside a system call that is not a
wait, such as the NtWriteFile of an fwrite that holds its stream lock, can
stay there longer; the redirect then ran the handler with the lock held.
SONIC SUPERSTARS froze at frame 67 again on main this way, with its GC
raise delivered at ntdll!ZwWriteFile+20.

A target stopped right after a syscall instruction in ntdll now restarts
the 50 ms host-code window, so the raise keeps sampling until the call
returns and the target leaves host code, bounded by the 1 s retry limit.
guest_raise_in_system_call holds a writer in NtWriteFile on a slowly
drained pipe; it times out on main and passes with this change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-20 20:35:36 +01:00
billythemenace2andClaude Opus 5.5 e5b66f2ddf fix(libkernel): retry a failed thread context read during a raise
GetThreadContext can fail on a target that was just suspended. A raise
used to throw "cannot read the target thread context" at the first
failure; it now resumes the target and tries again, within the existing
1 s retry limit, before throwing. SONIC SUPERSTARS hit the throw once in
three runs. guest_raise_in_host_code prints the longest single raise.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-20 20:12:28 +01:00
Dean 78e398d6d0 Merge pull request #8467 from xXPBSXx/fix/raise-default-ignored-signals
fix(libkernel): let raise and kill return 0 for ignored signals
2026-10-21 07:18:46 +13:00
Dean eae6e0162f Merge pull request #8512 from oneandonlydean/fix/7652-host-raise-patience
fix(libkernel): bound the raise wait on host code to 50 ms
2026-10-21 07:00:13 +13:00
elieh999 bb396009e0 fix(libkernel): store the process resource limit 2026-10-20 18:01:27 +03:00
Dean Galvin 5be6c2a074 fix(libkernel): bound the raise wait on host code to 50 ms
Follow-up to #7652. A raise on a thread running host code waited up to the
1 s RetryLimit before falling back, so Windows guest_raise_exception (about
220 host-resident raises) went from ~15 s to 17-30 s. Host code now has its
own HostCodeLimit of 50 ms; RetryLimit still guards NtContinue and winpthreads.
2026-10-21 03:12:33 +13:00
xXPBSXxandClaude Sonnet 5.5 12ec674d88 fix(libkernel): let raise and kill return 0 for ignored signals
A signal that is ignored is forgotten when it is sent: the call succeeds
(sys/kern/kern_sig.c:2178-2187). That covers SIG_IGN and the signals whose
default action is SA_IGNORE, SIGURG, SIGCONT, SIGCHLD, SIGIO, SIGWINCH and
SIGINFO (kern_sig.c:205-240); SIGCONT stays pending while blocked. The guest
failed with EINVAL for every such signal that has no host equivalent.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 15:35:11 +02:00
hypermistandClaude Opus 5.5 5bfb6c7e63 feat(libkernel): implement sceKernelCreateUuidV4
Fill 16 random bytes and set the version 4 and RFC 4122 variant bits in
bytes 6 and 8, as libkernel does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 01:51:56 +13:00
xXPBSXxandClaude Sonnet 5.5 78c79de242 fix(libkernel): let raise(0) check the calling thread and return 0
FreeBSD 11.4 raise is thr_kill(thr_self(), sig) (lib/libc/gen/raise.c:52),
and thr_kill with a thread id treats signal 0 as a pure existence check
that returns 0 (sys/kern/kern_thr.c:425). The guest returned EINVAL.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:22:18 +02:00
xXPBSXxandClaude Sonnet 5.5 529c1a0f51 fix(libkernel): reject undefined sa_flags in sigaction with EINVAL
FreeBSD 11.4 kern_sigaction fails with EINVAL when a handler other than
SIG_DFL and SIG_IGN comes with flags outside SA_ONSTACK, SA_RESTART,
SA_RESETHAND, SA_NOCLDSTOP, SA_NODEFER, SA_NOCLDWAIT and SA_SIGINFO
(sys/kern/kern_sig.c:691-695). The guest accepted any flag word.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:16:18 +02:00
xXPBSXxandClaude Sonnet 5.5 25a8636b50 fix(libkernel): never block SIGKILL and SIGSTOP in sigprocmask and sigsuspend
FreeBSD 11.4 kern_sigprocmask applies SIG_CANTMASK to the set for SIG_BLOCK
and SIG_SETMASK (sys/kern/kern_sig.c:1056, 1067), and sigsuspend sets its
mask through the same call (kern_sig.c:1534). The guest mask kept both bits,
so sigprocmask(SIG_BLOCK, {SIGKILL}) read back as blocked.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:04:06 +02:00
ionut27001andClaude Opus 5.5 dfa96f1fe6 fix(libkernel): return ENOENT for thirteen sysctl names, as measured on a PS5
In a payload process on a PS5 (firmware 12.70), sysctlbyname returns -1
with ENOENT for thirteen names that threw here, and leaves the buffer and
the length alone, for a read, a size query, a null length and a null
buffer with a null length. sysctl does the same for the fixed MIBs of
seven of them. sysctlnametomib gives those seven MIBs and returns ENOENT
for hw.cacheline_size and hw.usermem, which threw too.

machdep.cacheline_size already returned ENOENT and is now tested with
the others. A write to the new names and MIBs throws, as the console's
answer to a write was not tried. The hw.realmem and vm.overcommit debt
entries now say that a payload process gets ENOENT for them as well.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:46:29 +02:00
Adrià b9a097353c Merge pull request #7556 from MarcZX10/codex/libkernel-sysctl-mib-enoent
fix(libkernel): return ENOENT for measured absent sysctl MIBs
2026-10-20 13:23:08 +02:00
Adrià 437de6392f Merge pull request #7652 from billythemenace2/fix/kernel-raise-outside-host-code
fix(libkernel): redirect a raise only once the target leaves host code
2026-10-20 13:16:49 +02:00
MarcZX100 7b05271abb fix(libkernel): support kern.rng_pseudo MIB access 2026-10-20 12:29:39 +02:00
Adrià 9299e6fd8a Merge pull request #7542 from ionut27001/fix/libkernel-rng-pseudo-block
fix(libkernel): return kern.rng_pseudo in 64-byte blocks as measured on a PS5
2026-10-20 12:24:51 +02:00
MarcZX10 e054c83eea Merge upstream main into measured absent sysctl MIBs 2026-10-20 10:12:56 +00:00
Dean cb3f18fda8 Merge pull request #7940 from pushkarreddyy/feat/libkernel-setgid
feat(libkernel): implement setgid
2026-10-20 17:05:47 +13:00
Adrià ad80f5f967 Merge pull request #7655 from farosch/main
feat(libkernel): log guest exception context
2026-10-20 02:28:16 +02:00
Adrià 5253446882 Merge pull request #7543 from ionut27001/fix/libkernel-getrlimit-console
fix(libkernel): report the getrlimit values measured on a PS5 for RLIMIT_STACK, RSS, MEMLOCK and NPROC
2026-10-20 02:07:39 +02:00
Adrià 5158970e85 Merge pull request #7521 from Myrarc/fix/sigtimedwait-deadline
fix(libkernel): preserve sigtimedwait deadline across wakeups
2026-10-20 01:17:59 +02:00