This is the mail archive of the mailing list for the glibc 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: [PATCH] mprotect segments with extra PROT_WRITE bit when DT_TEXTREL bit is set

On 29/08/2018 10:55, Florian Weimer wrote:
> On 08/23/2018 07:52 AM, Fangrui Song wrote:
>>      * elf/dl-reloc.c (_dl_relocate_object): __mprotect with extra
>>      PROT_WRITE bit.
> This needs a bug in Bugzilla (is it bug 20480?), reference in the ChangeLog entry, and, ideally, a regression test.

BZ#20480 is the same issue with a different origin.

> I can see that the current code has a problem, but I assume we do things this way because we want to create an RWX mapping, even temporarily. System security policy may prevent the creation of such mappings.  We would have have to flip between RW and RWX protection flags around IFUNC handlers to fix that.
> Thanks,
> Florian

All the projects I am aware tries to avoid text relocation and consider it a
security issue, however if user still want to mix ifunc plus textrel it would
require a executable segment (which is default for some glibc targets along
with some symbols calls).

One option is we could just bail out as some ld.bfd targets does at linking
time, but it seems lld behaviour might not be unique. I don't have a strong
preference here, if the binary fails due system security policy (a hardened
kernel which prevents it), I think it is an issue which should be fixed by 
*not* using textrel.

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