fix(relinker): write Linux and macOS executables with execute permission #5695

Merged
YossiYad merged 4 commits from upstream-pr/5695 into main 2026-10-15 12:15:09 +00:00
YossiYad commented 2026-10-14 07:10:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-14T07:10:25Z.


What

The relinker writes its executables with the default file mode, 0644 under a 022 umask. USAGE.md says to chmod +x app.elf, but nothing covers the outputs of --executable (#4786). A title that starts one of them with sceSystemServiceLoadExec then stops at the execv:

what():  sceSystemServiceLoadExec: execv failed: Permission denied
  • main.cpp adds execute permission for owner, group and others to each Linux and macOS executable output after writing it, the same bits --autorun already adds to app.elf. If that fails, the conversion fails and names the file.
  • relinker_executables checks the bits on app.elf and picker.picker.bin.elf.
  • USAGE.md drops the chmod step and keeps it for copies that lost their mode (a browser download, for example), with the error a missing bit gives.

Title. RetroArch (PPSA99169, catalog release) starts its frontend picker with sceSystemServiceLoadExec("/app0/picker/picker.bin"), and the picker then starts ES-DE (/app0/es-de/es-de.bin). Converted with --executable picker/picker.bin --executable es-de/es-de.bin and run after the documented chmod +x app.elf, it stopped with the error above as soon as it started the picker. With this PR all three outputs are -rwxr-xr-x straight from the relinker and RetroArch starts the picker. In an earlier run with the same bits set by hand, the picker also started ES-DE (its es-de-ps5.log reaches ES-DE returned 0).

Tested

Linux (Bazzite 44, GCC 16.2.1, Ninja, Release, -DBUILD_TESTING=ON), based on main d8888df9b:

  • Full build and ctest: 1105 of 1106 pass. agc_driver_tessellation segfaults on unchanged main here too.
  • relinker_executables fails with the previous main.cpp (app.elf is 0o100644).
  • Title run (distrobox, RX 7700 XT): fresh conversion with this relinker, no chmod. Before: the execv error and SIGABRT when the picker starts. After: the picker starts and waits on its menu.
  • tools/check_conventions.py --base upstream/main and tools/pr_overlap.py (no overlap) pass. macOS and Windows were not built here. Windows outputs are not touched.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99169 (RetroArch picker and ES-DE)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4854288770 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5695). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-14T07:10:25Z. --- ### What The relinker writes its executables with the default file mode, 0644 under a 022 umask. `USAGE.md` says to `chmod +x app.elf`, but nothing covers the outputs of `--executable` (#4786). A title that starts one of them with `sceSystemServiceLoadExec` then stops at the `execv`: ``` what(): sceSystemServiceLoadExec: execv failed: Permission denied ``` - `main.cpp` adds execute permission for owner, group and others to each Linux and macOS executable output after writing it, the same bits `--autorun` already adds to `app.elf`. If that fails, the conversion fails and names the file. - `relinker_executables` checks the bits on `app.elf` and `picker.picker.bin.elf`. - `USAGE.md` drops the `chmod` step and keeps it for copies that lost their mode (a browser download, for example), with the error a missing bit gives. **Title.** RetroArch (PPSA99169, catalog release) starts its frontend picker with `sceSystemServiceLoadExec("/app0/picker/picker.bin")`, and the picker then starts ES-DE (`/app0/es-de/es-de.bin`). Converted with `--executable picker/picker.bin --executable es-de/es-de.bin` and run after the documented `chmod +x app.elf`, it stopped with the error above as soon as it started the picker. With this PR all three outputs are `-rwxr-xr-x` straight from the relinker and RetroArch starts the picker. In an earlier run with the same bits set by hand, the picker also started ES-DE (its `es-de-ps5.log` reaches `ES-DE returned 0`). ### Tested Linux (Bazzite 44, GCC 16.2.1, Ninja, Release, `-DBUILD_TESTING=ON`), based on `main` `d8888df9b`: - Full build and `ctest`: 1105 of 1106 pass. `agc_driver_tessellation` segfaults on unchanged `main` here too. - `relinker_executables` fails with the previous `main.cpp` (`app.elf` is `0o100644`). - Title run (distrobox, RX 7700 XT): fresh conversion with this relinker, no `chmod`. Before: the `execv` error and SIGABRT when the picker starts. After: the picker starts and waits on its menu. - `tools/check_conventions.py --base upstream/main` and `tools/pr_overlap.py` (no overlap) pass. macOS and Windows were not built here. Windows outputs are not touched. ### 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 - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99169 (RetroArch picker and ES-DE) - [x] GPUs tested: n/a - [x] AI-assisted: yes
