fix(libkernel): create /data at start-up #4690

Merged
David-cmrg merged 1 commit from upstream-pr/4690 into main 2026-10-13 02:37:27 +00:00
David-cmrg commented 2026-10-12 19:04:33 +00:00 (Migrated from github.com)

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 /data resolved to a missing data directory in the run folder, and titles that probe it stopped (ProsperoEden, PS5CEMU-HAR).

libkernel now creates data in the run folder at start-up. It sits beside download0 and is created under the condition that marks a title's run folder: app0/sce_sys/param.json exists. A process that loads libkernel anywhere else creates nothing; this includes the AGC tests, which run in the source tree.

download_data_mount now also requires data in its three cases that have a param.json (declared, none, invalid). A new missing case has no param.json in its run folder and requires that neither data nor download0 is created there. The test removes data before asserting, so a failed run leaves nothing behind for the next one.

Tested

Fedora 44, kernel 6.19.10, GCC 16.2.1, Release, main 2a5eca11c.

  • download_data_mount_declared, _none and _invalid: with the test change alone, all 3 abort (no data); with the fix, all 3 pass.
  • download_data_mount_missing, after a rebase onto main d53960612: passes with the fix and fails when the param.json check is removed from the new initializer. All four cases pass with the fix.
  • ctest -R '^guest_|download_data|param_json': 314/314 pass, and no data directory appears in the source tree.
  • ProsperoEden (PPSA99008) v1.000.110 from the homebrew catalog, zip sha256 cabe26af81dbccfc6fc2d3c7e42e7a1295c85c6a2f631bee8043debdd9f7f8f6. eboot.bin and sce_module/libc.prx were 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.
    • This branch: +27ms filesystem access returned status=0 after a single probe. The title continues to its first draw, which stops on this machine (Intel HD 520, Mesa 26.2.4) with AGC graphics: viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted: ANV has no such extension, the case #4650 handles.
  • #4648 makes the same change without the condition, at the top of the download0 initializer. With it, a single agc_driver_cross_workgroup_flag run, whose working directory is the source tree, leaves an empty data directory in the repository root.
  • Windows not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99008 (#4643)
  • AI-assisted: yes (Claude Opus 5.5)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4833816620 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4690). Originally posted by [David-cmrg](https://github.com/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 `/data` resolved to a missing `data` directory in the run folder, and titles that probe it stopped (ProsperoEden, PS5CEMU-HAR). libkernel now creates `data` in the run folder at start-up. It sits beside `download0` and is created under the condition that marks a title's run folder: `app0/sce_sys/param.json` exists. A process that loads libkernel anywhere else creates nothing; this includes the AGC tests, which run in the source tree. `download_data_mount` now also requires `data` in its three cases that have a `param.json` (`declared`, `none`, `invalid`). A new `missing` case has no `param.json` in its run folder and requires that neither `data` nor `download0` is created there. The test removes `data` before asserting, so a failed run leaves nothing behind for the next one. ### Tested Fedora 44, kernel 6.19.10, GCC 16.2.1, Release, `main` `2a5eca11c`. - `download_data_mount_declared`, `_none` and `_invalid`: with the test change alone, all 3 abort (no `data`); with the fix, all 3 pass. - `download_data_mount_missing`, after a rebase onto `main` `d53960612`: passes with the fix and fails when the `param.json` check is removed from the new initializer. All four cases pass with the fix. - `ctest -R '^guest_|download_data|param_json'`: 314/314 pass, and no `data` directory appears in the source tree. - ProsperoEden (PPSA99008) v1.000.110 from the homebrew catalog, zip sha256 `cabe26af81dbccfc6fc2d3c7e42e7a1295c85c6a2f631bee8043debdd9f7f8f6`. `eboot.bin` and `sce_module/libc.prx` were 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. - This branch: `+27ms filesystem access returned status=0` after a single probe. The title continues to its first draw, which stops on this machine (Intel HD 520, Mesa 26.2.4) with `AGC graphics: viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted`: ANV has no such extension, the case #4650 handles. - #4648 makes the same change without the condition, at the top of the `download0` initializer. With it, a single `agc_driver_cross_workgroup_flag` run, whose working directory is the source tree, leaves an empty `data` directory in the repository root. - Windows not tested. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99008 (#4643) - [x] AI-assisted: yes (Claude Opus 5.5)
MarcZX10 commented 2026-10-12 19:09:17 +00:00 (Migrated from github.com)

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.json and asserts that data is not created? The existing download_data_mount_* cases all create param.json before 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 creating data in test or source working directories.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5494988815 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4690#pullrequestreview-5494988815). Originally posted by [MarcZX10](https://github.com/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.json` and asserts that `data` is not created? The existing `download_data_mount_*` cases all create `param.json` before 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 creating `data` in test or source working directories.
David-cmrg commented 2026-10-12 19:27:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by David-cmrg on 2026-10-12T19:27:59Z.


Added download_data_mount_missing: its run folder has no app0/sce_sys/param.json, and the test requires that libkernel created neither data nor download0 there. With the param.json check removed from the new initializer this case fails; with it, all four cases pass. The test now removes data before asserting, so a failed run leaves nothing behind for the next one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6131148041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4690#issuecomment-6131148041). Originally posted by [David-cmrg](https://github.com/David-cmrg) on 2026-10-12T19:27:59Z. --- Added `download_data_mount_missing`: its run folder has no `app0/sce_sys/param.json`, and the test requires that libkernel created neither `data` nor `download0` there. With the `param.json` check removed from the new initializer this case fails; with it, all four cases pass. The test now removes `data` before asserting, so a failed run leaves nothing behind for the next one.
babyhuey commented 2026-10-13 00:22:28 +00:00 (Migrated from github.com)

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 main 1c5e6287 + this PR (fork test/verify-data, a16d0993; it merges clean). In fresh run folders that have app0/sce_sys/param.json, data is created about 0.1 s after launch, before the title touches it.

  • Porpoise (PPSA99764): on main it 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 logs main: 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 at VideoOut: port already open. That's a separate stop.
  • ProsperoEden (PPSA99008, --trap-sdk-syscall-stubs): on main it opens /data/.lapy_probe_* for about 2.5 s and aborts with filesystem access returned status=9. With this PR one probe succeeds: +32ms filesystem access returned status=0, then opening the launcher with its EGL/GL surface.

One thing to be aware of, not a problem for these titles: since data is only created when app0/sce_sys/param.json exists, a title without one still gets no /data.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135200258 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4690#issuecomment-6135200258). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-13T00:22:28Z. --- Checked this on Windows 11 (WinLibs GCC 15.2, RTX 3080) with two titles from #4643, on `main` 1c5e6287 + this PR (fork `test/verify-data`, a16d0993; it merges clean). In fresh run folders that have `app0/sce_sys/param.json`, `data` is created about 0.1 s after launch, before the title touches it. - **Porpoise (PPSA99764):** on `main` it 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 logs `main: 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 at `VideoOut: port already open`. That's a separate stop. - **ProsperoEden (PPSA99008, `--trap-sdk-syscall-stubs`):** on `main` it opens `/data/.lapy_probe_*` for about 2.5 s and aborts with `filesystem access returned status=9`. With this PR one probe succeeds: `+32ms filesystem access returned status=0`, then `opening the launcher` with its EGL/GL surface. One thing to be aware of, not a problem for these titles: since `data` is only created when `app0/sce_sys/param.json` exists, a title without one still gets no `/data`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4690
No description provided.