This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: ELF: Add a "-z readonly" option to ld
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 8 Nov 2017 14:14:23 +1030
- Subject: Re: RFC: ELF: Add a "-z readonly" option to ld
- Authentication-results: sourceware.org; auth=none
- References: <20171108002522.GA24595@gmail.com>
On Tue, Nov 07, 2017 at 04:25:22PM -0800, H.J. Lu wrote:
> To reduce the file size, I changed the default max page size to the
> common page size when -z readonly is used.
So what happens if the executable is run on a system using
maxpagesize? I suspect it dies, which isn't OK. The executable must
still run, but it would be reasonable to not provide the expected
non-exec protection in that case.
To do this correctly, and reduce file and memory size when running on
a system using commonpagesize, I think you're going to need a new
script. The transitions between the first read-only segment and the
text segment and then to the next read-only segment ought to use
alignments like we do currently for the transition to the read/write
segment when not relro. Which if I'm remembering correctly is to
leave a maxpagesize gap then conditionally align to commonpagesize.
(For a first pass at the support, you might like to try always
aligning to commonpagesize.)
--
Alan Modra
Australia Development Lab, IBM