[PATCH 2/2] x86-64: Use MAXPAGESIZE for the relro segment alignment
Michael Matz
matz@suse.de
Tue Feb 15 14:57:33 GMT 2022
Hello,
On Tue, 15 Feb 2022, H.J. Lu wrote:
> > > Adjust x86-64 linker tests after reverting
> > >
> > > commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be
> > > Author: Alan Modra <amodra@gmail.com>
> > > Date: Thu Feb 3 08:57:47 2022 +1030
> > >
> > > PR28824, relro security issues, x86 keep COMMONPAGESIZE relro
> > >
> > > to use MAXPAGESIZE for the end of the relro segment alignment, like other
> > > ELF targets.
> > >
> > > --- a/ld/testsuite/ld-x86-64/pr14207.d
> > > +++ b/ld/testsuite/ld-x86-64/pr14207.d
> > > @@ -11,9 +11,9 @@ There are 4 program headers, starting at offset 64
> > > Program Headers:
> > > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> > > LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000150 0x000150 R 0x200000
> > > - LOAD 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x000c.8 RW 0x200000
> > > - DYNAMIC 0x000b.0 0x0000000000200b.0 0x0000000000200b.0 0x0001.0 0x0001.0 RW 0x8
> > > - GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x0004.8 R 0x1
> > > + LOAD 0x1ffb.8 0x00000000003ffb.8 0x00000000003ffb.8 0x0004.0 0x000c.8 RW 0x200000
> > > + DYNAMIC 0x1ffb.0 0x00000000003ffb.0 0x00000000003ffb.0 0x0001.0 0x0001.0 RW 0x8
> > > + GNU_RELRO 0x1ffb.8 0x00000000003ffb.8 0x00000000003ffb.8 0x0004.0 0x0004.8 R 0x1
> >
> > This change implies that the filesize increased by 2MB (and I verified
> > this to be the case). I don't think that's a good trade-off. E.g. I have
> > about 3500 binaries in /usr/bin/ alone. That linker change translates to
> > an overall increase of 7 Gigabytes filesize. Right now all the files
> > therein are about 1GB.
> >
> > So, please!
>
> Do they use 2MB pages?
I missed the explicit '-z max-page-size=0x200000' in those tests link
command and verified that not using it still generates small executables.
Sorry for the noise, by default everything should be just fine.
Ciao,
Michael.
More information about the Binutils
mailing list