fix(libkernel): create /data at start-up #4690
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4690"
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 David-cmrg on 2026-10-12T19:04:33Z.
What
Fixes #4643.
Homebrew titles see uid 0 under AnyPS5. On a console that means a jailbroken app that can reach
/data. Nothing created that directory, so a guest path under/dataresolved to a missingdatadirectory in the run folder, and titles that probe it stopped (ProsperoEden, PS5CEMU-HAR).libkernel now creates
datain the run folder at start-up. It sits besidedownload0and is created under the condition that marks a title's run folder:app0/sce_sys/param.jsonexists. A process that loads libkernel anywhere else creates nothing; this includes the AGC tests, which run in the source tree.download_data_mountnow also requiresdatain its three cases that have aparam.json(declared,none,invalid). A newmissingcase has noparam.jsonin its run folder and requires that neitherdatanordownload0is created there. The test removesdatabefore asserting, so a failed run leaves nothing behind for the next one.Tested
Fedora 44, kernel 6.19.10, GCC 16.2.1, Release,
main2a5eca11c.download_data_mount_declared,_noneand_invalid: with the test change alone, all 3 abort (nodata); with the fix, all 3 pass.download_data_mount_missing, after a rebase ontomaind53960612: passes with the fix and fails when theparam.jsoncheck is removed from the new initializer. All four cases pass with the fix.ctest -R '^guest_|download_data|param_json': 314/314 pass, and nodatadirectory appears in the source tree.cabe26af81dbccfc6fc2d3c7e42e7a1295c85c6a2f631bee8043debdd9f7f8f6.eboot.binandsce_module/libc.prxwere unwrapped and relinked with--to-intel --trap-sdk-syscall-stubs. Import audit: 437 implemented, 5 stubs, 0 absent.main:/data/.lapy_probe_<pid>is opened in a loop, then[ProsperoEden diag] +2554ms filesystem access returned status=9, uid 0/0 gid 0/0, and the title aborts.+27ms filesystem access returned status=0after a single probe. The title continues to its first draw, which stops on this machine (Intel HD 520, Mesa 26.2.4) withAGC graphics: viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted: ANV has no such extension, the case #4650 handles.download0initializer. With it, a singleagc_driver_cross_workgroup_flagrun, whose working directory is the source tree, leaves an emptydatadirectory in the repository root.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:09:17Z.
Review: COMMENTED
Could we add a regression case that loads libkernel from a working directory without
app0/sce_sys/param.jsonand asserts thatdatais not created? The existingdownload_data_mount_*cases all createparam.jsonbefore the library loads, so they cover creation in a title run folder but do not exercise the new guard described in the PR body. This would protect against accidentally creatingdatain test or source working directories.Imported from boykopovar/AnyPS5. Originally posted by David-cmrg on 2026-10-12T19:27:59Z.
Added
download_data_mount_missing: its run folder has noapp0/sce_sys/param.json, and the test requires that libkernel created neitherdatanordownload0there. With theparam.jsoncheck removed from the new initializer this case fails; with it, all four cases pass. The test now removesdatabefore asserting, so a failed run leaves nothing behind for the next one.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-13T00:22:28Z.
Checked this on Windows 11 (WinLibs GCC 15.2, RTX 3080) with two titles from #4643, on
main1c5e6287+ this PR (forktest/verify-data, a16d0993; it merges clean). In fresh run folders that haveapp0/sce_sys/param.json,datais created about 0.1 s after launch, before the title touches it.mainit waits for a jailbreak forever (jailbreak: /data isn't reachable (uid 0); asking the HEN, then polling ports 9028/9069). With this PR there are no jailbreak lines at all. It logsmain: firmware 1.00, its memory and processor set-up, brings up its Vulkan stack (PlayStation 5 GPU (RADV NAVI21)), walks/app0/system/dolphin-emu/Sys, and stops later atVideoOut: port already open. That's a separate stop.--trap-sdk-syscall-stubs): onmainit opens/data/.lapy_probe_*for about 2.5 s and aborts withfilesystem access returned status=9. With this PR one probe succeeds:+32ms filesystem access returned status=0, thenopening the launcherwith its EGL/GL surface.One thing to be aware of, not a problem for these titles: since
datais only created whenapp0/sce_sys/param.jsonexists, a title without one still gets no/data.