Bruggi-ch commented 2026-10-14 09:17:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Bruggi-ch on 2026-10-14T09:17:46Z.


macOS data point for the --executable permission change, since the description only covers Linux.

  • Apple M5 (MacBook Air), macOS 27.0.1, Apple clang 21.0.0, CMake 4.4.4, Ninja
  • main at 66f894761 with this PR merged on top (c31b519e3), relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON), native arm64
  • ctest: 149 of 149 pass, including relinker_executables
  • Without the main.cpp change (test kept): relinker_executables fails on macOS with the same assertion, app.elf is 0o100644. With it, it passes.

I did not run a title, and the test only checks the Linux ELF outputs of --executable; I did not check the permission of --macos output separately.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165044479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5695#issuecomment-6165044479). Originally posted by [Bruggi-ch](https://github.com/Bruggi-ch) on 2026-10-14T09:17:46Z. --- macOS data point for the `--executable` permission change, since the description only covers Linux. - Apple M5 (MacBook Air), macOS 27.0.1, Apple clang 21.0.0, CMake 4.4.4, Ninja - `main` at `66f894761` with this PR merged on top (`c31b519e3`), relinker-only build (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`), native arm64 - `ctest`: **149 of 149 pass**, including `relinker_executables` - Without the `main.cpp` change (test kept): `relinker_executables` fails on macOS with the same assertion, `app.elf` is `0o100644`. With it, it passes. I did not run a title, and the test only checks the Linux ELF outputs of `--executable`; I did not check the permission of `--macos` output separately. AI-assisted: yes (Claude Code)
YossiYad commented 2026-10-14 09:32:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-14T09:32:28Z.


Thanks @Bruggi-ch, that covers the half I couldn't build here.

On the part you left open: 563ff6350 adds a --macos case to relinker_executables. It converts the picker case to Mach-O on the Linux runner and requires both outputs (app.elf and picker.picker.bin.elf, cffaedfe) to be executable. With the change limited to Linux outputs (!args.toWindows && !args.toMacos), the new check fails with macos-picker/out/app.elf at 0o100644; with the PR it passes.

I also built this PR together with my other open ones (#5053, #5218, #5699, #5734) on main 43349d433 and ran the full ctest on Linux: 1110 of 1112 pass. agc_driver_tessellation segfaults on this machine without any change, and agc_host_import_sparse (new on main with #5309) fails the same way on main alone here (a failure at vkQueueBindSparse after the sparse path was chosen did not throw), where UDMABUF_CREATE is refused.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165301293 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5695#issuecomment-6165301293). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-14T09:32:28Z. --- Thanks @Bruggi-ch, that covers the half I couldn't build here. On the part you left open: `563ff6350` adds a `--macos` case to `relinker_executables`. It converts the picker case to Mach-O on the Linux runner and requires both outputs (`app.elf` and `picker.picker.bin.elf`, `cffaedfe`) to be executable. With the change limited to Linux outputs (`!args.toWindows && !args.toMacos`), the new check fails with `macos-picker/out/app.elf` at `0o100644`; with the PR it passes. I also built this PR together with my other open ones (#5053, #5218, #5699, #5734) on `main` `43349d433` and ran the full `ctest` on Linux: 1110 of 1112 pass. `agc_driver_tessellation` segfaults on this machine without any change, and `agc_host_import_sparse` (new on `main` with #5309) fails the same way on `main` alone here (`a failure at vkQueueBindSparse after the sparse path was chosen did not throw`), where `UDMABUF_CREATE` is refused.
github-actions[bot] commented 2026-10-14 23:14:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T23:14:58Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#6127 core/relinker/main.cpp L313-318

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.

Pull request Shared files not compared
#3891 docs/user/USAGE.md
#4156 docs/user/USAGE.md
#4396 docs/user/USAGE.md
#4397 docs/user/USAGE.md
#4422 docs/user/USAGE.md
#4423 docs/user/USAGE.md
#4424 docs/user/USAGE.md
#4520 docs/user/USAGE.md
#4521 docs/user/USAGE.md
#4522 docs/user/USAGE.md
#4523 docs/user/USAGE.md
#4566 docs/user/USAGE.md
#4599 docs/user/USAGE.md
#4718 docs/user/USAGE.md
#4740 docs/user/USAGE.md
#4749 docs/user/USAGE.md
#4760 docs/user/USAGE.md
#4813 docs/user/USAGE.md
#4891 docs/user/USAGE.md
#5021 docs/user/USAGE.md
#5390 docs/user/USAGE.md
#5875 docs/user/USAGE.md
#5925 docs/user/USAGE.md
#6171 docs/user/USAGE.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180578454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5695#issuecomment-6180578454). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T23:14:58Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #6127 | `core/relinker/main.cpp` [L313-318](https://github.com/boykopovar/AnyPS5/blob/34454bd835ce334c3c395467da50546b433fe200/core/relinker/main.cpp#L313-L318) | | | 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. | Pull request | Shared files not compared | |---|---| | #3891 | `docs/user/USAGE.md` | | #4156 | `docs/user/USAGE.md` | | #4396 | `docs/user/USAGE.md` | | #4397 | `docs/user/USAGE.md` | | #4422 | `docs/user/USAGE.md` | | #4423 | `docs/user/USAGE.md` | | #4424 | `docs/user/USAGE.md` | | #4520 | `docs/user/USAGE.md` | | #4521 | `docs/user/USAGE.md` | | #4522 | `docs/user/USAGE.md` | | #4523 | `docs/user/USAGE.md` | | #4566 | `docs/user/USAGE.md` | | #4599 | `docs/user/USAGE.md` | | #4718 | `docs/user/USAGE.md` | | #4740 | `docs/user/USAGE.md` | | #4749 | `docs/user/USAGE.md` | | #4760 | `docs/user/USAGE.md` | | #4813 | `docs/user/USAGE.md` | | #4891 | `docs/user/USAGE.md` | | #5021 | `docs/user/USAGE.md` | | #5390 | `docs/user/USAGE.md` | | #5875 | `docs/user/USAGE.md` | | #5925 | `docs/user/USAGE.md` | | #6171 | `docs/user/USAGE.md` |
adriadam10 commented 2026-10-15 12:05:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:05:14Z.


Checked on the PR merged onto current main: build + scoped ctest (relinker) 133/133, including relinker_executables; the execute bits are set for Linux and macOS outputs, Windows is untouched. Relinker jobs green on ubuntu, windows and macOS; macOS also confirmed by @Bruggi-ch on Apple M5. The title run is not reproducible here. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191623683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5695#issuecomment-6191623683). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T12:05:14Z. --- Checked on the PR merged onto current `main`: build + scoped ctest (relinker) 133/133, including `relinker_executables`; the execute bits are set for Linux and macOS outputs, Windows is untouched. Relinker jobs green on ubuntu, windows and macOS; macOS also confirmed by @Bruggi-ch on Apple M5. The title run is not reproducible here. Merging.
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!5695
No description provided.