[PATCH] D40029: [ELF] Only add contiguous isRelro sections to PT_GNU_RELRO PHDR

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 17:53:18 PST 2017


On Fri, Nov 17, 2017 at 3:11 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote

> My opinions on this so far are
>
> There should be just one PT_GNU_RELRO. We should try to get the dynamic
> linkers changed only if there is a direct advantaged to having multiple
> versus having the static linker putting the data in the right order.
>
> I am OK with producing an error if a linker script would have caused
> mulitple PT_GNU_RELRO to be created.
>

I'm okay with that too. It doesn't quite right to create a
partially-protected binary when we need multiple RELROs. I'd choose one of

 - reporting an error when an output needs more than oen RELRO,
 - emitting a warning that a RELRO segment is not contiguous and don't
create RELRO at all, or
 - creating multiple RELROs

We can probably ignore empty sections when decided the PT_GNU_RELRO
> start and end. This means we would have an error only when there is a ro
> copy relocation.
>
> Can we rename the section to .data.rel.ro.bss but keep the current
> flags or would bfd error out with bss data not in the end of a PT_LOAD?
>
> Cheers,
> Rafael
>
> Peter Collingbourne via Phabricator <reviews at reviews.llvm.org> writes:
>
> > pcc added a comment.
> >
> > In https://reviews.llvm.org/D40029#927193, @peter.smith wrote:
> >
> >> Adding pcc as the original author of https://reviews.llvm.org/D28272.
> >>
> >> Peter, in  https://reviews.llvm.org/D28272#637284 you mention that
> you'd add a follow up patch that used .data.rel.ro rather than .bss.rel.ro
> for the copy relocations. I can't work out if that ever landed. Can you let
> me know if did? I've just ran into a case where the assumptions made by a
> ld.bfd linker script cause problems with the .bss.rel.ro name.
> >
> >
> > No, the use of NOBITS is deliberate. See http://lists.llvm.org/
> pipermail/llvm-commits/Week-of-Mon-20170102/417025.html
> >
> > Could we instead rename .bss.rel.ro to .data.rel.ro only if the linker
> script has a SECTIONS clause?
> >
> >
> > https://reviews.llvm.org/D40029
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/549bfeb1/attachment.html>


More information about the llvm-commits mailing list