Conversation
… p_memsz arm64 --pie binaries died at startup on native 4K/16K-page kernels: `mprotect of the PT_GNU_RELRO region failed`, SIGTRAP (mach#1885). The ELF writer rounds PT_GNU_RELRO p_memsz up to the IMAGE max-page (64 KiB on aarch64, mach#1845), but the kernel maps the tiny .data.rel.ro segment rounded to the RUNTIME page; on a runtime page smaller than the image max-page the re-protect spanned the unmapped tail and faulted ENOMEM. mach-std#347 made that fatal. Take the extent from the RELRO segment's backing PT_LOAD (its actual mapped size) instead of the writer's rounded p_memsz, and round it up to AT_PAGESZ in relro_reprotect - the pages the kernel actually mapped. The rounding now lives against the runtime page, not the build-time max-page. #347's fatal semantics stay: AT_PAGESZ absence, a region with no backing segment, a misaligned start, or an mprotect failure each panic naming the invariant. Update the negative-path probe to force a misaligned start (the congruence gate is gone).
fix(runtime/linux): re-protect the RELRO segment's mapped extent, not p_memsz (mach#1885)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rolls dev to main: the RELRO re-protection computes its extent from the covered PT_LOAD's actual mapped size rounded to AT_PAGESZ instead of the writer's image-max-rounded PT_GNU_RELRO p_memsz (#1885 / mach#1885, fix/1885 PR #360). Proven on native arm64: v2.14.0-written --pie binaries harden and run (exit 42, mprotect=0) instead of crashing (ENOMEM, exit 133). Fatal semantics of #347 unchanged.