fix(relinker): preserve GNU stack and RELRO headers on Linux #6406

Merged
MarcZX10 merged 3 commits from upstream-pr/6406 into main 2026-10-18 09:04:27 +00:00
MarcZX10 commented 2026-10-15 14:12:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T14:12:43Z.


What

  • Preserve PT_GNU_STACK and PT_GNU_RELRO when filtering Linux program headers.
  • Omit PT_GNU_RELRO when lazy binding is enabled, because PS5 lazy PLT targets can fall inside that range and must remain writable for first-call resolution.
  • Add integration coverage for normal and fixed-base output, stack flags and rebased RELRO ranges, plus lazy-binding output.
  • Fixes #6394.

Tested

  • Linux x86-64 relinker-only Release build completed.
  • Full relinker-only CTest suite passed: 188/188, including linux_gnu_segments.
  • python3 tools/check_conventions.py --base upstream/main passed.
  • git diff --check passed.
  • The lazy-binding behavior is supported by reviewer analysis of a real PS5 eboot: all 697 R_X86_64_JUMP_SLOT targets were inside PT_GNU_RELRO with no BIND_NOW. This was a layout/code analysis, not a runtime reproduction.
  • Ghost of Yōtei (PPSA26344, v01.008) on Linux/lavapipe, head c56cafae2: the fully PT_LOAD-covered PT_GNU_RELRO is retained, ld.so applies read-only protection, and the title runs until its pre-existing sRGB compute-sample failure. This covers the retained RELRO path only; the reported Astro Bot/Dreaming Sarah startup reruns and a PT_GNU_STACK title case remain outstanding.

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 or are documented; not applicable
  • No notes, investigation .md files or images added
  • New third-party code is a submodule built from source; not applicable
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4874662319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T14:12:43Z. --- ### What - Preserve `PT_GNU_STACK` and `PT_GNU_RELRO` when filtering Linux program headers. - Omit `PT_GNU_RELRO` when lazy binding is enabled, because PS5 lazy PLT targets can fall inside that range and must remain writable for first-call resolution. - Add integration coverage for normal and fixed-base output, stack flags and rebased RELRO ranges, plus lazy-binding output. - Fixes #6394. ### Tested - Linux x86-64 relinker-only Release build completed. - Full relinker-only CTest suite passed: 188/188, including `linux_gnu_segments`. - `python3 tools/check_conventions.py --base upstream/main` passed. - `git diff --check` passed. - The lazy-binding behavior is supported by reviewer analysis of a real PS5 eboot: all 697 `R_X86_64_JUMP_SLOT` targets were inside `PT_GNU_RELRO` with no `BIND_NOW`. This was a layout/code analysis, not a runtime reproduction. - Ghost of Yōtei (PPSA26344, v01.008) on Linux/lavapipe, head `c56cafae2`: the fully `PT_LOAD`-covered `PT_GNU_RELRO` is retained, ld.so applies read-only protection, and the title runs until its pre-existing sRGB compute-sample failure. This covers the retained RELRO path only; the reported Astro Bot/Dreaming Sarah startup reruns and a `PT_GNU_STACK` title case remain outstanding. ### 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 or are documented; not applicable - [x] No notes, investigation `.md` files or images added - [x] New third-party code is a submodule built from source; not applicable - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 14:33:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T14:33:55Z.


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
PR 2780 core/relinker/CMakeLists.txt
PR 5021 core/relinker/CMakeLists.txt
PR 6044 core/relinker/CMakeLists.txt
PR 6447 core/relinker/elfpatcher/src/general/SegmentFilter.cpp
PR 6879 core/relinker/CMakeLists.txt
PR 6977 core/relinker/CMakeLists.txt
PR 7332 core/relinker/CMakeLists.txt
core/relinker/relinker/src/pipeline/Conversion.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6194614877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6194614877). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T14:33:55Z. --- <!-- pr-overlap --> 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 | |---|---| | [PR 2780](https://www.github.com/boykopovar/AnyPS5/pull/2780) | `core/relinker/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/relinker/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/relinker/CMakeLists.txt` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/relinker/elfpatcher/src/general/SegmentFilter.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/relinker/CMakeLists.txt` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/relinker/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/relinker/CMakeLists.txt`<br>`core/relinker/relinker/src/pipeline/Conversion.cpp` |
Dextroid17 commented 2026-10-16 12:33:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-16T12:33:54Z.


Tested 90f5c3710 as-is (merge base 0dab493f5; it still merges cleanly into main eb901bcf4) on Linux (CachyOS, kernel 7.2.9), relinker-only Release build with BUILD_TESTING=ON, as in the CI relinker job:

  • ctest -R '^linux_gnu_segments$': passed, 3 of 3. The full relinker suite passed, 182/182.
  • With the new SegmentFilter.cpp line removed and the relinker rebuilt: failed, 3 of 3, PT_GNU_STACK was dropped. With the line restored and rebuilt, it passes again.

I also relinked a real eboot with both builds: Ghost of Yōtei (PPSA26344 v01.008). Its eboot has a PT_GNU_RELRO and no PT_GNU_STACK.

  • With this PR the output keeps PT_GNU_RELRO, with the same address and memory size as the RW PT_LOAD it covers (0x1b34000, 0x1dc000). Without the line it is dropped.
  • Since ld.so now makes that range read-only after relocation, I booted both outputs for 150 s each on lavapipe (llvmpipe, Mesa 26.2.4). Neither crashed; both ran to the timeout. After normalising addresses, the logs differ only in line order and the shader disk cache counters (120 "could not be prepared" shader messages each, in both). That is only a 150 s window, not proof that nothing writes to the range later.
  • The stack half does not change this eboot, as it has no PT_GNU_STACK.

#6447 changes the same line (L15, flagged by the overlap bot), without a relinker test or a reference to #6394, so the two will conflict. This one was opened first and carries the regression test. #6447 also changes RebaseProgramHeaders to use tableOff instead of phOff in LinuxElfPatcher.cpp, which is the change in #6403; I did not test that path.

Not run: Windows, macOS, a hardware GPU, a boot past 150 s.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215596328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6215596328). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-16T12:33:54Z. --- Tested 90f5c3710 as-is (merge base 0dab493f5; it still merges cleanly into `main` eb901bcf4) on Linux (CachyOS, kernel 7.2.9), relinker-only Release build with `BUILD_TESTING=ON`, as in the CI relinker job: - `ctest -R '^linux_gnu_segments$'`: passed, 3 of 3. The full relinker suite passed, 182/182. - With the new `SegmentFilter.cpp` line removed and the relinker rebuilt: failed, 3 of 3, `PT_GNU_STACK was dropped`. With the line restored and rebuilt, it passes again. I also relinked a real eboot with both builds: Ghost of Yōtei (PPSA26344 v01.008). Its eboot has a `PT_GNU_RELRO` and no `PT_GNU_STACK`. - With this PR the output keeps `PT_GNU_RELRO`, with the same address and memory size as the RW `PT_LOAD` it covers (0x1b34000, 0x1dc000). Without the line it is dropped. - Since ld.so now makes that range read-only after relocation, I booted both outputs for 150 s each on lavapipe (llvmpipe, Mesa 26.2.4). Neither crashed; both ran to the timeout. After normalising addresses, the logs differ only in line order and the shader disk cache counters (120 "could not be prepared" shader messages each, in both). That is only a 150 s window, not proof that nothing writes to the range later. - The stack half does not change this eboot, as it has no `PT_GNU_STACK`. #6447 changes the same line (L15, flagged by the overlap bot), without a relinker test or a reference to #6394, so the two will conflict. This one was opened first and carries the regression test. #6447 also changes `RebaseProgramHeaders` to use `tableOff` instead of `phOff` in `LinuxElfPatcher.cpp`, which is the change in #6403; I did not test that path. Not run: Windows, macOS, a hardware GPU, a boot past 150 s. AI-assisted: yes
MarcZX10 commented 2026-10-16 15:59:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T15:59:24Z.


