Skip to content

release: RELRO re-protect uses runtime page + mapped extent (fixes arm64 --pie startup crash)#361

Merged
octalide merged 2 commits into
mainfrom
dev
Jul 3, 2026
Merged

release: RELRO re-protect uses runtime page + mapped extent (fixes arm64 --pie startup crash)#361
octalide merged 2 commits into
mainfrom
dev

Conversation

@octalide

@octalide octalide commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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.

octalide and others added 2 commits July 3, 2026 10:14
… 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)
@octalide octalide merged commit 24ff777 into main Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant