Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aqK8W1SisUBB6-yp@intrepid>
Date: Thu, 10 Sep 2026 16:19:07 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: [v2] Apply relro protections in static PIE

Hi all,

as per the prior discussion, please find attached a v2 version of the
relro for static PIE patch. Now all the code is added to rcrt1.c. I said
there would be a lot of duplicate code and there is, but I also missed
something else in V1: mprotect() fails with EINVAL if pointer and length
aren't page aligned. So that's fixed now as well.

The patch adds a reference to _DYNAMIC to rcrt1.c, to easily determine
the load base address. There are three approaches available to me
(PT_PHDR, PT_DYNAMIC, and the weird thing with the first PT_LOAD
segment), but since static PIEs must necessarily have a dynamic segment
if they have any relocations at all, I think this is the easiest, and is
justified. For that reason, the code also crashes if no PT_DYNAMIC
segment is present in the list of phdrs, but PT_GNU_RELRO is.

Have a nice day,
Markus

View attachment "0001-Add-relro-support-for-static-linking.patch" of type "text/plain" (2533 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.