Thanks for the full relinker suite, 3/3 focused regression and reverted-line control. The real Ghost of Yōtei eboot comparison is useful evidence that GNU RELRO is retained; I have noted the 150-second boot window and that the PT_GNU_STACK half is not exercised by that eboot. I will review the #6447 overlap and the shared #6403 program-header path separately before any consolidation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6219414860 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6219414860). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T15:59:24Z. --- Thanks for the full relinker suite, 3/3 focused regression and reverted-line control. The real Ghost of Yōtei eboot comparison is useful evidence that GNU RELRO is retained; I have noted the 150-second boot window and that the PT_GNU_STACK half is not exercised by that eboot. I will review the #6447 overlap and the shared #6403 program-header path separately before any consolidation.
oneandonlydean commented 2026-10-17 10:38:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T10:38:38Z.


Thanks. Keeping PT_GNU_STACK and PT_GNU_RELRO looks right for the default (BIND_NOW) output. One question and a rebase:

Lazy binding: with --lazy-binding, keeping PT_GNU_RELRO can leave the original .got.plt inside the read-only range, so the first lazy call would fault when the loader writes the resolved address. We found this reading the code and haven't reproduced it. Could you check the --lazy-binding output: either keep .got.plt outside RELRO in that mode, or drop RELRO there?

The branch is about 600 commits behind main, so please rebase onto current main before we run CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232910081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6232910081). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T10:38:38Z. --- Thanks. Keeping `PT_GNU_STACK` and `PT_GNU_RELRO` looks right for the default (BIND_NOW) output. One question and a rebase: **Lazy binding:** with `--lazy-binding`, keeping `PT_GNU_RELRO` can leave the original `.got.plt` inside the read-only range, so the first lazy call would fault when the loader writes the resolved address. We found this reading the code and haven't reproduced it. Could you check the `--lazy-binding` output: either keep `.got.plt` outside RELRO in that mode, or drop RELRO there? The branch is about 600 commits behind main, so please rebase onto current main before we run CI.
MarcZX10 commented 2026-10-17 12:30:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:30:05Z.


I rebased the PR onto current main (c9e6c45de) as 497cf2569; the single commit remains authored and committed by MarcZX100. The relinker-only Linux build, linux_gnu_segments (1/1), conventions, and git diff --check pass.

I checked the lazy-binding concern against a GNU-linked Linux PIE built with -z lazy -z relro: it has no BIND_NOW; its PT_GNU_RELRO covers 0x3dd0–0x4000 while .got.plt spans 0x3fe8–0x4008, leaving the mutable PLT slot outside RELRO. This host binary is rejected by AnyPS5’s instruction decoder before relinking, so I could not validate a converted output. I also could not find a PS5 ELF fixture here to establish whether its PT_GNU_RELRO covers lazy PLT relocation targets. The current evidence does not show a failure, but it does not settle the PS5 layout case; a representative input with its dynamic relocations would let us check whether the writable lazy slots fall inside the preserved range.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233893435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6233893435). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T12:30:05Z. --- I rebased the PR onto current `main` (`c9e6c45de`) as `497cf2569`; the single commit remains authored and committed by MarcZX100. The relinker-only Linux build, `linux_gnu_segments` (1/1), conventions, and `git diff --check` pass. I checked the lazy-binding concern against a GNU-linked Linux PIE built with `-z lazy -z relro`: it has no `BIND_NOW`; its `PT_GNU_RELRO` covers 0x3dd0–0x4000 while `.got.plt` spans 0x3fe8–0x4008, leaving the mutable PLT slot outside RELRO. This host binary is rejected by AnyPS5’s instruction decoder before relinking, so I could not validate a converted output. I also could not find a PS5 ELF fixture here to establish whether its `PT_GNU_RELRO` covers lazy PLT relocation targets. The current evidence does not show a failure, but it does not settle the PS5 layout case; a representative input with its dynamic relocations would let us check whether the writable lazy slots fall inside the preserved range.
oneandonlydean commented 2026-10-17 12:51:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T12:51:12Z.


