Commit Graph
497 Commits
Author SHA1 Message Date
Dean b07388b060 Merge pull request #10552 from krishalivaibhav/fix/macos-libkernel-six
fix(libkernel): build the file, module and rtld calls on macOS hosts
2026-11-02 20:54:13 +13:00
GruzzberryandClaude Sonnet 5.5 5ba892d391 fix(libkernel): fail rtprio_thread, sched_setscheduler and setpriority with the jail privilege errors
A title is jailed (agreed on #11216). FreeBSD 11.4 prison_priv_check denies
PRIV_SCHED_RTPRIO, PRIV_SCHED_SET and PRIV_SCHED_SETPRIORITY to a jailed caller.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-01 07:56:25 +01:00
Adrià 4547df009b Merge pull request #13874 from DeveshB-1/fix/sysarch-efault
fix(libkernel): return EFAULT from sysarch for invalid memory pointers
2026-11-01 06:47:19 +01:00
Adrià f377753dd2 Merge pull request #13854 from DeveshB-1/fix/sysctlnametomib-efault
fix(libkernel): return EFAULT from sysctlnametomib for invalid memory pointers
2026-11-01 06:05:23 +01:00
DeveshB-1 5d736ad55b fix(libkernel): return EFAULT from sysarch for invalid memory pointers 2026-11-01 05:55:56 +01:00
Dean 90a01f0770 Merge pull request #13824 from zaryabzip/feat/sysutil-notification-with-text
feat(libSceSysUtil): send text notifications as firmware 13.42 does
2026-11-01 14:24:52 +13:00
Adrià 666d9b10a5 Merge pull request #13790 from DeveshB-1/fix/allowed-sdk-version-efault
fix(libkernel): return EFAULT from sceKernelGetAllowedSdkVersionOnSystem for an unwritable store
2026-11-01 02:23:24 +01:00
Adrià cd35d6103a Merge pull request #13798 from pushkarreddyy/fix/app-info-efault
fix(libkernel): return EFAULT from sceKernelGetAppInfo for invalid memory pointers
2026-11-01 02:22:03 +01:00
Adrià 8bf03654ed Merge pull request #13769 from Flamefusion/feat/libkernel-has-trinity-mode
feat(libkernel): implement sceKernelHasTrinityMode for a base PS5
2026-11-01 00:54:50 +01:00
Adrià 3f6c712b77 Merge pull request #13746 from Gruzzberry/fix/prot-group-pgid-errnos
fix(libkernel): match FreeBSD 11.4 getgroups size and setgroups limit
2026-11-01 00:53:56 +01:00
DeveshB-1 dca2c61801 fix(libkernel): return EFAULT from sceKernelGetAllowedSdkVersionOnSystem for an unwritable store 2026-10-31 23:49:53 +01:00
DeveshB-1 dd46d6ada3 fix(libkernel): return EFAULT from sysctlnametomib for invalid memory pointers 2026-10-31 15:02:53 +05:30
krishalivaibhavandClaude Sonnet 5.5 74cfbed70d fix(libkernel): return null for an address outside every image on macOS
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
0e145b86e1 fix(libkernel): build the file, module and rtld calls on macOS hosts
NativeStat, SharedMemory, Stdio, DynamicLoader, ModuleInfo and Rtld used
Linux-only APIs (st_atim, memfd_create, sys/vfs.h, link.h and dl_iterate_phdr),
so libkernel did not compile on macOS. Add macOS paths behind __APPLE__:
st_*timespec and a long-path fstatat walk, an unlinked temp file for shared
memory, statfs, dlopen/dladdr and Mach-O segment walks for module and rtld
queries. The Linux and Windows paths are unchanged.

Extracted from feat/macos-port (#8658).

Co-authored-by: Himansh Raj <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 14:32:53 +05:30
zaryabzip 520a8249a3 feat(libSceSysUtil): send text notifications as firmware 13.42 does
sceSysUtilSendSystemNotificationWithText builds the 0xc30-byte request
the 13.42 library builds (kind 5, the type at +0xc, at most 179
characters of text at +0x2d, an empty text for a null message) and
returns what sceKernelSendNotificationRequest returns. That call now
prints kind 5 requests as it prints kind 0 ones.

Replaces #9081 by @shanu337.
2026-10-31 13:13:56 +05:00
pushkarreddyy 16b53200f3 fix(libkernel): preserve caller errno across sceKernelGetAppInfo guest memory write 2026-10-31 12:58:28 +05:30
pushkarreddyy d60500a34b fix(libkernel): return EFAULT from sceKernelGetAppInfo for invalid memory pointers 2026-10-31 12:52:31 +05:30
Flamefusion 7b477b6d66 feat(libkernel): implement sceKernelHasTrinityMode for a base PS5
sceKernelHasTrinityMode returns 0, the answer of a base PS5, as
sceKernelIsTrinityMode already does. Two public readings of firmware
libkernel (OpenAGC for 11.60, Backport for 11.00 to 12.70) say it
compares hw.sce_main_socid with its low five bits cleared against
0x840fc0; the base PS5 SoC id recorded for sceKernelGetMainSocId,
0x840f80, fails that test. The prototype int (void) comes from the 23
calls in a UE5 title, each storing setne of the result in a guarded
static with no argument set up.

Titles import it from libkernel, but only the libkernel_sys placeholder
inventory exported it, as a throwing stub. The export moves to libkernel
next to sceKernelIsTrinityMode, and the inventory and its counts drop
the entry. guest_operation_mode checks the result.
2026-10-31 10:42:24 +05:30
Adrià d4627bad7b Merge pull request #13552 from pushkarreddyy/fix/system-version-efault
fix(libkernel): return EFAULT from system version queries for invalid memory
2026-10-31 05:10:40 +01:00
Adrià 69c43dd403 Merge pull request #13577 from pushkarreddyy/fix/login-efault
fix(libkernel): return EFAULT from getlogin_r and SetLogin for invalid memory pointers
2026-10-31 05:08:35 +01:00
GruzzberryandClaude Sonnet 5.5 6787b7fa8d fix(libkernel): match FreeBSD 11.4 getgroups size and setgroups limit
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 03:18:40 +00:00
pushkarreddyy ba6940814e fix(libkernel): preserve errno across checked copies in sigwait 2026-10-31 08:16:23 +05:30
pushkarreddyy 9c5495b9e5 fix(libkernel): return EFAULT from sigtimedwait, sigwaitinfo and sigwait for invalid memory 2026-10-31 08:16:22 +05:30
pushkarreddyy ce1c353f07 fix(libkernel): preserve errno and revert SetLogin in getlogin_r 2026-10-31 08:14:24 +05:30
pushkarreddyy b39c154ed2 fix(libkernel): return EFAULT from getlogin_r and SetLogin for invalid memory pointers 2026-10-31 08:14:24 +05:30
AdriàandClaude Sonnet 5.5 5c0646737d fix(libkernel): write only the version fields and keep errno in system version queries
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-31 07:55:32 +05:30
pushkarreddyy 1aae106249 fix(libkernel): return EFAULT from system version queries for invalid memory 2026-10-31 07:53:47 +05:30
Adrià 41d0d902cc Merge pull request #13532 from relativespace2K/feat/libkernel-kern-proc-proc
feat(libkernel): answer kern.proc.proc with the calling process
2026-10-31 02:57:46 +01:00
boykopovar 7fcab08f71 Merge pull request #13645 from boykopovar/fix/exception-delivery-race
fix(libkernel): exception delivery race
2026-10-31 01:18:00 +03:00
Adrià db8f5671ab Merge pull request #13444 from DeveshB-1/fix/thermal-sensors-efault
fix(libkernel): return EFAULT from thermal sensor queries for unwritable stores
2026-10-30 22:18:45 +01:00
boykopovar 950b697477 fix(libkernel): preserve exception delivery ownership and alertable drains 2026-10-31 00:13:13 +03:00
mrph28 3b379b4435 feat(libkernel): answer kern.proc.proc with the calling process
MihawkOS (PPSA99170) reads sysctl {1, 14, 8, 0} while it starts and the
runtime throws on the unsupported MIB, which aborts the title.

KERN_PROC_PROC takes no pid, so the node lists the one guest process the
runtime hosts, as the same kinfo_proc kern.proc.pid already builds.

AI-assisted: yes
2026-10-30 18:06:58 -03:00
DeveshB-1 84e493242f fix(libkernel): return EFAULT from thermal sensor queries for unwritable stores 2026-10-30 20:51:08 +01:00
DeveshB-1 3a9719490f fix(libkernel): return EFAULT from sceKernelUuidCreate and sceKernelCreateUuidV4 for unwritable stores 2026-10-30 19:27:53 +05:30
Adrià 8304ccaedb Merge pull request #11341 from SteelCrab/review/emscripten-libraries
build(libs): support Emscripten memory64 compilation
2026-10-30 12:49:20 +01:00
Adrià e4f5516fd6 Merge pull request #12974 from MarcZX10/feat/host-game-mode
feat(libkernel): opt-in host game mode request (APS5_GAME_MODE)
2026-10-30 06:36:04 +01:00
Adrià 5ba6b2b917 Merge pull request #12963 from JJenkx/windows/libkernel-raise-pending-until-resume
fix(libkernel): keep sceKernelRaiseException pending on a suspended thread on Windows
2026-10-30 06:32:05 +01:00
Adrià 0c9c5db748 Merge pull request #12690 from MarcZX10/feat/host-system-report
feat(agc): host system report and an actionable missing-Vulkan-feature message
2026-10-30 02:52:18 +01:00
pista 2f49b2568d build(libs): validate current native and WebAssembly adapter sources 2026-10-30 10:50:57 +09:00
pista d64e85164b build(libs): let the system libraries compile with Emscripten
Emscripten targets wasm64 without x86 assembly, Linux-only headers or the
x87 long double. These changes add __EMSCRIPTEN__ paths beside the host
ones; native builds compile the same code as before.

- libc: long doubles in guest varargs and scanf go through
  GuestLongDouble, a plain copy where long double is the x87 format;
  APS5_EXPORT emits no assembler alias; the guest arena is one aligned
  allocation that zeroes pages when they are committed again; getifaddrs
  keeps its link-level entries on Linux; /proc lookups and the host
  stderr duplicate are left out.
- libkernel: file-backed mmap, EVFILT_VNODE watches, getcontext and
  setcontext throw; getdents replaces the raw getdents64 syscall;
  getdtablesize takes the resource limit alone.
- VideoOut leaves SDL, the display window and the HDR probe out,
  Sysmodule asks libkernel for unwind information and Net includes
  sys/time.h.
2026-10-30 10:50:57 +09:00
Adrià ec709cede3 Merge pull request #12436 from milescoviello/fix/vm-loadavg
fix(libkernel): answer vm.loadavg with the host's load averages
2026-10-30 02:31:30 +01:00
Adrià 184afa49ad Merge pull request #12563 from babyhuey/fix/setrlimit-efault
fix(libkernel): return EFAULT from setrlimit for an unreadable limit
2026-10-29 20:35:45 +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 05fe8ad592 feat(libkernel): start the host performance session when libkernel loads
Read APS5_GAME_MODE once at load, the same point where the Windows build
raises the scheduler tick, so an invalid value stops the title at start
with an error that names the variable and an unset one changes nothing.
2026-10-29 17:14:43 +00:00
MarcZX10 ad28df623d test(libkernel): check that exits release the process session and the environment is validated
Run the process session in a test executable linked with libc and leave
through LibcExit and LibcExitWithoutHandlers: the backend is released once
in both. Check that a refused request is never released, that off never
reaches the backend, that a second session is refused, that an unset
APS5_GAME_MODE is accepted and that APS5_GAME_MODE=bogus is rejected with
an error naming the variable.
2026-10-29 17:14:38 +00:00
MarcZX10 63cb5fbd00 feat(libkernel): start the host performance session for the process
Add CreateHostBackend (the GameMode client on Linux, the activity backend
on macOS, a backend that reports itself unavailable elsewhere),
StartProcessSession, which owns the one session of the process and
releases it from the libc shutdown callbacks that every exit path runs,
and StartFromEnvironment, which reads APS5_GAME_MODE and does nothing at
all when it is unset, empty or off. Build the files into libkernel; the
session is not started yet.
2026-10-29 17:14:12 +00:00
MarcZX10 07c3fec103 feat(libkernel): add a macOS activity backend over the Objective-C runtime
macOS throttles timers and background work of a process unless it holds an
NSProcessInfo activity (Apple, Foundation, NSProcessInfo
beginActivityWithOptions:reason:, with NSActivityUserInitiated and
NSActivityLatencyCritical, which asks for the highest timer and I/O
precision available). The tree has no Objective-C sources, so call the
runtime from C++: load libobjc and Foundation with dlopen, look up
objc_getClass, sel_registerName, objc_msgSend and the autorelease pool
functions, begin one activity, retain its token, and end and release it on
End. Both library paths are injectable, and any missing piece is reported
as unavailable. Nothing uses the backend yet.
2026-10-29 17:12:09 +00:00
MarcZX10 1a4e30f7fb feat(libkernel): add a GameMode client backend that loads libgamemode at run time
Linux hosts running Feral's gamemoded switch the CPU governor and scheduler
for a registered game. The client the project ships is a header that loads
libgamemode.so.0 (then libgamemode.so) with dlopen and binds the library's
real_gamemode_request_start, real_gamemode_request_end and
real_gamemode_error_string symbols (FeralInteractive/gamemode at
a74b8106a2236d1f2696aa44c93bc4c8ef13b42e, lib/gamemode_client.h).

Do the same here with the library name list injectable: a missing library
or symbol is reported as unavailable, a failing request as refused, nothing
is linked, and the request is ended only when it was made. Nothing uses the
backend yet.
2026-10-29 17:10:52 +00:00
MarcZX10 140f7bb3ba feat(libkernel): parse the APS5_GAME_MODE setting
Accept off, on and auto, treat an unset or empty value as off so the
default stays as it is today, and reject anything else with an error that
names the variable and the accepted values.
2026-10-29 17:10:24 +00:00
MarcZX10 55587fef6c feat(libkernel): add a host performance session behind an injectable backend
A title that runs for hours would like the host to treat it as a game
(Feral GameMode on Linux, a latency-critical activity on macOS), but no
code owns that request. Add IBackend, the interface a host mechanism
implements, and Session, the state machine that requests once, releases
once, contains every backend failure and logs it once. Nothing uses it
yet.
2026-10-29 17:10:12 +00:00