Repository navigation
feat(libkernel): map app0.zar archive-backed files - #11625
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
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 translate EFAULT at 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.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
jotitadev
left a comment
There was a problem hiding this comment.
First bare-metal Linux run, since the Linux results in the PR are from WSL2 and the memfd + /proc/self/fd backing is Linux-only.
Exact head e97bbf045122e4326b0f5332a9844df37bd1d5dc, merged on main cb45ae2dd. 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.
- The 5
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.- A wider subset of 76 file, stdio, mmap and app-archive tests (
guest_kernel*,guest_stdio*,guest_file*,guest_mmap*,guest_app*, ...) passes. Full non-GPU suite on the samemainwithout the PR: 1361/1361. - With the implementation reverted to
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.
|
@Felipebmaitan my docs-only #11732 appends to the AI-assisted: yes (Claude Code) |
|
For coordination with #11872, I am selecting #11872 first, then #11625 for these two PRs under my account. The later archive-mapping rebase must retain the POSIX Io/descriptor admission and HostWrite scopes while applying this PR's archive result-to-POSIX/SCE error mapping, keeping the two return conventions separate. Archive mmap work remains in this PR. Combined checks should retain archive read/positioned/vector/mapping and descriptor close/reuse cases. This records the merge-order decision; I have updated only this PR's Depends on line to #11872 for merge ordering. Its branch head and source files are unchanged; no combined runtime test is claimed. AI-assisted coordination. |
|
@Felipebmaitan the mapping side reads right to us: the sealed memfd reopened read-only on Linux, the helper descriptor closed before
|
|
@Felipebmaitan a merge-order question from #12296 (Windows: map shared-memory descriptors with the regular-file checks). The repository's overlap check pairs the two PRs on CONTRIBUTING asks overlapping authors to agree on an order and record it under Depends on. #12296 is small and its reviewer otherwise found no defect, so I'd propose #12296 lands first and the rebase here is the small textual merge described above. If you'd rather this PR go first, say so and I'll set Depends on: #11625 on #12296 and do the rebase myself after yours lands. Either works for me. AI-assisted: yes (Claude Code). |
✅ AMD GPU test: passedPR head
Unstable on main (6, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (12, not counted against this PR)Validated but not compared (64, not in the main baseline's validation pass)Validation IDs already present on main (8 IDs in 797 tests)Skipped (62)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
@XairRrR corrected the documentation mismatch in I’ve recorded the other two notes as nonblocking follow-ups, consistent with your approval. Checked per-page copies retain EFAULT/partial-progress/cursor/HostWrite behavior; your control B independently demonstrates the safety need. A bulk-copy fallback must account for bytes already written by a failed bulk check and retain page-exact progress before any speed benefit can be claimed. The descriptor attachment mutex currently covers the entire materialization and serializes reads/seeks/maps on duplicates sharing that attachment. A shorter node-snapshot lock is a plausible follow-up with lifetime/concurrency validation. No optimization or speed claim is added here, and maintainer acceptance of the existing read-cost evidence remains separate. The full PR template now pins your 22/22 Linux run and both negative controls to For Windows, run Source audit, committed-diff whitespace and |
❌ AMD GPU test: failedPR head
Failing testsThis PR changes test files, so each failing test was also built and run on main with only the PR's test changes applied. ✅ there means the failure comes from the PR's other changes; ❌ means the test fails on main too, so this run does not show the PR caused it.
agc_graphics_profile_draw: Timeout (also failed when re-run alone), assertion and diagnosticsUnstable on main (5, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (10, not counted against this PR)Validation IDs already present on main (4 IDs in 807 tests)Skipped (71)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
MarcZX10
left a comment
There was a problem hiding this comment.
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
- Read the prepared description, commit list, manifest, diff, and selected changed-file and caller ranges through the pinned reader.
- No build or tests were run in this review; reported test results are author-provided.
Results
| Check | Result | Note |
|---|---|---|
| Changed code inspection | not run | Review was targeted, not exhaustive |
| Build and tests | not run | Results in the description are author-reported |
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, and docs/dev/debt/libc.md and docs/dev/debt/libkernel.md were not read. The full test additions in core/libs/tests/GuestKernelAppArchive.cpp were 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.
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
MarcZX10
left a comment
There was a problem hiding this comment.
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 86b4b73041f30a97b5a2521b4fae801b4b141e5b using the prepared diff and repo_read.py for targeted source context. No build or test command was run; reported test results are author supplied.
Results
| Check | Result | Note |
|---|---|---|
| Source review | failed | Windows backing lifetime defect |
| Build and tests | not run | Current-head runs reported by author |
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
- No commands or tests were run in this review. Current-head Windows harnesses and syntax checks are reported in the PR description, not independently verified here; end-to-end guest mmap and fresh Linux/macOS execution are reported as pending.
- Reviewed all 10 changed files listed in
manifest.json; all are marked included. The description, commits, manifest, and diff were read.files.jsonwas not available from the review reader. - The remaining 7 lines of
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.
|
@MarcZX10 I updated the Windows backing lifetime in On Windows 11 build 26300, both the read-only and executable native-view tests passed after closing the section handle and descriptor. The backing directory was clear after unmap. Descriptor reads and truncated-input cleanup also passed. The native lifetime reproducer passed with the previous flags on this machine too. The registered guest CTests for the new head are queued behind the shared Windows build mutex; the PR body records the distinction in coverage. |
|
@MarcZX10 The requested end-to-end Windows rerun passed at |
MarcZX10
left a comment
There was a problem hiding this comment.
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
- Reviewed head
4a2b14298c386cf90332d35bbc2e5c8314d2993fusing the prepared description, commits, manifest, diff, and targeted source ranges throughrepo_read.py. - No commands or tests were run by me. The Windows test results below are reported by the author.
Results
| Check | Result | Note |
|---|---|---|
| Targeted source review | passed | Mapping, backing and checked reads inspected |
| Windows CTest | passed | 26/26, author reported |
| Linux and macOS execution | not run | Fresh execution remains pending |
Findings
Blocking
None in the inspected code.
Non-blocking
- The materialization path intentionally holds the shared descriptor mutex while copying the requested archive window. Large mappings can therefore serialize reads, seeks and maps through duplicate descriptors; the description records this tradeoff and does not claim a performance improvement.
Sources
- PosixMemory.cpp at reviewed head
- AppArchive.cpp at reviewed head
- AppArchiveBacking.cpp at reviewed head
Not verified
- I did not run builds or tests. Windows 11 / WinLibs GCC 15.2 results, including 26/26 registered guest CTests, are author reported in
description.md, not independently verified here. - Fresh Linux and macOS execution, physical console behavior, and the full repository test suite were not verified.
- All 10 changed files marked included in
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.
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 fix(libc): sort with FreeBSD 11.4's heapsort.c in heapsort #16861 overlap was manually inspected: adjacent libkernel debt edits, with no archive implementation overlap. Live feat(libc): support archive-backed stdio reads #7447 atdead12ebad24a3c4b01a05c14ab60cc06aacaf7dremains a stdio feature without mmap capability; feat(libkernel): support SEEK_DATA and SEEK_HOLE in lseek #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 on 4138def.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. fix(libkernel): build the file, module and rtld calls on macOS hosts #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 original a294df9 own diff against de824c2 + the two-file f5d5756 fix. 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 fix(libkernel): build the file, module and rtld calls on macOS hosts #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 of f5d5756 against main 66e1f7f completed across 1,848 open PRs, with confirmed adjacency at fix(libkernel): build the file, module and rtld calls on macOS hosts #10552 (Stdio) and fix(libc): sort with FreeBSD 11.4's merge.c in mergesort #12271 (debt text). Other conflicting-main comparisons, including feat(libkernel): support deferred cancellation in POSIX accept #12965, remain inconclusive and the scanner exits nonzero; no clean-overlap claim or new author agreement is made. fix(libkernel): build the file, module and rtld calls on macOS hosts #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 ebf93ca and 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 e97bbf0 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 ebf93ca (isolated scan clone, branch alias
archive-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.