Thanks for the rebase and the host check. We checked the PS5 side on a real eboot (Ghost of Yōtei), and PS5 links don't lay it out the way GNU ld does:

  • PT_GNU_RELRO covers 0x1b34000–0x1d10000, which is the whole RW LOAD.
  • All 697 R_X86_64_JUMP_SLOT targets (0x1d0d440–0x1d0ea08, DT_PLTGOT 0x1d0d428) are inside that range.
  • The input has no BIND_NOW.

The Linux patcher copies the PLT relocations unchanged and leaves out DF_BIND_NOW when --lazy-binding is set. So with this change, ld.so would make every lazy slot read-only, and the first lazily bound call would fault. This comes from reading the layout and the code, not from a run.

The default (BIND_NOW) output is fine as it is. Could you skip PT_GNU_RELRO when lazy binding is on (or drop it in that mode), and add a lazy-binding case to the test? After that we'll run full CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234093570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6234093570). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T12:51:12Z. --- Thanks for the rebase and the host check. We checked the PS5 side on a real eboot (Ghost of Yōtei), and PS5 links don't lay it out the way GNU ld does: - `PT_GNU_RELRO` covers 0x1b34000–0x1d10000, which is the whole RW `LOAD`. - All 697 `R_X86_64_JUMP_SLOT` targets (0x1d0d440–0x1d0ea08, `DT_PLTGOT` 0x1d0d428) are inside that range. - The input has no `BIND_NOW`. The Linux patcher copies the PLT relocations unchanged and leaves out `DF_BIND_NOW` when `--lazy-binding` is set. So with this change, ld.so would make every lazy slot read-only, and the first lazily bound call would fault. This comes from reading the layout and the code, not from a run. The default (BIND_NOW) output is fine as it is. Could you skip `PT_GNU_RELRO` when lazy binding is on (or drop it in that mode), and add a lazy-binding case to the test? After that we'll run full CI.
MarcZX10 commented 2026-10-17 13:32:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:32:35Z.


Rebased onto current upstream main (40315fcf8) and addressed the lazy-binding review: PT_GNU_RELRO is omitted only when lazy binding is enabled, while default/eager output continues preserving it. The regression checks lazy-mode omission and eager/default retention. Linux relinker-only Release build and full CTest suite pass (188/188); conventions and git diff --check pass. The PS5 layout concern is based on reviewer analysis of a real eboot's relocation targets, not a runtime reproduction.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234482303 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6234482303). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T13:32:35Z. --- Rebased onto current upstream main (`40315fcf8`) and addressed the lazy-binding review: `PT_GNU_RELRO` is omitted only when lazy binding is enabled, while default/eager output continues preserving it. The regression checks lazy-mode omission and eager/default retention. Linux relinker-only Release build and full CTest suite pass (188/188); conventions and `git diff --check` pass. The PS5 layout concern is based on reviewer analysis of a real eboot's relocation targets, not a runtime reproduction.
MarcZX10 commented 2026-10-17 13:38:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:38:48Z.


Follow-up: GitHub CI has now passed the relinker-only build and test jobs on Linux (GCC), macOS (Clang), and Windows (GCC), along with conventions and eligibility. The broader application Linux/Windows jobs were skipped by the relinker-only path filter. My local Linux relinker-only CTest run also passed 188/188.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234548881 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6234548881). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T13:38:48Z. --- Follow-up: GitHub CI has now passed the relinker-only build and test jobs on Linux (GCC), macOS (Clang), and Windows (GCC), along with conventions and eligibility. The broader application Linux/Windows jobs were skipped by the relinker-only path filter. My local Linux relinker-only CTest run also passed 188/188.
oneandonlydean commented 2026-10-17 19:46:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T19:46:53Z.


Thanks for the RELRO / lazy-binding follow-up. We ran this head (55497ed3a) on two titles with the relinker's default options (eager binding, so PT_GNU_RELRO is kept), rebased onto main 52798f71d, and both produced executables fail to start:

./app.elf: error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory
./eboot.linux: error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory

That's glibc's loader failing the mprotect it does over the PT_GNU_RELRO range after relocation. ENOMEM from mprotect usually means part of that range isn't mapped, so the RELRO segment the relinker keeps probably isn't fully covered by a PT_LOAD segment in the relinked output (or it extends past one). The host had plenty of memory, and the same relinker without this PR loads and runs both titles on the same main.

Two independent relinks (10.7 MB and 266 MB executables) fail identically, so it isn't title-specific. linux_gnu_segments checks that the header is present but doesn't load the output, which is why CI passed.

Could you check where the preserved PT_GNU_RELRO lands relative to the PT_LOAD segments after relinking (readelf -lW on a relinked binary), and either clamp or drop it when it isn't fully inside a writable PT_LOAD? A test that actually executes a relinked binary in the default mode would catch this. Happy to rerun the titles on a new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6239883901 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6239883901). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T19:46:53Z. --- Thanks for the RELRO / lazy-binding follow-up. We ran this head (55497ed3a) on two titles with the relinker's **default** options (eager binding, so `PT_GNU_RELRO` is kept), rebased onto main 52798f71d, and both produced executables fail to start: ``` ./app.elf: error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory ./eboot.linux: error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory ``` That's glibc's loader failing the `mprotect` it does over the `PT_GNU_RELRO` range after relocation. `ENOMEM` from `mprotect` usually means part of that range isn't mapped, so the RELRO segment the relinker keeps probably isn't fully covered by a `PT_LOAD` segment in the relinked output (or it extends past one). The host had plenty of memory, and the same relinker without this PR loads and runs both titles on the same main. Two independent relinks (10.7 MB and 266 MB executables) fail identically, so it isn't title-specific. `linux_gnu_segments` checks that the header is present but doesn't load the output, which is why CI passed. Could you check where the preserved `PT_GNU_RELRO` lands relative to the `PT_LOAD` segments after relinking (`readelf -lW` on a relinked binary), and either clamp or drop it when it isn't fully inside a writable `PT_LOAD`? A test that actually executes a relinked binary in the default mode would catch this. Happy to rerun the titles on a new head.
simonbbby commented 2026-10-17 20:24:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-17T20:24:17Z.


Independent Linux loader reproduction of the new default-mode failure mechanism on exact head 55497ed3a4a90621074323fea8d9602a66f49f2b (Ubuntu 24.04 x86-64, glibc 2.39, GCC 13.3, Release relinker-only). Production source unchanged; all inputs generated from this branch's fixture.

linux_gnu_segments passes. I then executed 15 relinked outputs: five RELRO geometries × default eager / fixed-base eager / lazy. The generated guest entry is an int3, so SIGTRAP proves the loader reached it.

  • Fully mapped [0x4000,0x8000) RELRO: eager and fixed-base both reach entry; strace shows a successful 16 KiB mprotect(PROT_READ). Both RW and R-only LOAD controls work.
  • [0x4000,0xc000) RELRO: eager and fixed-base both exit 127 with the exact reported glibc message. The RW LOAD ends at 0x8000; the synthetic block occupies one page there, leaving a hole before the relocated header LOAD at 0xc000. strace shows the 32 KiB mprotect(PROT_READ) returning ENOMEM.
  • A left-hole range [0x1000,0x8000) also reproduces it, with the 28 KiB protection call returning ENOMEM.
  • All lazy outputs reach entry. More narrowly, in each of the ten eager/fixed outputs I changed only the four-byte PT_GNU_RELRO type to PT_NULL, leaving all other bytes identical: all reach entry. This isolates the RELRO protection request from the entry stub and other dynamic tags.
  • A subpage range [0x4500,0x4600) reaches entry without any mprotect call. The current stock fixture's [0x500,0x600) similarly has no full host page to protect. An execution regression should include a full-page range; merely executing that existing small fixture would still miss the protection path.

Minimal failing generated input, using the existing test helpers:

import struct
from test_linux_gnu_segments import image

e = image()
struct.pack_into("<Q", e, 24, 0x10)
e[0x4010] = 0xcc
struct.pack_into("<IIQQQQQQ", e, 64 + 4*56,
                 1, 6, 0x5000, 0x4000, 0x4000, 0x1000, 0x4000, 0x1000)
struct.pack_into("<IIQQQQQQ", e, 64 + 3*56,
                 0x6474e552, 4, 0x5000, 0x4000, 0x4000, 0x1000, 0x8000, 1)
open("relro-hole.input", "wb").write(e)

Relink with --skip-sce-module relro-hole.input relro-hole.elf, chmod the output executable, then run it (or strace -e mprotect ./relro-hole.elf). Changing only the RELRO memory size above from 0x8000 to 0x4000 gives the mapped positive control. Add --linux-fixed-base 0x400000 to cover rebasing, or --lazy-binding to cover omission.

Limit: this intentionally supplies a RELRO range exceeding the input LOAD; it proves the unchecked-preservation failure and provides a loader-level regression, not why the real title's range becomes uncovered. No retail assets were used, no title boot is claimed, and I have not tested a clamp/drop production fix. The two failing title outputs' readelf -lW remains necessary to establish their specific layout cause.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6240467578 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6240467578). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-17T20:24:17Z. --- Independent Linux loader reproduction of the new default-mode failure mechanism on exact head `55497ed3a4a90621074323fea8d9602a66f49f2b` (Ubuntu 24.04 x86-64, glibc 2.39, GCC 13.3, Release relinker-only). Production source unchanged; all inputs generated from this branch's fixture. `linux_gnu_segments` passes. I then executed 15 relinked outputs: five RELRO geometries × default eager / fixed-base eager / lazy. The generated guest entry is an `int3`, so SIGTRAP proves the loader reached it. - Fully mapped `[0x4000,0x8000)` RELRO: eager and fixed-base both reach entry; `strace` shows a successful 16 KiB `mprotect(PROT_READ)`. Both RW and R-only LOAD controls work. - `[0x4000,0xc000)` RELRO: eager and fixed-base both exit **127 with the exact reported glibc message**. The RW LOAD ends at `0x8000`; the synthetic block occupies one page there, leaving a hole before the relocated header LOAD at `0xc000`. `strace` shows the 32 KiB `mprotect(PROT_READ)` returning **ENOMEM**. - A left-hole range `[0x1000,0x8000)` also reproduces it, with the 28 KiB protection call returning ENOMEM. - All lazy outputs reach entry. More narrowly, in each of the ten eager/fixed outputs I changed **only the four-byte PT_GNU_RELRO type to PT_NULL**, leaving all other bytes identical: all reach entry. This isolates the RELRO protection request from the entry stub and other dynamic tags. - A subpage range `[0x4500,0x4600)` reaches entry **without any mprotect call**. The current stock fixture's `[0x500,0x600)` similarly has no full host page to protect. An execution regression should include a full-page range; merely executing that existing small fixture would still miss the protection path. Minimal failing generated input, using the existing test helpers: ```python import struct from test_linux_gnu_segments import image e = image() struct.pack_into("<Q", e, 24, 0x10) e[0x4010] = 0xcc struct.pack_into("<IIQQQQQQ", e, 64 + 4*56, 1, 6, 0x5000, 0x4000, 0x4000, 0x1000, 0x4000, 0x1000) struct.pack_into("<IIQQQQQQ", e, 64 + 3*56, 0x6474e552, 4, 0x5000, 0x4000, 0x4000, 0x1000, 0x8000, 1) open("relro-hole.input", "wb").write(e) ``` Relink with `--skip-sce-module relro-hole.input relro-hole.elf`, chmod the output executable, then run it (or `strace -e mprotect ./relro-hole.elf`). Changing only the RELRO memory size above from `0x8000` to `0x4000` gives the mapped positive control. Add `--linux-fixed-base 0x400000` to cover rebasing, or `--lazy-binding` to cover omission. Limit: this intentionally supplies a RELRO range exceeding the input LOAD; it proves the unchecked-preservation failure and provides a loader-level regression, **not** why the real title's range becomes uncovered. No retail assets were used, no title boot is claimed, and I have not tested a clamp/drop production fix. The two failing title outputs' `readelf -lW` remains necessary to establish their specific layout cause.
MarcZX10 commented 2026-10-17 20:47:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T20:47:12Z.


