Commit Graph
266 Commits
Author SHA1 Message Date
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
Adrià a77e40f93f Merge pull request #7070 from milescoviello/feat/kern-proc-vmmap
feat(libkernel): report the guest address-space map through kern.proc.vmmap
2026-10-19 19:36:11 +02:00
ionut27001andClaude Opus 5.5 ad9772edd1 fix(libkernel): report the getrlimit values measured on a PS5 for RLIMIT_STACK, RSS, MEMLOCK and NPROC
In a payload process on a PS5 (firmware 12.70), getrlimit returns
0x200000 for RLIMIT_STACK, infinity for RLIMIT_RSS and RLIMIT_MEMLOCK,
and 1604 for RLIMIT_NPROC, each as both soft and hard limit. These four
threw here. Whether a title process reads the same limits is not
measured.

setrlimit reads getrlimit first, so it now accepts RLIMIT_STACK,
RLIMIT_RSS and RLIMIT_MEMLOCK when the values do not change, as the
payload process does. RLIMIT_NPROC throws: in the payload process
setting it to its current value succeeds, but getrlimit then reads 1443,
and the limit is not stored here. Any other change still throws. The
getrlimit and setrlimit debt entries also record the payload process's
RLIMIT_DATA and RLIMIT_NOFILE readings, its 12555 clamp of RLIMIT_NOFILE
and its RLIMIT_NPROC reading after a same-value set.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 18:21:34 +02:00
Adrià a4440ed938 Merge pull request #6945 from MarcZX10/codex/carry-alarm-range
fix(libkernel): reject alarm seconds beyond the itimer range
2026-10-19 16:38:41 +02:00
Dean 8982791bc3 Merge pull request #7654 from ionut27001/fix/libkernel-sysarch-i386-bases
fix(libkernel): answer sysarch I386_GET_FSBASE, I386_GET_GSBASE and undefined operations as measured on a PS5
2026-10-20 01:22:09 +13:00
Adrià 62e946f114 Merge pull request #6833 from ErenYeager1836/feat/libkernel-sysconf-limits
feat(libkernel): support _SC_ARG_MAX, _SC_OPEN_MAX and _SC_IOV_MAX in sysconf
2026-10-19 13:37:44 +02:00
Adrià 347c0a7934 Merge pull request #6420 from JJenkx/feat/kernel-error-conversion-upstream
feat(libkernel): convert guest POSIX error values
2026-10-19 02:40:46 +02:00
Faryan Rezagholi cdccc34523 feat(libkernel): log guest exception context 2026-10-18 22:26:45 +02:00
Adrià b8cd204a3f Merge pull request #6220 from DavidSamir/fix/libkernel-sysctl-kern-ostype
feat(libkernel): answer the uname sysctl names
2026-10-18 21:56:01 +02:00
Adrià 4b4385cb7f Merge pull request #6201 from bruceblake/libkernel-getdtablesize
feat(libkernel): implement getdtablesize
2026-10-18 21:26:33 +02:00
ionut27001 bd22a701f5 fix(libkernel): answer sysarch I386_GET_FSBASE, I386_GET_GSBASE and undefined operations as measured on a PS5
In a payload process on a PS5 (firmware 12.70), I386_GET_FSBASE (7) and
I386_GET_GSBASE (9) wrote 4 bytes, the low 32 bits of the FS and GS
bases, and failed with EFAULT for a null argument; both threw here. On
Linux x86-64 hosts they now do the same.

The nine operation numbers tried that FreeBSD 11's amd64 sysarch has no
case for (2, 5, 6, 12, 127, 133, 134, 1000 and -1), each with a null
argument, failed with EINVAL there, as its default case does, and threw
here. Every such number now returns EINVAL on every host.

Threads made with pthread_create and scePthreadCreate started with their
creator's GS base there; the test now checks that a guest thread does so
on Linux. The sysarch debt entry records these measurements and what
AMD64_GET_XFPUSTATE and I386_GET_XFPUSTATE returned there; both still
throw here.
2026-10-18 22:25:09 +03:00
Hussein Kadhim b3522206cb fix(libkernel): reject alarm seconds beyond the itimer range
FreeBSD alarm() is setitimer(ITIMER_REAL), and setitimer fails with EINVAL
for it_value.tv_sec above INT32_MAX / 2, so alarm() returns -1 and leaves
the pending alarm alone. alarm(UINT_MAX) armed an alarm decades away and
returned the old remaining time instead.

(cherry picked from commit 2dea16d07d4e0b36e4a3d1eebe3b5c3ffb739807)
2026-10-18 15:06:37 +00:00
Myrarc cd0a067031 fix(libkernel): preserve sigtimedwait deadline across wakeups 2026-10-18 18:35:11 +07:00
milescovielloandClaude Opus 5.5 8cd9c1d310 fix(libkernel): fail sigprocmask with EINVAL for an unknown how
sigprocmask and _sigprocmask threw std::invalid_argument for a how other
than SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK, which ends the title. FreeBSD
returns -1 with EINVAL and leaves the old mask uncopied, and ignores how
when set is null; pthread_sigmask here already returns EINVAL. The check
now comes first, before the previous mask is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:37:39 +00:00
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
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
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
milescovielloandClaude Opus 5.5 20764888c3 feat(libkernel): report the guest address-space map through kern.proc.vmmap
sysctl {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, pid} for the calling process
returns packed FreeBSD 11 kinfo_vmentry records, one per used range of the
guest arena, with the protection sceKernelVirtualQuery reports. Other pids
return ESRCH, a write EPERM, a short buffer ENOMEM. GuestArena gains a
query for the used range at or after an address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 20:43:31 +00:00
Dean 12a71f3f59 Merge pull request #7032 from milescoviello/fix/getitimer-cpu-timers-zero
fix(libkernel): read ITIMER_VIRTUAL and ITIMER_PROF as disarmed in getitimer
2026-10-18 00:23:45 +13:00
milescovielloandClaude Opus 5.5 9f704dc1eb fix(libkernel): read ITIMER_VIRTUAL and ITIMER_PROF as disarmed in getitimer
setitimer refuses to arm the CPU interval timers and already reads and
disarms them as zero, so they are never armed. getitimer threw for them
instead of reporting that state, as FreeBSD's kern_getitimer does for a
timer that is not set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 06:17:58 +00:00
milescovielloandClaude Opus 5.5 01c8cebf8c fix(libkernel): return EINVAL/EFAULT from getrusage instead of throwing
FreeBSD's getrusage rejects an unknown `who` with EINVAL before it
copies anything out and returns EFAULT when the result can't be
written. The HLE threw std::invalid_argument for both, which ends the
title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 06:10:58 +00: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
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
Nithishvelan M 76e05544a9 feat(libkernel): report hw.pagesize through sysctl and sysctlnametomib 2026-10-16 20:55:46 +02:00
Nithishvelan M 301fdbe923 feat(libkernel): return getrlimit soft limit for _SC_OPEN_MAX in sysconf 2026-10-16 23:17:43 +05:30
pushkarreddyy 2de10e35ff feat(libkernel): allow lowering rlim_cur for RLIMIT_NOFILE in setrlimit 2026-10-16 20:33:46 +05:30
Nithishvelan M 2e4f63b816 feat(libkernel): support _SC_ARG_MAX, _SC_OPEN_MAX and _SC_IOV_MAX in sysconf 2026-10-16 19:14:09 +05:30
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
Bruce Blake 873fbe99aa fix(libkernel): cap getdtablesize at the host descriptor table size
On macOS the RLIMIT_NOFILE soft limit is not a bound on the descriptor table: setrlimit accepts soft limits above kern.maxfilesperproc, RLIM_INFINITY included, and getrlimit reports what was set, so returning the guest soft limit alone could report up to INT_MAX for a table of about 122880 descriptors, and a closefrom-style loop up to that value would run billions of iterations instead of about 122k. Return the smaller of the guest soft limit and the host's ::getdtablesize(), which is the FreeBSD sys_getdtablesize result. The guest test derives its expectation from the host call instead of the implementation's formula, and the debt entry no longer claims the limit is raised when libkernel loads outside Linux. Reported by jotitadev in review of the getdtablesize implementation.
2026-10-15 10:35:04 -04:00
JJenkx c2f375fb63 feat(libkernel): convert guest POSIX error values 2026-10-15 10:34:39 -04:00
Adrià Franch 0a7193b5cd fix(libkernel): sigsuspend swaps and restores all four mask words 2026-10-15 13:54:05 +02:00
MarcZX100 e168591c19 fix(libkernel): honor all guest signal mask words 2026-10-15 13:52:40 +02:00
David 0bd254fafd feat(libkernel): accept the uname names in sysctlbyname and sysctlnametomib
Both map kern.ostype, kern.osrelease, kern.version, kern.hostname and hw.machine to their MIBs, as they do for the other names sysctl serves.
2026-10-15 08:38:53 +04:00
David 0b058c88a7 feat(libkernel): answer the uname sysctl names
uname reads kern.ostype, kern.hostname, kern.osrelease, kern.version and
hw.machine through sysctl. Super Mario Sunshine (PPSA99312) stopped on the
first, "sysctl_nid_postfix: unsupported MIB 1.1". sysctl now serves the five
as read-only strings: FreeBSD 11.4-RELEASE's values for the type, release and
version, the host name gethostname reports, and amd64. A new value returns
EPERM as for the other read-only names, and a trailing name component returns
ENOTDIR.
2026-10-15 08:25:01 +04:00
Bruce Blake b6c9bd7f33 feat(libkernel): implement getdtablesize
Return the RLIMIT_NOFILE soft limit that getrlimit reports, capped at INT_MAX: FreeBSD sys_getdtablesize returns the smaller of that limit and maxfilesperproc, and the guest limit never exceeds the hard limit that bounds it here. The guest test now asserts the value instead of the throw, and the debt entry records the semantics.
2026-10-14 22:24:10 -04:00
Evgeniy KazarinandClaude Opus 5.5 a1b80121c1 fix(libSceSystemService): pass LoadExec arguments as the whole guest argv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:41:25 +03:00
KernelPanicNTandClaude Opus 5.5 352a300dd8 feat(libkernel): answer sceCoredumpGetThreadContextInfo outside the coredump handler
sceCoredumpGetThreadContextInfo takes (void* threadContextInfo,
size_t threadContextInfoSize) as in Orbital's IDA type database, and the
144-byte block of 18 64-bit registers follows SharpProspero. It answers
as sceCoredumpGetStopInfoCpu: the handler is never invoked here, so an
aligned 144-byte request returns NOT_IN_COREDUMP_HANDLER without reading
or writing the block, and null, unaligned or wrapping buffers and other
sizes throw, as the console validation order is unverified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:45:01 +00:00
Adrià eb59c7642e Merge pull request #5666 from Kurenaiiiii/feat/libkernel-sigsuspend
feat(libkernel): implement sigsuspend on the pending-signal set
2026-10-14 16:04:55 +02:00
Adrià 24f58e534a Merge pull request #5605 from babyhuey/feat/libkernel-soc-power
feat(libkernel): export sceKernelGetSocPowerConsumption
2026-10-14 14:51:36 +02:00
Adrià 4e0cb18d1e Merge pull request #5545 from Nixitov/feat/setpriority
feat(libkernel): implement setpriority
2026-10-14 14:46:16 +02:00
Adrià c4b4a74f6e Merge pull request #5502 from ahmad3a4/feat/libkernel-sysctlnametomib
feat(libkernel): implement sysctlnametomib for the sysctl names AnyPS5 serves
2026-10-14 14:44:59 +02:00
Adrià 9a3e2ac4da Merge pull request #5187 from p3n1cillin/claude/getrlimit-nofile
feat(libkernel): report RLIMIT_NOFILE through getrlimit
2026-10-14 14:27:42 +02:00
Dean 318f237602 Merge pull request #5258 from JAB-dev/perf/unwind-info-cache
perf(libkernel): cache the unwind tables and image name per module on Windows
2026-10-14 22:39:58 +13:00
AhmadandClaude Opus 5.5 cc3d25d636 feat(libkernel): implement sysctlnametomib for the sysctl names AnyPS5 serves
Map hw.model, hw.ncpu, hw.physmem, hw.realmem, kern.arandom and
kern.proc.pathname to their FreeBSD MIBs with the size handling of
FreeBSD's libc wrapper over name2oid, fail with ENOENT and ENAMETOOLONG
as name2oid does, and throw for null pointers, which FreeBSD's wrapper
dereferences, and for names sysctl does not serve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 10:53:04 +03:00