This is the mail archive of the libc-alpha@sourceware.org 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: [PATCHv6 0/4] glibc tunables


On 11/16/2016 09:35 AM, Siddhesh Poyarekar wrote:

 - I realized that __tunables_init used strncmp and strlen.  They're built into
   ld.so too, but they are likely tunables targets and I don't want them to
   break unintentionally in future, so off they go

In statically linked binaries, tunables_strdup calls __mmap before the TCB is initialized. This is not supported.

With --enable-stack-protector=all, __getpagesize receive stack protector instrumentation, and binaries crash because it is called in tunables_strdup. This call is unnecessary because the length argument to mmap does not have to be a multiple of the page size.

However, even if __getpagesize is removed, the __mmap problem will persist. The existing TCB initialization code uses sbrk instead of mmap, but has the same issue.

It might be possible to avoid copying the string at all if you do not require that string parameters are NULL-terminated, and instead store the length explicitly.

Thanks,
Florian


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