[PATCHv6 0/4] glibc tunables

Florian Weimer fweimer@redhat.com
Tue Dec 27 09:49:00 GMT 2016


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



More information about the Libc-alpha mailing list