Thanks for the executable-level reproduction and the full-page positive/negative controls. I agree the fixture now demonstrates that preserving a PT_GNU_RELRO range which extends across an unmapped hole can make glibc fail its protection call, while lazy binding and changing only the header to PT_NULL isolate that mechanism. I am not treating that as proof of the two retail outputs’ layout cause. I’ll inspect their readelf -lW output if those exact relinked artifacts are available; otherwise I’ll keep the production conclusion limited to the synthetic failure and ask for the artifact details before changing range handling. The useful regression addition is clear: execute a generated full-page RELRO case with both a fully mapped passing control and an overhanging failing control.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6240780074 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6240780074). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T20:47:12Z. --- Thanks for the executable-level reproduction and the full-page positive/negative controls. I agree the fixture now demonstrates that preserving a PT_GNU_RELRO range which extends across an unmapped hole can make glibc fail its protection call, while lazy binding and changing only the header to PT_NULL isolate that mechanism. I am not treating that as proof of the two retail outputs’ layout cause. I’ll inspect their `readelf -lW` output if those exact relinked artifacts are available; otherwise I’ll keep the production conclusion limited to the synthetic failure and ask for the artifact details before changing range handling. The useful regression addition is clear: execute a generated full-page RELRO case with both a fully mapped passing control and an overhanging failing control.
oneandonlydean commented 2026-10-17 21:39:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T21:39:58Z.


Here are the readelf -lW program headers from the two relinked retail outputs our gate produced on 55497ed3a (built on main). Both fail with cannot apply additional memory protection after relocation: Cannot allocate memory.

Astro Bot (eboot.linux, the relevant rows):

  LOAD           0x88e0000 0x00000000088dc000 0x00000000088dc000 0x5603e8 0x5603e8 RW  0x4000
  GNU_RELRO      0x88e0000 0x00000000088dc000 0x00000000088dc000 0x5603e8 0x564000 R   0x1
  TLS            0x88e0000 0x00000000088dc000 0x00000000088dc000 0x000040 0x0000a0 R   0x8
  LOOS+0x1000001 0x8e40388 0x0000000008e3c388 0x0000000008e3c388 0x000060 0x000060 R   0x8
  LOAD           0x8e44000 0x0000000008e40000 0x0000000008e40000 0x5492690 0x5fb7e10 RW  0x4000

The RW LOAD ends at 0x8e3c3e8, or 0x8e3d000 rounded up to a 4 KiB page. GNU_RELRO's MemSiz is 0x564000, which ends at 0x8e40000. So 0x8e3d000..0x8e40000 (3 pages) is covered by RELRO but by no LOAD.

Dreaming Sarah (app.elf):

  LOAD           0x378000 0x0000000000374000 0x0000000000374000 0x121380 0x121380 RW  0x4000
  GNU_RELRO      0x378000 0x0000000000374000 0x0000000000374000 0x121380 0x124000 R   0x1
  LOAD           0x49c000 0x0000000000498000 0x0000000000498000 0x008200 0x02ee48 RW  0x4000

Here the RW LOAD ends at 0x495380 (0x496000 rounded to a page), and RELRO ends at 0x498000: 2 uncovered pages.

In both outputs the RELRO MemSiz is the LOAD's size rounded up to the PS5's 16 KiB granule (0x4000), but the LOAD itself is mapped at 4 KiB host pages, so the tail lands in the gap before the next LOAD. That's the same shape as the overhanging control in the fixture. A clamp of p_memsz to the end of the RW LOAD it starts in (page-rounded at the host page size), or dropping RELRO when it isn't fully covered, would fit both outputs. Full headers for both files are available if you want them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241572641 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6241572641). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T21:39:58Z. --- Here are the `readelf -lW` program headers from the two relinked retail outputs our gate produced on 55497ed3a (built on main). Both fail with `cannot apply additional memory protection after relocation: Cannot allocate memory`. **Astro Bot** (`eboot.linux`, the relevant rows): ``` LOAD 0x88e0000 0x00000000088dc000 0x00000000088dc000 0x5603e8 0x5603e8 RW 0x4000 GNU_RELRO 0x88e0000 0x00000000088dc000 0x00000000088dc000 0x5603e8 0x564000 R 0x1 TLS 0x88e0000 0x00000000088dc000 0x00000000088dc000 0x000040 0x0000a0 R 0x8 LOOS+0x1000001 0x8e40388 0x0000000008e3c388 0x0000000008e3c388 0x000060 0x000060 R 0x8 LOAD 0x8e44000 0x0000000008e40000 0x0000000008e40000 0x5492690 0x5fb7e10 RW 0x4000 ``` The RW LOAD ends at 0x8e3c3e8, or 0x8e3d000 rounded up to a 4 KiB page. GNU_RELRO's MemSiz is 0x564000, which ends at 0x8e40000. So 0x8e3d000..0x8e40000 (3 pages) is covered by RELRO but by no LOAD. **Dreaming Sarah** (`app.elf`): ``` LOAD 0x378000 0x0000000000374000 0x0000000000374000 0x121380 0x121380 RW 0x4000 GNU_RELRO 0x378000 0x0000000000374000 0x0000000000374000 0x121380 0x124000 R 0x1 LOAD 0x49c000 0x0000000000498000 0x0000000000498000 0x008200 0x02ee48 RW 0x4000 ``` Here the RW LOAD ends at 0x495380 (0x496000 rounded to a page), and RELRO ends at 0x498000: 2 uncovered pages. In both outputs the RELRO MemSiz is the LOAD's size rounded up to the PS5's 16 KiB granule (0x4000), but the LOAD itself is mapped at 4 KiB host pages, so the tail lands in the gap before the next LOAD. That's the same shape as the overhanging control in the fixture. A clamp of `p_memsz` to the end of the RW LOAD it starts in (page-rounded at the host page size), or dropping RELRO when it isn't fully covered, would fit both outputs. Full headers for both files are available if you want them.
MarcZX10 commented 2026-10-17 21:43:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T21:43:57Z.


I updated the PR with a conservative check and executable coverage for the loader failure. In both default and fixed-base modes, a fully covered full-page RELRO range is retained and the output reaches the generated SIGTRAP entry; an overhanging range is omitted and also reaches the entry. The full Linux relinker-only CTest suite passes 188/188. I still do not have the two retail outputs, so this does not establish their exact program-header layout or claim those title failures are fixed. Could you rerun them on this head and share readelf -lW output if either still fails?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241653262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6241653262). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T21:43:57Z. --- I updated the PR with a conservative check and executable coverage for the loader failure. In both default and fixed-base modes, a fully covered full-page RELRO range is retained and the output reaches the generated SIGTRAP entry; an overhanging range is omitted and also reaches the entry. The full Linux relinker-only CTest suite passes 188/188. I still do not have the two retail outputs, so this does not establish their exact program-header layout or claim those title failures are fixed. Could you rerun them on this head and share `readelf -lW` output if either still fails?
MarcZX10 commented 2026-10-17 21:46:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T21:46:23Z.


Thanks, these headers confirm the same overhang shape as the new regression: both RELRO ranges extend beyond the final page of the writable PT_LOAD that begins at the same address. The updated filter page-rounds the PT_LOAD coverage to the host load alignment and omits a RELRO range if any page is uncovered, so these two layouts should take the omission path. Could you rerun both outputs on commit c56cafae2 and report whether they reach startup? If either still fails, the full header dump would help trace the remaining mapping.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241700659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6241700659). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T21:46:23Z. --- Thanks, these headers confirm the same overhang shape as the new regression: both RELRO ranges extend beyond the final page of the writable PT_LOAD that begins at the same address. The updated filter page-rounds the PT_LOAD coverage to the host load alignment and omits a RELRO range if any page is uncovered, so these two layouts should take the omission path. Could you rerun both outputs on commit `c56cafae2` and report whether they reach startup? If either still fails, the full header dump would help trace the remaining mapping.
MarcZX10 commented 2026-10-17 21:49:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T21:49:46Z.


CI has now completed successfully on the updated head c56cafae2: eligibility, conventions, Linux, Windows, macOS, and ASan relinker jobs all pass. The broader Linux/Windows app suites were skipped by the path filter. Locally, the full relinker-only CTest suite passed 188/188. The two retail-output reruns are still the remaining validation request; I have not claimed a title fix.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241755662 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6241755662). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T21:49:46Z. --- CI has now completed successfully on the updated head `c56cafae2`: eligibility, conventions, Linux, Windows, macOS, and ASan relinker jobs all pass. The broader Linux/Windows app suites were skipped by the path filter. Locally, the full relinker-only CTest suite passed 188/188. The two retail-output reruns are still the remaining validation request; I have not claimed a title fix.
simonbbby commented 2026-10-17 22:22:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-17T22:22:26Z.


Independent follow-up on exact revised head c56cafae2e9a351559f964da45b176aed23940b4, compared with 55497ed3a. Ubuntu 24.04 x86-64, glibc 2.39, GCC 13.3, Release relinker-only; production source unchanged.

I generated ELF inputs using the size and alignment relationships in Dean's Astro Bot and Dreaming Sarah header excerpts, with zero-filled data and an int3 guest entry. Addresses/file offsets are translated; no title bytes, imports, TLS or title execution are involved.

Generated layout Previous head, eager / fixed-base Revised head, eager / fixed-base
LOAD size 0x5603e8, RELRO size 0x564000, next LOAD at RELRO end (Astro Bot shape) RELRO retained; both exit 127 with the reported glibc error RELRO omitted; both reach entry (SIGTRAP)
LOAD size 0x121380, RELRO size 0x124000, next LOAD at RELRO end (Dreaming Sarah shape) RELRO retained; both exit 127 with the reported glibc error RELRO omitted; both reach entry (SIGTRAP)

Also checked three independent page-boundary controls:

  • LOAD size 0x1801, RELRO size 0x2000: retained by both heads, reaches entry. The guard accepts the mapped final host page rather than requiring byte-for-byte containment.
  • Same LOAD, RELRO size 0x2001: revised head conservatively omits it, reaches entry. The previous output also reaches entry because glibc floors the protection end; this case is not counted as a reproduced loader failure.
  • LOAD/RELRO sizes both 0x4000: retained by both heads, reaches entry. This rules out simply dropping every RELRO range.

Each of the five layouts was converted and executed on both heads in default, fixed-base (0x400000) and lazy modes: 30 runs, all match these expectations. All lazy outputs omit RELRO and reach entry. Input hashes stay unchanged. Revised ctest -R '^linux_gnu_segments$' also passes (1/1).

This independently verifies the guard on the reported layout shapes and distinguishes it from a blanket drop or a binding-mode change. The actual Astro Bot / Dreaming Sarah startup reruns requested above remain outstanding; this is not a title-fix claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6242165808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6242165808). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-17T22:22:26Z. --- Independent follow-up on exact revised head `c56cafae2e9a351559f964da45b176aed23940b4`, compared with `55497ed3a`. Ubuntu 24.04 x86-64, glibc 2.39, GCC 13.3, Release relinker-only; production source unchanged. I generated ELF inputs using the **size and alignment relationships in Dean's Astro Bot and Dreaming Sarah header excerpts**, with zero-filled data and an `int3` guest entry. Addresses/file offsets are translated; no title bytes, imports, TLS or title execution are involved. | Generated layout | Previous head, eager / fixed-base | Revised head, eager / fixed-base | |---|---|---| | LOAD size `0x5603e8`, RELRO size `0x564000`, next LOAD at RELRO end (Astro Bot shape) | RELRO retained; both exit 127 with the reported glibc error | RELRO omitted; both reach entry (SIGTRAP) | | LOAD size `0x121380`, RELRO size `0x124000`, next LOAD at RELRO end (Dreaming Sarah shape) | RELRO retained; both exit 127 with the reported glibc error | RELRO omitted; both reach entry (SIGTRAP) | Also checked three independent page-boundary controls: - LOAD size `0x1801`, RELRO size `0x2000`: retained by both heads, reaches entry. The guard accepts the mapped final host page rather than requiring byte-for-byte containment. - Same LOAD, RELRO size `0x2001`: revised head conservatively omits it, reaches entry. The previous output also reaches entry because glibc floors the protection end; this case is not counted as a reproduced loader failure. - LOAD/RELRO sizes both `0x4000`: retained by both heads, reaches entry. This rules out simply dropping every RELRO range. Each of the five layouts was converted and executed on both heads in default, fixed-base (`0x400000`) and lazy modes: **30 runs, all match these expectations**. All lazy outputs omit RELRO and reach entry. Input hashes stay unchanged. Revised `ctest -R '^linux_gnu_segments$'` also passes (1/1). This independently verifies the guard on the reported *layout shapes* and distinguishes it from a blanket drop or a binding-mode change. The actual Astro Bot / Dreaming Sarah startup reruns requested above remain outstanding; this is not a title-fix claim.
MarcZX10 commented 2026-10-17 22:25:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T22:25:24Z.


Thanks for running the 30 controlled comparisons on the exact revised head. The retained boundary controls and omitted overhang layouts support the mapping guard without implying a blanket RELRO drop. This is useful evidence for the reported header shapes; the actual Astro Bot and Dreaming Sarah startup reruns remain outstanding, so I’ll keep the title-level claim open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6242218062 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6242218062). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T22:25:24Z. --- Thanks for running the 30 controlled comparisons on the exact revised head. The retained boundary controls and omitted overhang layouts support the mapping guard without implying a blanket RELRO drop. This is useful evidence for the reported header shapes; the actual Astro Bot and Dreaming Sarah startup reruns remain outstanding, so I’ll keep the title-level claim open.
Dextroid17 commented 2026-10-17 23:15:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-17T23:15:51Z.


Follow-up to my Oct 16 comment, which tested 90f5c3710, an older head without the coverage guard. This time it's a retail title where RELRO is fully covered: Ghost of Yōtei (PPSA26344, 01.008) eboot.bin, on head c56cafae2 built as-is. Setup: CachyOS (Arch-based) x86-64, GCC 16.2.1, Release. git merge-tree against main 5de7a46e0 is clean; I did not build a merged tree.

  • Headers: the input's GNU_RELRO (0x1b34000, memsz 0x1dc000) matches its RW PT_LOAD exactly. The output keeps GNU_RELRO at the same range, which ends where the next LOAD starts (0x1d10000). This is default mode: BIND_NOW, with DT_PLTGOT 0x1d0d428 inside the range. Neither the input nor the output has PT_GNU_STACK, so this title doesn't test the stack half.
  • Startup: ld.so loads it with no "cannot apply additional memory protection" error. It ran on lavapipe (llvmpipe, LLVM 23.1.1) until a 90 s timeout.
  • Protection: in /proc/<pid>/maps 30 s into a second launch, 0x1b34000–0x1d10000 is r--p. That is consistent with ld.so's RELRO mprotect.
  • linux_gnu_segments passes.

That second launch later dumped core on an unimplemented sRGB compute-shader sample. The same message appears in my earlier lavapipe logs from builds without this PR.

This only checks the kept-RELRO path. The Astro Bot and Dreaming Sarah reruns are still needed.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6242939662 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6242939662). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-17T23:15:51Z. --- Follow-up to my Oct 16 comment, which tested `90f5c3710`, an older head without the coverage guard. This time it's a retail title where RELRO is fully covered: Ghost of Yōtei (PPSA26344, 01.008) `eboot.bin`, on head `c56cafae2` built as-is. Setup: CachyOS (Arch-based) x86-64, GCC 16.2.1, Release. `git merge-tree` against main `5de7a46e0` is clean; I did not build a merged tree. - **Headers:** the input's `GNU_RELRO` (`0x1b34000`, memsz `0x1dc000`) matches its RW `PT_LOAD` exactly. The output keeps `GNU_RELRO` at the same range, which ends where the next LOAD starts (`0x1d10000`). This is default mode: `BIND_NOW`, with `DT_PLTGOT` `0x1d0d428` inside the range. Neither the input nor the output has `PT_GNU_STACK`, so this title doesn't test the stack half. - **Startup:** ld.so loads it with no "cannot apply additional memory protection" error. It ran on lavapipe (llvmpipe, LLVM 23.1.1) until a 90 s timeout. - **Protection:** in `/proc/<pid>/maps` 30 s into a second launch, `0x1b34000`–`0x1d10000` is `r--p`. That is consistent with ld.so's RELRO `mprotect`. - `linux_gnu_segments` passes. That second launch later dumped core on an unimplemented sRGB compute-shader sample. The same message appears in my earlier lavapipe logs from builds without this PR. This only checks the kept-RELRO path. The Astro Bot and Dreaming Sarah reruns are still needed. AI-assisted: yes
MarcZX10 commented 2026-10-18 00:14:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T00:14:05Z.


