Commit Graph
243 Commits
Author SHA1 Message Date
Dean db8825e4b6 Merge pull request #7938 from JJenkx/perf/guest-arena-prefix
perf(libc): skip the known occupied guest arena prefix
2026-11-01 19:17:49 +13:00
Adrià 0835ec8bdc Merge pull request #13576 from pushkarreddyy/fix/direct-memory-queries-efault
fix(libkernel): return EFAULT from direct memory queries for invalid memory pointers
2026-10-31 05:15:50 +01:00
pushkarreddyy aeab1543b4 test(libkernel): cover invalid memory rejection in flexible memory queries and PRT aperture 2026-10-31 08:15:41 +05:30
pushkarreddyy 33aa65bf90 test(libkernel): cover EFAULT from direct memory queries for invalid memory pointers 2026-10-31 08:14:53 +05:30
pushkarreddyy f07dbee530 test(libkernel): cover invalid memory rejection in page table and trace memory stats 2026-10-31 02:24:36 +01:00
Adrià 9605300f29 Merge pull request #13503 from Oscar45397/fix/libkernel-map-unallocated-direct-memory
fix(libkernel): return ENOMEM when mapping unallocated direct memory
2026-10-30 22:56:33 +01:00
Oscar45397andClaude Opus 5.5 06b7a58b1b fix(libkernel): return ENOMEM when mapping unallocated direct memory
Mapping a direct memory range that includes an unallocated physical
page threw std::invalid_argument and ended the process. It now returns
ENOMEM before anything is mapped, as shadPS4's MemoryManager::MapMemory
does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:06:45 +01:00
Oscar45397andClaude Opus 5.5 287f43e004 fix(libkernel): return EFAULT for a null virtual range name
KytyPS5 and shadPS4 return EFAULT for a null name. The test keeps that
and the rename and clear checks, and drops the null address, zero length
and past-the-end cases that no reference covers; the debt entry records
them as unknown, with the 32-byte name limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:47:22 +01:00
Oscar45397andClaude Opus 5.5 e6abfdcf75 test(libkernel): cover sceKernelSetVirtualRangeName argument errors
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:44:03 +01:00
JJenkx a87ce79892 perf(libc): skip the known occupied guest arena prefix 2026-10-30 08:14:30 -04:00
Adrià 732074ad18 Merge pull request #12987 from Oscar45397/test/libkernel-memory-pool-errors
test(libkernel): cover memory pool commit, decommit and batch argument errors
2026-10-30 07:41:31 +01:00
Adrià ad9001f9d2 Merge pull request #12865 from heditrigui/feat/libkernel-posix-madvise
feat(libkernel): implement posix_madvise
2026-10-30 05:52:23 +01:00
Adrià b440646418 Merge pull request #12858 from slopgobblercobbler/fix/direct-memory-alignment-and-boundary-checks
test(libkernel): cover boundary parameter validation and unaligned rejection in direct memory allocation
2026-10-30 05:52:16 +01:00
Dean a6ec79e895 Merge pull request #12239 from MarcZX10/perf/libc-realloc-in-place
perf(libc): resize a default heap block in place when it already has the room
2026-10-30 08:20:33 +13:00
Oscar45397andClaude Opus 5.5 5a594afebd test(libkernel): cover memory pool commit, decommit and batch argument errors
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:57:00 +01:00
Hedi Trigui 70e34e59f9 test(libkernel): add boundary test cases killing posix_madvise mutants 2026-10-29 16:32:27 +01:00
slopgobblercobbler ffd186e71f test(libkernel): cover parameter bounds and unaligned rejection in direct memory allocation 2026-10-29 14:47:31 +01:00
Hedi Trigui 59c9c7cfac fix(libkernel): validate posix_madvise address against user-map minimum and add regression tests 2026-10-29 14:32:53 +01:00
Hedi Trigui bbb4d05d42 feat(libkernel): implement posix_madvise 2026-10-29 14:14:36 +01:00
Adrià 950f8a5a53 Merge pull request #11681 from milescoviello/test/main-direct-memory
test(libkernel): cover the block sceKernelAllocateMainDirectMemory returns and its type
2026-10-29 09:31:07 +01:00
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 9c542cac90 Merge pull request #11536 from milescoviello/test/kernel-prt-aperture
test(libkernel): cover the PRT aperture setter and getter, their index bounds and null outputs
2026-10-29 07:21:39 +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
MarcZX10 6ab5d277e7 test(libc): shrink a heap block well below its class and granule
A 900 byte block shrinking to 40 bytes and a 1 MiB block shrinking to 4 KiB have
to move and keep their data, while a 1 MiB block resized by 100 bytes stays put.
2026-10-28 06:14:50 +00: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
Adrià 3d214c8d87 Merge pull request #11549 from milescoviello/test/kernel-memory-pool-block-stats
test(libkernel): cover sceKernelMemoryPoolGetBlockStats's checks and the block an expansion adds
2026-10-28 06:05:23 +01:00
MarcZX10 39803db8c3 test(libc): shrink and regrow a heap block without moving it
A 1000 byte block shrinks to 900, regrows to 1000 and is realigned to 800 at the
same address with the matching usable size and its data intact; growing it to
1 MiB moves it and keeps the data.
2026-10-28 04:13:21 +00:00
Adrià 957a22d51f Merge pull request #11688 from milescoviello/test/batch-map-fixed
test(libkernel): cover sceKernelBatchMap mapping and unmapping at the given starts
2026-10-28 04:41:33 +01: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
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 47f7d77bcb Merge pull request #11593 from milescoviello/test/direct-memory-query
test(libkernel): cover sceKernelDirectMemoryQuery's block lookup, find-next and argument checks
2026-10-28 12:07:11 +13:00
Adrià 9149eec852 Merge pull request #11152 from thuanquang/perf/resident-page-bookkeeping
perf(libc): keep no per-page physical state for resident guest pages on Windows
2026-10-27 12:00:39 +01:00
Dean c28cf99512 Merge pull request #11438 from p3n1cillin/claude/direct-map-refuses-execute
fix(libkernel): refuse to map direct memory with execute as the console does
2026-10-27 21:26:17 +13:00
Dean 699ffce388 Merge pull request #10550 from GitamarT045T3R/fix/libkernel-munmap-unaligned
fix(libkernel): round an unaligned munmap address down like FreeBSD
2026-10-27 21:11:19 +13:00
Dean 36e6c092c0 Merge pull request #9011 from JJenkx/perf/mapped-readable-run-lease-b5d763
perf(agc): lease mapped readable runs for import events
2026-10-27 21:05:23 +13:00
Adrià 50a28679c4 Merge pull request #10528 from akkadbakkad89/fix/direct-remap-block-index
fix(libkernel): walk direct-memory physical ranges by block, not page
2026-10-27 05:35:38 +01:00
thuanquangandClaude 3f130031d8 perf(libc): keep no per-page physical state for resident guest pages on Windows
A resident direct memory mapping created a SharedPage, a Physical, a
physical map node and an aliases buffer for every 16 KiB page, about
18 MiB of heap per GiB mapped, although a page mapped once holds no
state there. Resident pages now keep only their View, with pins and the
compare-when-shared mark in it; an index from (section, offset) to the
resident run finds a live resident mapping of a physical page, and the
shared state is created when a run is demoted, or when it is evicted
with data or a compare mark. ForgetSection drops the index entries of
the section's runs.

