Commit Graph
2477 Commits
Author SHA1 Message Date
Dean 319621ba2e Merge pull request #12339 from medazizktata/fix/windows-exec-shared-mapping
fix(libkernel): map shared memory and files executable on Windows
2026-10-29 07:28:16 +13:00
Dean 1235db19dc Merge pull request #11500 from xXPBSXx/test/pthread-mutex-trylock-behavior
test(libkernel): cover the return values of pthread_mutex_trylock
2026-10-29 07:20:19 +13:00
Adrià 027989a44a Merge pull request #11858 from jotitadev/fix/macos-poll-hangup-both-directions
fix(libkernel): report POLLHUP on macOS only once both directions of a stream have ended
2026-10-28 18:20:12 +01:00
Adrià 6eae433fad Merge pull request #11801 from jotitadev/fix/macos-waitpid-child-signals
fix(libkernel): report a child's stop and kill signals correctly on macOS hosts
2026-10-28 17:35:55 +01:00
Dean d937efc9ca Merge pull request #12283 from B-Howell/claude/fix-issue-12079-rmdir-link-classify
fix(libkernel): classify the rmdir path with lstat so links give ENOTDIR on Windows
2026-10-29 00:30:56 +13:00
Dean 785f7b35d9 Merge pull request #12260 from tkcm01/fix/libkernel-cancellable-sleep-errno
fix(libkernel): keep errno across cancellable sleeps
2026-10-29 00:29:17 +13:00
Mohamed Aziz Ktata dbd826bc88 fix(libkernel): map shared memory and files executable on Windows
A guest mmap with PROT_EXEC and MAP_SHARED of a shared-memory object or a regular file threw on Windows. The section is now created from a handle reopened with GENERIC_EXECUTE, as PAGE_EXECUTE_READ or PAGE_EXECUTE_READWRITE, the owner ACE of named objects grants execute with read, and a writable shared mapping of a read-only descriptor fails with EACCES, as FreeBSD 11.4 shm_mmap and vn_mmap do.

Fixes #12337
2026-10-28 11:14:08 +01:00
Dean 846ae118f9 Merge pull request #11861 from ionut27001/fix/libkernel-sysconf-measured-names
fix(libkernel): sysconf answers the names a PS5 payload process answers
2026-10-28 22:52:41 +13:00
Dean bc7cc27e55 Merge pull request #10856 from Felipebmaitan/feat/guest-signal-cancellation
fix(libkernel): avoid cancellation wakeups during thread exit
2026-10-28 22:52:08 +13:00
Dean 4a6693acf8 Merge pull request #12083 from KernelPanicNT/fix/libkernel-mutexattr-setkind-any-kind
fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
2026-10-28 22:46:46 +13:00
Dean 7eac0fe4cb Merge pull request #12075 from JJenkx/windows/kernel-truncate-loop
fix(libkernel): report ELOOP from truncate on a looping Windows link
2026-10-28 22:46:08 +13:00
Dean e4a00a5ddb Merge pull request #12069 from dantdmdarealguy/fix/raise-terminating-target-windows
fix(libkernel): treat a raise target that is already terminating as exited on Windows
2026-10-28 22:45:45 +13:00
Dean f05f82a005 Merge pull request #11926 from al3ss4ndrolb/fix/param-json-incomplete-member
fix(libkernel): build the param.json parser with Clang and libstdc++
2026-10-28 22:31:21 +13:00
AdriàandClaude Sonnet 5.5 149ec09adf fix(libkernel): give the descriptor checks C linkage so libkernel_sys can import them
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 08:43:15 +01:00
AdriàandClaude Sonnet 5.5 f87b6289ac fix(libkernel): export the kqueue descriptor check to libkernel_sys
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 08:43:15 +01:00
Dean 210462e2a7 Merge pull request #11838 from oneandonlydean/wolverine/amm-fragmented-pool
fix(libkernel): map AMM pages from a fragmented pool
2026-10-28 20:11:32 +13:00
B-HowellandClaude Opus 5.5 fe7a71c1ea fix(libkernel): classify the rmdir path with lstat so links give ENOTDIR on Windows
sceKernelRmdir decided whether the last component was a symbolic link with
std::filesystem::is_symlink, which follows the link with WinLibs libstdc++ on
Windows. A dangling or self-referencing file link then looked missing on
Windows 10 (ENOENT instead of ENOTDIR), and a directory link to an empty
directory looked like that directory, so rmdir removed the link and
returned 0. The last component is now classified with FillLinkStat, the
same lstat path lstat_nid_postfix uses, matching FreeBSD 11 kern_rmdirat,
which returns ENOTDIR for any non-directory vnode found without following
the last link.

Fixes #12079

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 03:10:08 -04:00
tkcm01andClaude Opus 5.5 1127dacf68 fix(libkernel): keep errno across cancellable sleeps
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 01:49:47 -04:00
harisibrar1 6413eacf9d Merge remote-tracking branch 'origin/main' into fix/map-undefined-protection-einval
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-28 01:28:03 -04:00
Felipebmaitan 4ba0a6f9c4 chore: integrate current main for guest-signal-cancellation 2026-10-28 00:48:38 -03:00
Dean Galvin 97f1d41a2c Revert "Merge pull request #10809 from frankea/fix/direct-memory-12gib"
This reverts commit 780b33aea3, restoring the 13824 MiB direct memory pool.

With the pool at 12288 MiB, Astro Bot (PPSA21564) can no longer load its
level: DirectMemoryAllocator asserts "Can't allocate direct memory" for a
64 MB VideoPlayerTexture with 12228 of 12288 MB in use, then the process
faults about 26 s in (2 of 2 runs, RTX 4090, Linux, main cccdaa2734).
The same tree with only this merge reverted runs the full 150 s with no
direct memory assert (2 of 2 runs).
2026-10-28 15:45:26 +13:00
Adrià b5873b4ce4 Merge pull request #11594 from milescoviello/test/read-tsc
test(libkernel): cover sceKernelReadTsc's rate against sceKernelGetTscFrequency
2026-10-28 03:35:23 +01:00
Dean 780b33aea3 Merge pull request #10809 from frankea/fix/direct-memory-12gib
fix(libkernel): report 12 GiB of direct memory, as a PS5 does
2026-10-28 13:49:57 +13:00
Dean b3b449cfe4 Merge pull request #8916 from Henryisdjfunkyho/fix/cancellable-timed-sleeps
fix(libkernel): wake timed sleeps for thread cancellation
2026-10-28 13:48:32 +13:00
Dean 1068cd6b76 Merge pull request #7780 from savvaniss/fix/savedata-ps4-modules
fix(savedata): build libSceSaveData and libSceSaveDataDialog from the native sources
2026-10-28 13:48:05 +13:00
Dean e778405b5b Merge pull request #11592 from alvaroelpob/fix/libkernel-condattr-getclock-einval
fix(libkernel): fail pthread_condattr_getclock with EINVAL for a null attribute
2026-10-28 13:04:04 +13:00
Dean a6816811f3 Merge pull request #10975 from xXPBSXx/fix/gettimeofday-itimer-efault
fix(libkernel): fail gettimeofday, getitimer, setitimer and the sceKernel time getters with EFAULT on an unusable pointer
2026-10-28 13:02:14 +13:00
Dean ba8845d2e7 Merge pull request #9442 from Gruzzberry/feat/lchflags
feat(libkernel_sys): implement lchflags
2026-10-28 13:00:19 +13:00
xXPBSXx b8685f717e Merge main (6e9b9134f6) into test/pthread-mutex-trylock-behavior
The test block of guest_posix_specific landed in main at the place where this branch adds its own; keep both blocks.
2026-10-28 00:24:01 +01:00
Dean d59cdd502b Merge pull request #11799 from xXPBSXx/test/pthread-specific-behavior
test(libkernel): cover pthread_setspecific and pthread_getspecific
2026-10-28 12:10:38 +13:00
Adrià 4a6005955f Merge pull request #10898 from imellag/feat/libkernel-memory-protection-macos
feat(libkernel): guest memory protection and VirtualQuery on macOS hosts
2026-10-27 21:42:24 +01:00
Adrià 225ebc5eee Merge pull request #11264 from Gruzzberry/fix/sysctl-faults
fix(libkernel): fail sysctl and sysctlbyname with EFAULT on an unreadable or unwritable pointer
2026-10-27 21:16:21 +01:00
KernelPanicNT 625a3fbb62 fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
scePthreadMutexattrSetkind called NotImplemented_nid_no_patch for a kind
outside 1 to 4. Firmware 13.42's libkernel, run in an emulator, makes it
call pthread_mutexattr_setkind_np, which stores any kind as a signed
16-bit value and returns 0, and turns a null attribute's -1 with errno 22
into 0x8001FFFF. It now forwards to pthread_mutexattr_setkind_np and
converts the result with sceKernelError, so a null attribute or object
still returns 0x8001FFFF and now also sets errno 22.

An out-of-range kind is refused by scePthreadMutexInit with 0x80020016,
leaving the mutex untouched, as measured for the same module.
scePthreadMutexattrGetkind is unchanged; kind 0 now reaches it and
returns 0.
2026-10-27 19:24:23 +00:00
KernelPanicNT 9ed4377be4 Merge main into fix/libkernel-mutexattr-setkind-any-kind 2026-10-27 19:22:42 +00:00
JJenkxandClaude Opus 5.5 708808bd35 fix(libkernel): report ELOOP from truncate on a looping Windows link
sceKernelTruncate and truncate checked for a symbolic link loop only
after the native truncate failed, but on Windows std::filesystem::status
already reports a self-referencing link as missing, so the call returned
ENOENT before reaching that check. The loop check now runs before the
not-found result too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 15:06:29 -04:00
dantdmdarealguy 95a785104c fix(libkernel): treat a raise target that is already terminating as exited on Windows
SuspendThread fails with STATUS_THREAD_IS_TERMINATING for a thread that
has begun to exit while its handle is not signaled yet. TryDeliver took
only the signaled handle as an exit, so the raise deliverer, which keeps
sweeping a target in host code until delivery or exit, threw "cannot
suspend the target thread" and aborted the process when that target
exited in between. The suspension now reads the NTSTATUS from
NtSuspendThread and treats a terminating target as exited; other
failures still throw.

