dladdr1 searches the object's symbol table, which made every host fault
chained past an installed handler about 8 us slower on Linux. glibc 2.35
and later answer the same question with _dl_find_object, which is also
async-signal-safe; older glibc keeps dladdr1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A handler installed for SIGILL, SIGFPE, SIGBUS or SIGSEGV now receives
the faults raised in title code instead of the process ending, with
mc_trapno, mc_addr and mc_err filled as FreeBSD 11's amd64 trap() does.
On Windows the crash reporter's vectored handler offers unclaimed faults
to libkernel, which redirects the thread to a stub that runs the handler
outside the exception dispatcher; on Linux chained host signal handlers
classify faults by REG_TRAPNO.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves docs/dev/debt/libkernel.md: main's sigaction entry (SIGPIPE outside Windows) and this branch's signal entry, which points to libSceLibcInternal for siginterrupt.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves docs/dev/debt/libc.md: main's updated _Thrd entry, and siginterrupt stays documented in libSceLibcInternal.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
vm.overcommit is a read-write sysctl without CTLFLAG_PRISON, so FreeBSD 11.4 sysctl_root asks priv_check for PRIV_SYSCTL_WRITE before the handler runs, and prison_priv_check denies it to a jailed root. Under the credential model agreed on #11216 a write through sysctlbyname now fails with EPERM, whatever the value or its length, instead of throwing.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Every committed copy and compare on Windows went through
ReadProcessMemory, so a page released during the read counts as
uncommitted instead of faulting. Revalidation issues that system call
for each compare, and it dominates the committer thread.
Ranges the guest arena owns are now read by leaf copy and compare
routines. A fault on one of their source loads resumes at a failure
return, and the read falls back to the existing page by page path, so
the result for released pages is unchanged. Host regions and addresses
outside the arena keep ReadProcessMemory.
Hosts with AVX2 take 64 bytes per pass, with 16-byte and byte tails;
others keep the 16-byte loop.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sysctl serves {1, 14, 8} since #13532, but sysctlbyname and sysctlnametomib still returned ENOENT for kern.proc.proc. Map the name to the same MIB, as FreeBSD's name lookup does.
QueueForDeliveryDrain ran after ResumeThread with no coordination with
the target's final ReapDeliveryDrain: a target could exit between resume
and enqueue, leaving the post in a box nothing would drain again and
retaining the QueuedDelivery reference.
Admission is now decided under drainBoxesLock against the target's
_finished flag, which is stored before the final reap in program order;
denied posts run their callback inline so the entry and the reference
are resolved exactly once on either path.
The GuestRaiseException regression arms a post hook, holds the producer
between resume and enqueue, lets the target finish and reap, then
completes the post and requires the drain to stay empty; the churn
rounds also assert the post hook observed mailbox posts alongside the
delivered raises.
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]>
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]>
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.
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.