This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: ELF: Add a "-z readonly" option to ld


On Tue, Nov 7, 2017 at 7:44 PM, Alan Modra <amodra@gmail.com> wrote:
> 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.)
>

I will see what I can do.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]