guest_raise_exiting_thread raises at 32 threads per round that block in
a host wait and exit after it, for 100 rounds.
2026-10-27 13:38:04 -05:00
Dean 5ad1c72e33 Merge pull request #11603 from milescoviello/test/apr-queries
test(libkernel): cover the APR prefixed resolve, file size and stat queries and the submission with a result
2026-10-28 06:01:07 +13:00
Adrià a1053d987b Merge pull request #11273 from Gruzzberry/fix/signal-pointer-faults
fix(libkernel): fail the signal action, mask, stack and pending calls with EFAULT on an unusable pointer
2026-10-27 17:55:35 +01:00
Dean Galvin 8e1e958592 test(libkernel): link libc into guest_amm_pool_tests for the Windows C++ runtime
The test throws std::bad_alloc from a replaced operator new, so on MinGW it needs the same libc link, unwind section rename and DLL path as the other throwing guest tests (the Windows link failed on __gxx_personality_v0).
2026-10-28 05:25:36 +13:00
Adrià e2a5118839 Merge pull request #11047 from imellag/feat/libkernel-macho-tls
feat(libkernel): thread-local storage for Mach-O guests
2026-10-27 15:18:46 +01:00
Adrià a40ad89e2c Merge pull request #11236 from orezraey/fix/libkernel-kqueue-timer-readd-measured-ps5
fix(libkernel): accept EVFILT_TIMER re-adds with a time unit or on a disabled timer as measured on a PS5
2026-10-27 14:28:05 +01:00
Adrià 1089f2bbfd Merge pull request #11039 from orezraey/fix/libkernel-mutex-yieldloops-destroyed-measured-ps5
fix(libkernel): fail the yield loop setter on a destroyed mutex as measured on a PS5
2026-10-27 14:08:31 +01:00
al3ss4ndrolbandClaude Opus 5.5 498270408f fix(libkernel): build the param.json parser with Clang and libstdc++
JsonObject held std::pair<std::string, JsonValue> while JsonValue was
still incomplete. Clang with libstdc++ instantiates the pair and the
vector destructor at the end of JsonValue and stops with "incomplete
type used in type trait expression". A named JsonMember struct defined
after JsonValue keeps the vector element a plain class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 13:45:06 +01:00
Adrià 62b3ba2522 Merge pull request #11125 from MarcZX10/marc/fix-equeue-close-during-measure
fix(libkernel): wait for an in-flight file measurement before closing a watched descriptor
2026-10-27 13:30:54 +01:00
Adrià b71d5db752 Merge pull request #10855 from Felipebmaitan/feat/async-storage-engine
fix(libkernel): preserve AIO request ownership and identities
2026-10-27 13:30:47 +01:00
Adrià eece5da035 Merge pull request #10838 from EagleBearerYS/feat/libkernel-sys-finish-calls-v2
feat(libkernel_sys): finish sched_setscheduler and sigreturn
2026-10-27 13:20:31 +01:00
Dean Galvin 79fc99774b fix(libkernel): zero the PRT range again when allocating pages for it fails
Unbacked pages of a PRT range are anonymous zero pages, so a failed allocation puts those back with _zeroPrt instead of leaving the range reserved and unreadable.
2026-10-27 23:45:02 +13:00
Dean Galvin e3b5192cb4 fix(libkernel): map PRT-allocated AMM pages through the pool staging
_ammAllocatePrt took pool pages one at a time and mapped and recorded them run by run, so a failure on run k lost the pool pages of runs k to n. It now maps the unbacked part through AmmPool::MapScattered and returns the range to the reservation if that throws, and the unused _takePoolPages is gone.
2026-10-27 23:41:47 +13:00
Dean Galvin 77c978e318 test(libkernel): fail every allocation of a scattered AMM map in turn
Fail each allocation of a map from a fragmented pool, a map whose host call fails after each run, and a page insertion, and check that the pool and the page records are unchanged after every failure and that a map of one page more than the pool holds is still refused.
2026-10-27 23:29:59 +13:00
Dean Galvin 24e88cd20a fix(libkernel): publish scattered AMM pool pages exactly once
Move the pool bookkeeping into AmmPool.hpp. A map from a fragmented pool now plans its pages without changing the pool, stages the page and reference records in their own maps, maps the runs, and only then splits the pool and moves the records in with no allocation, so a failed map leaves the pool and the records as they were. Adding a page inserts its reference record first and undoes it if the page record throws.
2026-10-27 23:29:59 +13:00