Thanks for the Ghost of Yōtei follow-up. This confirms the revised relinker retains a fully covered PT_GNU_RELRO range, the loader applies its read-only protection, and the title continues past startup until the already-known sRGB shader failure. I’ll record this as a positive retained-RELRO/title startup datapoint; it still does not cover the PT_GNU_STACK half or the two original failure titles.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6243602229 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#issuecomment-6243602229). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T00:14:05Z. --- Thanks for the Ghost of Yōtei follow-up. This confirms the revised relinker retains a fully covered `PT_GNU_RELRO` range, the loader applies its read-only protection, and the title continues past startup until the already-known sRGB shader failure. I’ll record this as a positive retained-RELRO/title startup datapoint; it still does not cover the PT_GNU_STACK half or the two original failure titles.
plokmklo commented 2026-10-18 02:00:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by plokmklo on 2026-10-18T02:00:41Z.

Review: COMMENTED


Independent verification (Linux x86-64, relinker-only, GCC 14.2.0, current main 0bb238b4a)

Build and tests

  • Relinker-only Release build of head c56cafae2 is clean.
  • Full relinker-only ctest: 188/188 passed, including linux_gnu_segments — matches the Tested section.
  • Fail-on-main check confirmed: running test_linux_gnu_segments.py from this PR against a relinker built from main fails, so the test bites the regression it claims to.

Behavior probes against the real binary (synthetic ET_DYN fixture: PT_LOAD RX 0..0x1000 + PT_DYNAMIC, spare headers filled with PT_GNU_STACK, a writable PT_LOAD at 0x1000, and PT_GNU_RELRO inside it):

  • main: both GNU headers silently dropped from the output.
  • This PR: output keeps PT_GNU_STACK (flags 0x6, zero addresses) and PT_GNU_RELRO rebased onto its file range inside the covering writable load (off 0x5000, vaddr 0x1000), placed in the load-sorted layout with the program-header slot accounting intact (7 → 9 headers, no slot error).

Logic reading — nothing blocking found

  • hasWritableLoadCoverage runs on the INPUT layout while the RELRO is emitted into the OUTPUT layout. I verified the equivalence holds today: kept PT_LOADs carry vaddr/memsz through 1:1 (probe-confirmed), the synthetic extra-block load sits past GuestLoadPageEnd, and _sortLoadHeaders reorders without shrinking ranges — so input-derived coverage implies output coverage. If a future layout change ever breaks that invariant, this is the assumption that breaks first; a line in the relinker technical-debt entry would pin it.
  • RELRO omission under lazy binding is threaded as options.LazyBinding into the Linux patcher only; the PE and Mach-O paths never see this filter, so the scope is correct.
  • The lazy-binding justification rests on the author's layout analysis of one PS5 eboot (697 JUMP_SLOT targets inside RELRO, no BIND_NOW); I cannot reproduce that here without title files — reviewed, not reproduced, and the PR already labels it exactly that way.

Adjacent observation (out of this PR's scope)

  • PT_GNU_PROPERTY (0x6474e553) is also inside [PT_LOOS, PT_HIOS] and is still dropped with this PR applied: probed with a PT_GNU_PROPERTY mapped inside the load segment carrying a GNU property note — the header is silently omitted from the output. Same fidelity class as #6394, no intent evidence either way in the tree (no dead writer path references it). If the maintainer wants it preserved, it slots into ShouldSkip next to the two headers here; I can send that as a follow-up PR once this one merges (verifiable with the same fixture harness).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5561034509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6406#pullrequestreview-5561034509). Originally posted by [plokmklo](https://github.com/plokmklo) on 2026-10-18T02:00:41Z. **Review:** COMMENTED --- ### Independent verification (Linux x86-64, relinker-only, GCC 14.2.0, current `main` 0bb238b4a) **Build and tests** - Relinker-only Release build of head `c56cafae2` is clean. - Full relinker-only ctest: **188/188 passed**, including `linux_gnu_segments` — matches the Tested section. - Fail-on-main check confirmed: running `test_linux_gnu_segments.py` from this PR against a relinker built from `main` fails, so the test bites the regression it claims to. **Behavior probes against the real binary** (synthetic ET_DYN fixture: PT_LOAD RX 0..0x1000 + PT_DYNAMIC, spare headers filled with `PT_GNU_STACK`, a writable `PT_LOAD` at 0x1000, and `PT_GNU_RELRO` inside it): - `main`: both GNU headers silently dropped from the output. - This PR: output keeps `PT_GNU_STACK` (flags 0x6, zero addresses) and `PT_GNU_RELRO` rebased onto its file range inside the covering writable load (off 0x5000, vaddr 0x1000), placed in the load-sorted layout with the program-header slot accounting intact (7 → 9 headers, no slot error). **Logic reading — nothing blocking found** - `hasWritableLoadCoverage` runs on the INPUT layout while the RELRO is emitted into the OUTPUT layout. I verified the equivalence holds today: kept PT_LOADs carry vaddr/memsz through 1:1 (probe-confirmed), the synthetic extra-block load sits past `GuestLoadPageEnd`, and `_sortLoadHeaders` reorders without shrinking ranges — so input-derived coverage implies output coverage. If a future layout change ever breaks that invariant, this is the assumption that breaks first; a line in the relinker technical-debt entry would pin it. - RELRO omission under lazy binding is threaded as `options.LazyBinding` into the Linux patcher only; the PE and Mach-O paths never see this filter, so the scope is correct. - The lazy-binding justification rests on the author's layout analysis of one PS5 eboot (697 JUMP_SLOT targets inside RELRO, no BIND_NOW); I cannot reproduce that here without title files — reviewed, not reproduced, and the PR already labels it exactly that way. **Adjacent observation (out of this PR's scope)** - `PT_GNU_PROPERTY` (0x6474e553) is also inside `[PT_LOOS, PT_HIOS]` and is still dropped with this PR applied: probed with a `PT_GNU_PROPERTY` mapped inside the load segment carrying a GNU property note — the header is silently omitted from the output. Same fidelity class as #6394, no intent evidence either way in the tree (no dead writer path references it). If the maintainer wants it preserved, it slots into `ShouldSkip` next to the two headers here; I can send that as a follow-up PR once this one merges (verifiable with the same fixture harness).
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!6406
No description provided.