guest_memory on Windows 11 26200 (Ryzen 5 5600X): private memory per
GiB mapped at map time drops from 30.9 MiB to 13.4 MiB.

Co-Authored-By: Claude <[email protected]>
2026-10-27 04:24:13 +01:00
milescovielloandClaude Opus 5.5 3d1463aef6 test(libkernel): keep only the main direct memory allocation and type check
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 03:04:33 +00:00
milescovielloandClaude Opus 5.5 3b779dee14 test(libkernel): move the main direct memory test clear of the macOS direct memory change
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 02:50:04 +00:00
milescovielloandClaude Opus 5.5 a5a8451218 test(libkernel): cover sceKernelBatchMap mapping and unmapping at the given starts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 02:46:59 +00:00
milescovielloandClaude Opus 5.5 3134ed1658 test(libkernel): cover sceKernelAllocateMainDirectMemory's block and argument checks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 02:35:01 +00:00
Dean 4571f48bff Merge pull request #11173 from p3n1cillin/claude/mmap-excl-ignored
fix(libkernel): ignore MAP_EXCL in fixed anonymous mmap as measured on a PS5
2026-10-27 15:01:30 +13:00
milescovielloandClaude Opus 5.5 aaa0958b17 test(libkernel): cover sceKernelDirectMemoryQuery's block lookup, find-next and argument checks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 22:00:36 +00:00
p3nicillinandClaude Opus 5.5 3b210875a8 fix(libkernel): refuse to map direct memory with execute
PS5_PayloadSDK measured in a title (firmware 12.09) that
sceKernelMapDirectMemory with read-execute or read-write-execute returns
0x80020016, and that sceKernelMprotect then grants execute to a
read-write mapping. The map granted execute directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 21:40:24 +00:00
Dean c3fc606849 Merge pull request #11179 from MarcZX10/marc/build-tsan-option
build: add an ANYPS5_ENABLE_TSAN option for ThreadSanitizer builds
2026-10-27 10:39:03 +13:00
milescovielloandClaude Opus 5.5 008c5e8e37 test(libkernel): cover sceKernelMemoryPoolGetBlockStats's checks and the block an expansion adds
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 20:49:30 +00:00
milescovielloandClaude Opus 5.5 29ecf14529 test(libkernel): cover the PRT aperture setter and getter, their index bounds and null outputs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 17:57:09 +00:00
p3nicillinandClaude Opus 5.5 2387f0ece7 test(libkernel): check that MAP_EXCL replacement leaves neighbouring pages alone
Also word the debt entry as Prospero Win's report, not a measurement here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 01:24:42 +00:00
frankea b5c6010f80 Merge remote-tracking branch 'origin/main' into fix/direct-memory-12gib 2026-10-25 20:21:28 -04:00
Adrià 90f918fa71 Merge pull request #9645 from dantdmdarealguy/test/guest-memory-process-commit
test(libkernel): measure the remapped direct memory charge in the test process
2026-10-25 22:28:01 +01:00