feat(libkernel): map app0.zar archive-backed files #11625
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11625"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-26T23:23:17Z.
What
Map files from
app0.zarthrough the native regular-file path. Each mapping owns a read-only backing object for the requested guest-page-rounded window, clipped at EOF, with a native offset of zero. Loose files take precedence. The mapping survives close or reuse of the guest descriptor, with the existing protection, partial-unmap and host EOF behavior.Archive reads check each destination page before advancing the cursor. HostWrite opens watched pages, while the checked copies handle invalid addresses and preserve partial progress. Materialization holds the shared descriptor attachment lock while it copies, serializing reads, seeks and maps on duplicate descriptors.
The branch preserves published head
00a2d202a33c9b09e38321962cefacd1506db1b8and integrates main throughe481b135558fc4316bc3b24e7408156737eff08d. It carries main's Windows fixed-private-map bookkeeping, macOS empty-iovec guards and newer archive-descriptor test expectations. The debt edits use a fragment that preserves main's neighboring entries.One independent review inspected the full archive diff at
1b8fea2423fe5b4b5e29900a14153f17ed502dc3. The follow-up translates Windows backing-write exhaustion toENOSPCorEFBIGfor the corresponding native error, and checks macOS shared write upgrades against matched loose-file mappings. Windows and Linux still requireEACCESfor the upgrades, and the tests restore read-only protection before checking guest destination faults.The Windows reader now opens with read access and no delete-on-close flag. The writer owns file cleanup. Private mappings finish copying before the reader closes, and shared views keep the native section alive after the descriptor closes. Lifetime review
#12682 remains the declared predecessor. A read-only merge preview with its published head
44fde3b660ac816dace9ac0320f2002d23d5787dstill conflicts inpread_nid_postfix. The archive branch by itself previews cleanly against maine86afa1936367953144e791327ed2161fdb330ea. After #12682 lands, carry the archive error conversion into its cancellation and pinned-descriptor path and test the combined archive and I/O behavior. #18190's libkernel_sys wrapper refactor separately conflicts inPosixMemory.cppat its published headdc73ea0d21d3c6fbf9002ab3fee296f312583147. I compared the 37 unique PRs in the refreshed overlap report against mainc8d5f91168d7d8c208478de6d555b6a34c1c9acfand against that main composed with this head4a2b14298c386cf90332d35bbc2e5c8314d2993f. Newly listed #11831 changes stream lifetime andfcloseall; its published head1c17f817b396eec0d46ddfedccb5a2ab9113493amerges cleanly in both previews. #18112 contributes a libkernel_web export mirror and already conflicts with main. #7447 introduces a separate archive-stdio source at the same libc CMake registration point. #7121's read notifications add conflicts within its already-conflictingOpen.cppandStdio.cppwhen combined with the archive read-error changes. #6936 changes archive seeking and already conflicts with main. The other previews showed the same conflict files and the same conflict blocks in archive-touched files as their main comparisons. These overlaps involve separate functionality. The declared prerequisite is still #12682.Tested
4a2b14298c386cf90332d35bbc2e5c8314d2993f. The native read-only and executable mapping tests created a section from the materialized reader, closed both the section handle and the reader, then verified the mapped bytes. Both passed, and the isolated backing directory had no temporary backing files after unmap. The descriptor-read and truncated-entry cleanup smoke test also passed. The original reader flags passed the native view lifetime reproducer on this host as well.86b4b73041f30a97b5a2521b4fae801b4b141e5b. The direct backing test passed requested offsets and bytes, read-only access, independent windows, EOF clipping and truncated input. A second test linked the production archive and backing sources with ZArchive and used a real compressed fixture. It passed loose-file precedence, cursor sharing and positioned partial reads with injected copy rejection, and native mapped views that remained readable after closing their handles.WriteFileresultsERROR_HANDLE_DISK_FULLandERROR_FILE_TOO_LARGEreturnedENOSPCandEFBIGand closed the backing handle. The production archive fixture passed MinGW syntax checks at that integration head. The four changed libkernel translation units passed syntax checks and are byte-identical to those checked.origin/main, debt fragment validation and committed-diff whitespace checks passed. The initial function-name overlap scan completed against 2,239 open PRs.4a2b14298c386cf90332d35bbc2e5c8314d2993fin 7.08 seconds on Windows 11 build 26300, WinLibs GCC 15.2, Release. The selection covered all nine app archive modes across libc and libkernel, including archivemmap, backing failure and damaged input. It also covered filesystem, descriptor duplication, file-vector and positioned I/O, AIO, guest memory, and fixed-anonymous and executable mappings. The archivemmapcase verified shared and private mapping data after descriptor close or replacement, checked error handling for unwritable guest destinations, and exercised Windows write-watch collection. CMake used the pinned FFmpeg package after its SHA-256 matched the published release. Fresh Linux and macOS execution remains pending.4a2b14298c386cf90332d35bbc2e5c8314d2993fwith 20 successes and two skips (the full Linux and pipe-write jobs). The Windows job passed. Hosted build run00a2d202a33c9b09e38321962cefacd1506db1b8composed with main. Windows Server 2022 had 2 failures out of 6,495, both reproduced on main. Windows Server 2025 had 0 out of 6,495. Contributor runsChecklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Earlier descriptions and evidence at their historical revisions
What
November 7 maintenance head
00a2d202a33c9b09e38321962cefacd1506db1b8, integrated with main4138defef7c468835190768e5143e411bce92d6a. This preserves the complete published6e2918bffa9d95f46f986f8417b08dbe468fe176history, including maintainer merges and the macOS mmap error-publication fix. The only integration conflict was the libkernel debt file; both the archive mapping text and main's module-unload debt are retained. No archive runtime implementation was replaced with the stale October checkout, and no graphics source or timeout was changed by this maintenance.Archive-backed mmap uses read-only native backing for the requested guest-page-rounded window, clipped at EOF and mapped from backing offset zero. Mapping lifetime is independent of the guest descriptor and transient backing descriptor. Loose files retain precedence; private writable mappings, shared read-only permissions, protection changes, partial unmaps and descriptor reuse continue through the established regular-file paths. This is host ZArchive packaging, not console PFS.
Checked archive reads remain deliberate: audited scalar, positioned, vector and AIO callers open HostWrite/OpenIovecs, but those guards do not make arbitrary destination pointers fault-safe. Page-bounded checked copies retain invalid-buffer and partial-progress/cursor behavior. Materialization holds the shared attachment mutex for the requested window; contention and copy cost remain the previously documented tradeoffs. No new performance claim is made.
Tested
Fresh execution on the maintenance head:
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON: full productionlibsandrelinker, plus the selected runtime executables, rebuilt with at most two jobs. 27/27 focused tests pass after restoration of the negative controls. These include archive/plain/mmap/backing-failure/damaged modes, ordinary mmap and memory, duplication, scalar/positioned/vector reads, AIO, filesystem and actual Windows write-watch/HostWrite behavior. Synthetic archive entries and loose files with identical bytes are compared by the production API fixtures. Every focused case finishes below 30 seconds; the archive cases retain their registered 20-second limits.BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=OFF: full productionlibsandrelinkerplus the focused executables built, then rebuilt/restored after the clean-main control. The original registered selection is 23/24: every archive mode, read/positioned/vector/AIO, duplication, ordinary memory and fixed-anonymous mmap passes; ordinaryguest_mmap_executableaborts atGuestMemory.cpp:3583from its registered DrvFS working directory. A clean checkout of parent main4138defef7c468835190768e5143e411bce92d6a, with the fixture unchanged and its actual production dependency graph rebuilt, reproduces that same assertion; both main and the archive head pass that executable mode from unique native ext4 working directories. The main artifact lacks the archive mapping helper; restoration reinstates it. The underlying working-directory-dependent cause is not explained here and no unrelated memory code or timeout was changed.guest_mmap_executable's working directory moved to a unique verified ext4 directory in an untracked temporary CTest registry. Machine-checked JSON comparison verifies all 24 commands and every other test property, including registered timeouts, match the original registry. All other working directories remain unchanged.guest_filesystemseparately passes from a unique ext4 directory. The original 23/24 result and its failure are retained, rather than relabeled as an unmodified CTest pass. Linux reports asynchronous userfaultfd write protection unavailable (EINVAL); HostWrite/data checks execute, but actual Linux write-watch collection is not claimed. Actual collection is asserted by the passing Windows cases. Restored binary hashes and runner definitions/properties are retained in the local validation artifacts.87473937d31ca4f64d819805b8f0c2b80ac55b53, and exits 2: 76 comparisons with PRs conflicting with main remain inconclusive. The confirmed #16861 overlap was manually inspected: adjacent libkernel debt edits, with no archive implementation overlap. Live #7447 atdead12ebad24a3c4b01a05c14ab60cc06aacaf7dremains a stdio feature without mmap capability; #6936 atf06949da78cf801f47702e27f0dd987f4b80e184adds archive seek modes. Their shared integration paths remain open coordination concerns; neither branch was edited or contacted. No clean scan or new ordering agreement is claimed. A read-only merge-tree check against subsequently fetched main9e47f0c3accfdd390ef5c578c8a6332048200d5dis clean (tree99ac8c8c3e503ee4c3a54d7d72c5ee01c797f40e); the executed source remains the explicitly pinned maintenance head based on4138defef7.Fresh targeted investigation of the November Radeon timeout report:
GuestKernelAppArchive.cppbecause main lacksAppArchiveMappingDescriptor_nid_no_patch; it never supplies a clean-main graphics runtime control. The report remains unattributed.agc_driver_graphics_testson clean reported maine772fb25cc72ee5faf77847f06bbc69533016e82and its exact composition with PR6e2918bffa9d95f46f986f8417b08dbe468fe176. The latter is diagnostic commit15a84102eed7321ad8e5bd94e9f8face06231264, merged tree9be29b4ca2233ca17556fade4c26117a5bc9cbbf. Graphics/recompiler source trees are identical across this pair. This diagnostic commit is not the maintenance PR head or a published feature change.ctest -R '^agc_graphics_profile_draw$' -V --parallel 1with the original registered TIMEOUT 60 unchanged, same Windows 11 PC, Ryzen 9800X3D, NVIDIA RTX 5080 / NVIDIA 621.14 / Vulkan 1.4.357, GCC 15.2 Release andANYPS5_ENABLE_SPIRV_TOOLS=ON. Both useANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The complete job heldLocal\AnyPS5GpuValidation; no concurrent GPU validation was run by the I/O owner. Local Khronos nightly validation layer API 1.4.368 was verified available with vulkaninfo.VUID-ID; there are no new validation IDs. Main raw log SHA256:ab50509f6f4637815bf8e484722942e05ec2b320774fffaf621f747cca2e8183; exact-composition raw log SHA256:8300f2ca860929c93b3a88983602688dcd250402319680c7dfd7a980470f459d.ae97b16d4a2; that was not used for this diagnostic pair or proposed as an archive fix. A targeted same-RADV-machine clean-main/composition followup, requesting last-subcase output and native thread stacks before the original cap, is prepared locally but has not been posted to the contributor.Ordering and limits: #12682 remains the declared predecessor, now published at
32121ca48d0abf5e1c11e7c601636d10ec8cb77d; no unpublished candidate was consumed, no I/O owner's branch was edited, and no combined execution is claimed here. #11732 and #12296 are already merged. A later read-only merge check is also clean against fetched maine9032c8e060b417631ec6a2e3116eb1c649d922f(tree6656a448012741dfc3145624c95dee20f62127a5); this does not relabel that newer main as the executed base. Linux backing requiresmemfd_createand/proc/self/fd; Windows retains the ordinary private-file snapshot and whole-page EOF behavior. No new macOS, Radeon, game or console execution, full CTest-suite result, or speed result is claimed. Existing approvals apply to their historical reviewed SHAs, not this integration head. Exact-head upstream CI and current-head maintainer review remain external gates.Historical evidence and previous PR description; historical revisions only
What
November 5 review follow-up, current head
6e2918bffa9d95f46f986f8417b08dbe468fe176: correct the libc app0.zar debt statement to cover archive-only entries outside archive-aware handling, including ordinary path/module resolution and chdir. Source verification: General.cpp ResolvePath_nid_no_patch and ResolvePathOrRelinkedModule_nid_no_patch call AppArchiveRefuseOnly_nid_no_patch, and chdir does likewise; that helper calls NotImplemented_nid_no_patch for archive-only entries. This is a one-sentence documentation change on top of remote maintainer headafe480cff0ab5128712df07cb49b815f2f94e07b; runtime sources and tests are identical to that head.XairRrR's APPROVED review treats the checked-copy cost and descriptor-mutex hold time as nonblocking suggestions. Per-page checked copies and their partial-progress/cursor/HostWrite semantics remain. A larger-buffer fallback would need to handle already-written bytes when a bulk checked copy fails, retain page-exact partial counts, and be measured before any speed claim. Materialization currently holds the shared attachment mutex throughout decompression/backing writes, so duplicate-descriptor reads, seeks and maps serialize for that window. Snapshotting the node under a shorter lock is a possible follow-up requiring lifetime/concurrency checks. This update records those tradeoffs without changing the implementation or claiming maintainer acceptance of the existing read cost.
November 1 fix at
f5d5756c799d2257de279a0963d93068e9f43fff, published in head91f8d4b237b99a1d996824de43090f452dbce40e: publish the selected mmap errno after exception/resource cleanup. The macOS report is reproduced; the catch selected EIO (5), then exception cleanup changed the host/guest errno slot to ENOENT (2) before return. Mapping now computes its result/error internally and the public wrapper publishes the error after that work has ended. The error classification stays intact: host backing-directory failures and damaged archive data produce EIO, while supported access/resource failures retain their own codes. A missing host temporary path does not mean the already-open guest archive file is missing. Added SCE wrapper checks require the same error and an untouched output pointer on failure.Bounded requested-window storage, permission/EOF/lifetime semantics and checked reads are retained. The supplied read-cost explanation/benchmark awaits acceptance; this update makes no speed claim. #11732/#12296 ordering is satisfied by their merges; #12682 remains open and is the declared predecessor. Its November 1 inspection pinned head
0e88eeebc91c233aaba95c056c970a1d8b273b36. No I/O cancellation-stack branch (#12682/#12688/#12700/#12965) was changed.Implement archive-backed file mappings through the regular-file mapping paths. Loose app0 entries still override app0.zar. This is AnyPS5 host ZArchive packaging, not console PFS.
The backing now contains only the requested guest-page-rounded window, clipped at EOF, stored at native offset zero. Linux uses a sealed memfd reopened read-only; Windows/macOS use read-only temporary disk backing. Each live mapping owns independent native storage. No hidden descriptor remains after mmap returns, preserving close/reuse and dup2 behavior. Failed backing writes retain resource errors and clean up without installing a mapping.
Private writable copies, shared read-only permissions, protections, partial unmaps, offsets and EOF retain the established native mapping contract. Linux requires memfd_create and /proc/self/fd. Windows retains regular-file private snapshots and whole-page EOF rejection; macOS execution evidence uses the separately pinned support composition above.
Read copies remain deliberately checked. I audited all actual ReadArchivedFile/ReadArchivedIovecs callers: sceKernelRead, POSIX pread, both host implementations of sceKernelPread, Windows TransferIovecs, POSIX sceKernelReadv/Preadv, and AIO NativePread. Each holds HostWrite/OpenIovecs over its destination. Those guards open watched pages; they do not validate arbitrary pointers. On Linux GuestArenaBeginHostWrite returns true and the write-watch hook is a no-op; on Windows BeginHostWrite checks tracked views, not all arbitrary private/foreign memory. ZArchive copies with CPU stores, so restoring direct destination reads would reintroduce host faults for protected/unmapped pointers. Page-bounded GuestCopyOut preserves EFAULT-before-progress and partial count/cursor semantics. The nested guards also cover direct internal-helper callers. New scalar/positioned/vector/AIO regressions exercise invalid pointers, partial vectors and watched destinations. The measured cost is recorded below, without a title speed claim.
Ordering: #12682 first (replacement for #11872), then this PR, as previously declared. Its current published head is
55161f97476a8bd413c279829cabb6390307e4d5; no candidate is consumed here, and its branches remain untouched. #12296 merged during validation; its Windows shared-memory checks are retained in this rebase, alongside the archive source descriptor and native window offset. #11732 is also merged; its newer VirtualQuery debt text is preserved. Both older order requests are therefore already resolved by main, and neither is an open prerequisite. Direct replies to the outstanding review and ordering comments are recorded in the conversation below.Tested
November 5 documentation-only verification at
6e2918bffa9d95f46f986f8417b08dbe468fe176: inspected the resolver/chdir refusal paths and the read/materialization locking/copy paths. Conventions (python3 tools/check_conventions.py --base origin/main) and committed-diff whitespace checks passed in an isolated clone against fetched upstream maine772fb25cc72ee5faf77847f06bbc69533016e82. Runtime tests were not rerun for the sentence change. The overlap scan completed against 1,811 open PRs at that main; it reports #15556 on libkernel debt and exits 2 because conflicting-main comparisons remain inconclusive. No new overlap agreement or clean-scan result is claimed.Independent evidence, pinned to the revisions actually tested:
783098aabe1d930b25a10c85280ed02a4c219f1fwith main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged treee34c6e0da86340e7048a4bdd82ea4c60d3f5f5d1, Debian 13/GCC 14.2 Release. All 22 focused tests passed. Reverting the mapping path made all three mmap modes fail; reverting checked reads made the invalid-destination mmap test segfault. Restoring the implementation and rebuilding restored all five archive passes. The noexec-storage variant was unavailable; only missing-directory independence ran. This review establishes neither Windows results nor a rerun of the benchmark, and its acceptance is not attributed to the latest head.91f8d4b237on support branch05bd71a66b, macOS 27.2/M4 Pro/Apple clang 21/x86-64 Rosetta Release: 19/19 archive and file cases pass, including both repaired errno cases, plus three more 9/9 archive runs. #10552 empty-iovec guards were retained. This is support-composition evidence, not a new full-tree macOS or Windows run.Windows status on maintainer head
afe480cff0ab5128712df07cb49b815f2f94e07b: Build run41823369138, Windows job126565422963, is CANCELLED, not failed; Linux is SKIPPED. The Windows relinker job passed, which is separate from runtime validation. The cancelled job could not be rerun through the job-specific retry. A focused workflow-dispatch attempt (build.yml, main, pr=11625, linux=false, select=true) was denied:HTTP 403: Must have admin rights to Repository.API repository permissions show pull=true, push/maintain/admin=false; this local host has no Windows runtime. Fresh focused Windows runtime evidence therefore remains unavailable through this account/environment. No cancelled/skipped job is counted as a pass or failure. Earlier Windows results below remain historical.#12682 remains OPEN and the declared merge-order predecessor (inspected head
32169af1dc395b182370cdf973687d313d33bfc4). #11732/#12296 ordering is satisfied. No other branch was edited or merged. Existing read-cost acceptance and fresh Windows execution remain external requirements; the review's performance suggestions are nonblocking.Earlier evidence follows with its original platform/head limits.
November 1 exact published head:
91f8d4b237b99a1d996824de43090f452dbce40e. Preserves the remote maintainer merge4cb2bc9b2cceab3ef2ff7b8d736f7e04bc89ab9e; integrates upstream main66e1f7f993c9c1339c2de11264b76bab03218cd2without rewriting history. Runtime validation built source at fix commitf5d5756c799d2257de279a0963d93068e9f43fff; the final main merge changes none of libc/libkernel/libSceLibcInternal, their test sources or SceTypes.hpp, confirmed by tree comparison.66e1f7f993c9c1339c2de11264b76bab03218cd2reproduces the identical assertion. userfaultfd returns EPERM here, so actual Linux write-watch collection is unavailable.05bd71a66bed21dea323da545849781b883fe7f0+ this PR's originala294df92faown diff againstde824c2919+ the two-filef5d5756c79fix. Both reported modes fail before the fix at the original line 924; ordinary mappings pass. After the fix, 15/15 native tests pass: all guest_app_archive and guest_kernel_app_archive modes, guest_file_vector/guest_file_vector_memory, guest_dup, guest_positioned_race, guest_memory and guest_aio. Both #10552 Apple empty-iovec blocks are preserved after archive read error conversion in this support composition. This is support-branch composition evidence, not an assertion that standalone main or the full published tree builds/runs on macOS.--exec --only-sce). All three modes passed: normal mapping (nonzero offset contents, scalar/vector positioned reads, lifetime after descriptor close), missing temporary directory, and damaged archive. Each failure mode repeats both POSIX and SCE boundary checks eight times, checking EIO and unchanged SCE output/cursor. Fixture compression is linked into the driver so its native codec symbols stay local. The complete host-linked regression executable has native helper/weak-import resolution requirements; patched coverage is this focused driver, while the complete archive suite above runs unpatched.python3 tools/check_conventions.py --base origin/main), whitespace and public-header audit pass (399 libraries / 26,750 exports). Overlap scan off5d5756c79against main66e1f7f993completed across 1,848 open PRs, with confirmed adjacency at #10552 (Stdio) and #12271 (debt text). Other conflicting-main comparisons, including #12965, remain inconclusive and the scanner exits nonzero; no clean-overlap claim or new author agreement is made. #10552 composition was inspected and tested as above. Other threads' branches remain untouched.The macOS support composition is reproducible from patch hashes: original PR diff SHA256
83a1be116e75086554aaaadfe53494e2374d5b29b60eeabcc10dfcc1f00a87ba; two-file fix diff SHA256677d4d05aed6d41fcb18d79ebab60a0981ec3e1f1b7ea7fc94ed68172d3bdf4e. Temporary instrumentation, driver and logs are outside the repository. No fresh Windows, complete full-suite, GPU, title/console, performance or combined cancellation-stack run is claimed. Earlier evidence below remains pinned to its original heads.October 31 refresh: exact head
a294df92fa9d61d291251a114691a1e689f4d6b0, preserving published headebf93ca4f62a55df2ef1001b811d1a013a8ef495and merging upstream mainde824c2919ca65086c6324a1e0388866a7327eea. The bounded backing fix was already published in1440791c77a7e1bbee1684f0726a903ed999dd94; this refresh retains it, the checked reads, and maintainer changes. No history was rewritten and no other I/O head was pushed.Fresh validation: Ubuntu 24.04.5 / GCC 13.3 / Release / LinuxKit 7.0.12, linux/amd64 container on Apple silicon. Built the selected test targets and their production libc, libSceLibcInternal, libkernel and libkernel_sys dependencies. Focused CTest selection below: 21/22 passed. Every archive, scalar/vector/positioned-read, AIO and descriptor test passed.
guest_memoryaborted at GuestMemory.cpp:4084 (mincore(0x800000000000, 0, nullptr)errno expectation); after overlaying upstream main and explicitly rebuilding its changed production sources, the identical assertion failed on main too. This is a reproduced baseline/container limitation, not a passing memory suite. userfaultfd returned EPERM, so write-watch collection was unavailable; no actual Linux write-watch coverage is claimed. The archive mmap test also passed a verbose run, including executable mappings with noexec temporary storage.Conventions (
--base origin/main), whitespace and public-header audit passed (393 libraries / 24,536 exports). Fresh overlap scan ran in an isolated clone at this exact head against 1,558 open PRs: confirmed adjacency with #12271 and #12597 (debt text) and #12868 (Stdio readv/preadv return lines). Manually inspected #12868 at619546539e534ea4c05e66460f4b79b30d92895a: retain its private-descriptor admission while keeping this PR's archive result-to-SCE conversion. These are integration seams, not duplicate implementations. No new author agreement is claimed; conflicting-main comparisons remain inconclusive and the scan exits nonzero, as designed. The earlier #11732/#12296 order requests are resolved by their merges; #12682 remains the declared predecessor.Native macOS configuration was attempted but stopped on pre-existing empty LibAtrac9 checkout contents; the original dirty submodules were preserved. No fresh Windows, macOS runtime, full-suite, GPU, title/console, performance, or combined unmerged-stack execution is claimed. The Windows/WSL runs and synthetic benchmark below are historical, pinned to their stated heads; the archive read/backing sources and archive regression file are unchanged between
ebf93ca4f6and this refresh.Historical evidence follows.
Maintenance source head:
ebf93ca4f62a55df2ef1001b811d1a013a8ef495, rebased on fetched main08a10d225306ad102b57408e2ef7566bcfb829b2. The bounded-window implementation is commit1440791c77a(before the latest main refresh:9c840020b8e3b0252cf18c9206f39ee6a42cc37c). Earlier approvals and external bare-metal results at e97bbf0451 are historical, not validation of this head.On that exact integrated head:
libsandrelinker) plus focused test executables passed. CTest selection: 24/24 passed, zero skips, longest 2.50 s.libsandrelinker) plus focused test executables passed. Same applicable selection: 22/22 passed, zero skips, longest 0.94 s. The two Windows-only cases are excluded.guest_kernel_app_archive_*(archive/plain/mmap/mmap-failure/mmap-damaged),guest_app_archive_*,guest_memory,guest_dup,guest_file_vector*,guest_positioned_race,guest_aio*,guest_kernel_sys_aio, and Windowswindows_write_watch. This covers requested-window backing size/content, offset rebasing, COW/shared permissions, protections, partial unmaps, concurrent maps, descriptor duplication/close/reuse, native-handle cleanup, bad pointers and partial vector progress, HostWrite and AIO destinations. Linux additionally constrains RLIMIT_FSIZE: a one-page window of a larger entry succeeds; a two-page request fails with EFBIG, without leaks/cursor changes, and retries after restoring the limit.tools/check_conventions.py --base origin/main,git diff --check, and public-header audit passed (373 libraries, 14,243 exports). Required overlap scan completed. The complete GPU/non-GPU CTest suite was not run; unrelated test executables are not part of the full production build command.Same-machine synthetic archive read measurements, Windows 11, Ryzen 7 9800X3D, WinLibs GCC 15.2, Release. Benchmark source pins: main
1189ec3003672bb364dd9f3119ead7b3976e3c83versus final integrated implementationebf93ca4f62a55df2ef1001b811d1a013a8ef495. Main is the baseline fetched at the start of this maintenance pass; it is not relabeled as the later main revision. identical benchmark executable, archive and APIs (sceKernelOpen/Read/Lseek/Close). Three alternating main/change runs, one warm-up per workload per process, seven recorded samples each (21 samples per cell). Large workload: 256 MiB in 256 reads of 1 MiB. Small workload: 65,536 sequential reads of 64 bytes (4 MiB). First/last bytes and checksums are verified per call; archive creation is outside timing. Host compiler jobs were active, so ranges include contention and these are synthetic cost measurements, not controlled game/scene performance evidence. No trace_digest/game speed claim is made.The checked copy has a substantial measured cost. It is retained to preserve the fault/partial-progress contract; HostWrite alone is insufficient. The implementation bounds mapping storage independently of this read-path tradeoff.
No macOS runtime, PS5/console, title, GPU or combined unmerged-dependency runtime result is claimed unless separately pinned below.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Reproducible synthetic read benchmark
Historical overlap scan on
ebf93ca4f6(isolated scan clone, branch aliasarchive-maint-review, same exact SHA): completed against 1,453 open PRs on main08a10d225306. Confirmed overlaps are this PR itself (same new file), #12682 (Stdio.cpp, declared predecessor), and docs adjacency with #8965 and #12271. The doc-adjacency order is not agreed; no agreement is invented and no contributor message was sent. Other shared-file comparisons that conflict with main remain inconclusive. The earlier #12296 and #11732 requests are already resolved by their merges.For the later #12682 integration, retain its POSIX Io, descriptor-admission and HostWrite/OpenIovecs scopes, applying the archive native-error conversion separately at the POSIX and SCE return boundaries. The published predecessor head inspected on October 31 is
55161f97476a8bd413c279829cabb6390307e4d5. #12688 transport and #12700 writes remain open downstream of it; they are not additional direct prerequisites of this archive PR. No combined execution with an unpublished refresh is claimed.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T23:36:18Z.
Review: APPROVED
Reviewed exact head
e97bbf045122e4326b0f5332a9844df37bd1d5dc. Archive mappings materialize a request-local read-only backing object, preserve loose-file precedence and descriptor cursor/lifetime semantics, and retain the regular-file mapping path for validation, protections and unmaps. The archive read changes scatter through checked guest writes and translateEFAULTat the public wrappers. The tests cover offset/alignment/EOF behavior, private/shared protections, descriptor replacement/close, partial unmaps, damage and backing failures. Hosted conventions, eligibility, intake, labels, report, register-context, relinker, ASan and write-watch checks pass; product build jobs are skipped by path policy. The author reports Windows and WSL full builds and focused tests, with the DrvFS-only inotify failure explicitly excluded; I did not independently rerun the local suite. I found no blocking issue.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T01:16:48Z.
Review: COMMENTED
First bare-metal Linux run, since the Linux results in the PR are from WSL2 and the
memfd+/proc/self/fdbacking is Linux-only.Exact head
e97bbf045122e4326b0f5332a9844df37bd1d5dc, merged onmaincb45ae2dd. Linux x86_64 (bare metal, ext4), i7-8700, Ubuntu 26.04, kernel 7.0, GCC 15.2, glibc 2.43, CMake 4.2.3, Ninja, Release,BUILD_TESTING=ON, full build.guest_kernel_app_archive_*tests (archive,plain,mmap,mmap-failure,mmap-damaged) pass, 3 of 3 runs.guest_filesystempasses here, so the inotify assertion that failed on DrvFS is fine on a native filesystem.guest_kernel*,guest_stdio*,guest_file*,guest_mmap*,guest_app*, ...) passes. Full non-GPU suite on the samemainwithout the PR: 1361/1361.main(AppArchive*, the libcCMakeLists.txt,PosixMemory.cpp,ArchivedFile.cpp,Open.cpp,Stdio.cpp; new tests and their CMake modes kept),mmap,mmap-failureandmmap-damagedabort withmmap on a file read from app0.zar, fd=7 not implemented;archiveandplainstill pass.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T20:52:42Z.
Review: APPROVED
Reviewed — approved
mmaponapp0.zarfiles now goes through the regular-file mapping path, backed by a separate read-only copy of the requested window for each mapping. The change builds, the focused tests pass on Linux, and both negative controls fail as expected. I found nothing blocking. There are three non-blocking notes; the main one is the cost of the read path.What I ran
Head
783098aabe1d930b25a10c85280ed02a4c219f1f,main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged with--no-ffin a clean worktree (merged treee34c6e0da86340e7048a4bdd82ea4c60d3f5f5d1). Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja,BUILD_TESTING=ON.Results
maingit diff --checkcheck_conventions.pylibs(script)main;guest_net_ctlskip also happens onmainguest_kernel_app_archive_mmap,-mmap-failure,-mmap-damagedNotes from the verbose mmap run
On this machine the noexec-storage branch of
MappingStorageIndependencewas skipped. Only the missing-directory variant ran.guest_memorypassed here. The author's container run failed it on the zero-lengthmincoreassertion, which they also reproduced onmain. That failure does not happen on this machine.Negative control
PosixMemory.cppfrommain, everything else merged). All three mmap modes fail, andarchiveandplainstill pass:AppArchiveDescriptorRead_nid_no_patchusesmain's directAppArchiveReadinto the destination.guest_kernel_app_archive_mmapthen crashes the host process (***Exception: SegFault), and the other four modes pass. So the bounce-buffer copy is what keeps the new invalid-destination cases (MappingReadDestinations) from crashing. This adds evidence to the second question in oneandonlydean's comment: the outerHostWriteguard alone does not prevent the crash.git status --porcelainis empty.Findings
Blocking
None.
Non-blocking
app0.zarread now pays the per-page checked copy (core/libs/prx/libc/src/AppArchive.cpp:258and:277). This affects all archive reads, not only mappings. Each 4 KiB chunk costs oneAppArchiveReadplus oneGuestCopyOut. The author's own figures show about 4× slower large reads and about 7× slower small reads. Control B confirms the check is needed for safety. However, partial progress only has to be page-exact when a copy fails.AppArchiveMaterialize_nid_no_patchalready uses), and fall back to page-by-page copying only when a chunk'sGuestCopyOutfails. That keeps the EFAULT-before-progress and partial-count behaviour and should recover most of the cost on valid destinations.core/libs/prx/libc/src/AppArchive.cpp:244-246).AppArchiveMaterialize_nid_no_patchdecompresses and writes the whole requested window while holdingfile->mutex. Reads, seeks and other mappings on the same descriptor, and on its duplicates, which share the attachment, block for the whole copy. That can be a long wait for a large window. It is correct, but the file node could be copied under the lock and the materialization run after releasing it.docs/dev/debt/libc.md:273in the merged tree). The rewritten entry lists onlyfopen,access,lstatandfdopenas unsupported. However,ResolvePath_nid_no_patchandResolvePathOrRelinkedModule_nid_no_patch(core/libs/prx/libc/src/General.cpp:862-872) still throw for any archive-only path, and so does thechdirpath (General.cpp:920). The previous wording ("any call other than the archive-aware libkernel ones throws") was the accurate gap statement. Consider keeping that general sentence instead of the short list.Not verified
CreateFileW/ReOpenFiledelete-on-close backing, private snapshot path) and macOS (mkstemp+ unlink backing, the errno-publication fix inf5d5756c79). This machine is Linux only. The macOS fix is covered by imellag's confirmation on the support branch, not by me.MappingStorageIndependence: no writable noexec filesystem was available here.mainwithout it, so the dependency looks like merge ordering only.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T07:10:34Z.
Review: COMMENTED
Reviewed — comments
The archive mapping implementation and targeted tests were inspected at head
00a2d202a33c9b09e38321962cefacd1506db1b8; material review requirements remain because not every changed file was read.What I ran
Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
The full contents of
core/libs/prx/libc/CMakeLists.txt,core/libs/prx/libc/include/AppArchive.hpp,core/libs/prx/libkernel/CMakeLists.txt,core/libs/prx/libkernel/File/src/Open.cpp,core/libs/prx/libkernel/File/src/Stdio.cpp, anddocs/dev/debt/libc.mdanddocs/dev/debt/libkernel.mdwere not read. The full test additions incore/libs/tests/GuestKernelAppArchive.cppwere not read. No build or test was run independently.To get this to a good state
Nothing is required. Optional: complete inspection of the unread changed-file portions before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T18:50:11Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix the Windows backing handle lifetime so archive mappings remain readable after the temporary descriptor is closed.
What I ran
Reviewed head
86b4b73041f30a97b5a2521b4fae801b4b141e5busing the prepared diff andrepo_read.pyfor targeted source context. No build or test command was run; reported test results are author supplied.Results
Findings
Blocking
core/libs/prx/libc/src/AppArchiveBacking.cpp:104:ReOpenFileopens the reader handle withFILE_FLAG_DELETE_ON_CLOSE. Windows delete-on-close marks the file for deletion when that reader handle closes, regardless of the writer handle still being open.Mapthen closes the returned descriptor when its localArchiveMappingDescriptoris destroyed (core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp:62-68), so the backing file can be deleted immediately aftermmapreturns. For Windows private mappings,MapPrivateFileCopyreads from that descriptor only after returning from the materializer, and Windows shared mappings also need the backing file to stay present forDoMapFileBacked_nid_no_patch; this can cause mapping failure or break later file-backed operations. Avoid delete-on-close on the reader handle and retain a lifetime mechanism that removes the temporary file only after the mapping source is no longer needed.Non-blocking
None.
Not verified
manifest.json; all are marked included. The description, commits, manifest, and diff were read.files.jsonwas not available from the review reader.description.mdand test implementation outside the targeted ranges were not read.To get this to a good state
Remove the reader handle's delete-on-close behavior and ensure temporary backing storage remains available for the lifetime required by the Windows mapping implementation. Then rerun the Windows archive mmap tests, including mapping survival after the source descriptor closes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T19:12:33Z.
Review: APPROVED
Reviewed — looks good
The inspected archive mapping and read paths appear sound; the prepared report records successful Windows checks, while I did not run checks in this review.
What I ran
4a2b14298c386cf90332d35bbc2e5c8314d2993fusing the prepared description, commits, manifest, diff, and targeted source ranges throughrepo_read.py.Results
Findings
Blocking
None in the inspected code.
Non-blocking
Sources
Not verified
description.md, not independently verified here.manifest.jsonwere read through the prepared diff or targeted source reads; full source text was read forAppArchive.cpp,PosixMemory.cpp, andArchivedFile.cpp. I did not read every line ofGuestKernelAppArchive.cpp,AppArchiveBacking.cpp,Open.cpp,Stdio.cpp, either CMake file, or the debt document.files.jsonwas unavailable through the reader, so excluded-by-rule files were not verified.To get this to a good state
Nothing is required. Optional: consider measuring the mutex hold time for large mappings before changing the serialization strategy.