Mark Kettenis via llvm-dev
2016-Dec-19 19:48 UTC
[llvm-dev] [lld] Treat .openbsd.randomdata as read-only
It is the intention that .openbsd.randomdata sections are made read-only after initialization. The native (ld.bfd based) OpenBSD toolchain accomplishes this by including .openbsd.randomdata into the PT_GNU_RELRO segment. The diff below makes ldd do the same. Index: ELF/Writer.cpp ==================================================================--- ELF/Writer.cpp (revision 290066) +++ ELF/Writer.cpp (working copy) @@ -504,7 +504,7 @@ return true; StringRef S = Sec->getName(); return S == ".data.rel.ro" || S == ".ctors" || S == ".dtors" || S == ".jcr" || - S == ".eh_frame"; + S == ".eh_frame" || S == ".openbsd.randomdata"; } template <class ELFT>
Rui Ueyama via llvm-dev
2016-Dec-20 02:08 UTC
[llvm-dev] [lld] Treat .openbsd.randomdata as read-only
LGTM On Mon, Dec 19, 2016 at 1:48 PM, Mark Kettenis via llvm-dev < llvm-dev at lists.llvm.org> wrote:> It is the intention that .openbsd.randomdata sections are made > read-only after initialization. The native (ld.bfd based) OpenBSD > toolchain accomplishes this by including .openbsd.randomdata into the > PT_GNU_RELRO segment. The diff below makes ldd do the same. > > Index: ELF/Writer.cpp > ==================================================================> --- ELF/Writer.cpp (revision 290066) > +++ ELF/Writer.cpp (working copy) > @@ -504,7 +504,7 @@ > return true; > StringRef S = Sec->getName(); > return S == ".data.rel.ro" || S == ".ctors" || S == ".dtors" || S => ".jcr" || > - S == ".eh_frame"; > + S == ".eh_frame" || S == ".openbsd.randomdata"; > } > > template <class ELFT> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161219/4e24496f/attachment.html>
Mark Kettenis via llvm-dev
2016-Dec-20 10:55 UTC
[llvm-dev] [lld] Treat .openbsd.randomdata as read-only
> From: Rui Ueyama <ruiu at google.com> > Date: Mon, 19 Dec 2016 20:08:59 -0600 > > LGTMGreat. I don't have commit access, so it would be great if you could commit this change for me. Just realized that that I should have sent this to llvm-commits instead. Apologies for that. I have some further fixes. Is Phabricator preferred these days for submitting patches? Thanks, Mark> On Mon, Dec 19, 2016 at 1:48 PM, Mark Kettenis via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > It is the intention that .openbsd.randomdata sections are made > > read-only after initialization. The native (ld.bfd based) OpenBSD > > toolchain accomplishes this by including .openbsd.randomdata into the > > PT_GNU_RELRO segment. The diff below makes ldd do the same. > > > > Index: ELF/Writer.cpp > > ==================================================================> > --- ELF/Writer.cpp (revision 290066) > > +++ ELF/Writer.cpp (working copy) > > @@ -504,7 +504,7 @@ > > return true; > > StringRef S = Sec->getName(); > > return S == ".data.rel.ro" || S == ".ctors" || S == ".dtors" || S => > ".jcr" || > > - S == ".eh_frame"; > > + S == ".eh_frame" || S == ".openbsd.randomdata"; > > } > > > > template <class ELFT> > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >