fix(relinker): give Linux guest modules a default non-executable stack #1506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1506"
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 kali113 on 2026-10-08T10:23:55Z.
What
Converted Linux guest libraries without
PT_GNU_STACKcan fail to load on glibc 2.41+: its absence is interpreted as an executable-stack requirement, anddlopenrefuses it when the process stack is non-executable (glibc change).Emit a default RW, non-executable stack header only when absent. Preserve explicit input headers, including executable flags and stack-size hints. The regression converts headerless, RW and RWX fixtures, verifies the output headers, and on Linux x86-64 loads the first two outputs, calls their export and verifies that the process stack remains non-executable. The original headerless input reproduces
cannot enable executable stack as shared object requires; the fixed output loads and returns 42. The #1156 discussion encountered the same loader failure.Rebuilt directly on
maind70b8998: one commit, four files. No changes from #1265, #1913, #1986 or #1999 remain. Main's merged #1586 unwind-header constant is preserved. The stack change is independently mergeable.Tested
Exact source head
d5241d28: independent validation passes on native GitHub Linux and Windows runners, Release / GCC, including full default builds, all-library packaging and three repetitions of the relevant runtime tests under a 30-second limit. All three related tests execute on Linux and Windows; Linux x86-64 additionally performs native loading and checks process-stack permissions. Windows checks ELF conversion and headers.These are fork validation jobs, not collaborator-dispatched upstream checks. Unrelated tests from the full suite were not run in this validation.
Local macOS 27.0.1 arm64, Apple Clang, Release relinker-only build: all 39 registered tests pass, longest 1.56 s. Native Linux loading is skipped on macOS and checked by Linux validation. Conventions and
git diff --checkpass.Checklist
mainsnapshotd70b8998; no other open PR implements this changeImported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T10:52:57Z.
Review: COMMENTED
This is a well-documented and thoroughly tested fix for a real glibc 2.41+ compatibility issue. The approach of adding a default non-executable PT_GNU_STACK header when absent is the standard solution.
Strengths:
Minor suggestions:
Overall this looks ready to merge once any rebase conflicts are resolved. Good work on the thorough testing and documentation.
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:27:04Z.
Review: APPROVED
Good improvement for Linux compatibility and security. Adding a GNU_STACK program header to converted guest modules ensures proper stack permissions (non-executable by default) which is important for modern Linux systems.
Strengths:
Technical notes:
This will improve compatibility with modern Linux systems that expect or require the GNU_STACK header. Ready to merge.
Imported from boykopovar/AnyPS5. Originally posted by kali113 on 2026-10-08T12:29:05Z.
@klosixgaming-arch I will update both PRs at 22 CEST time. thanks for the comments and help!
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-08T20:04:45Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by kali113 on 2026-10-08T20:14:42Z.
@adriadam10 Could you review this when you have time? I’ve rebased it onto current main, addressed the review suggestions, and marked it ready for review. Validation passes on Linux, Windows and macOS; the upstream checks are still queued. Thanks!
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T01:05:33Z.
Checked the diff against the description:
PT_GNU_STACK(RW) is emitted only when the input has none, explicit headers are kept as-is.linux_guest_stackpasses with the change and fails without it; relinker CI is green on Linux, Windows and macOS; merging.