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

Am Thu, Sep 10, 2026 at 04:19:07PM +0200 schrieb Markus Wichmann:
> 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

Attaching v2.1 for a whitespace fix I noticed too late. One day I will
manage to wrangle those tabs right the first time, but today is not that
day.

View attachment "0001-Add-relro-support-for-static-linking.patch" of type "text/plain" (2477 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.