[PATCH] explicit_bzero final

Florian Weimer fweimer@redhat.com
Wed Dec 14 17:06:00 GMT 2016


On 12/14/2016 02:15 PM, Florian Weimer wrote:
> On 12/14/2016 02:04 AM, Zack Weinberg wrote:
>> We also have a nasty interaction between internal PLT bypass and
>> ifuncs which means that a hypothetical __explicit_bzero_chk is
>> ridiculously difficult to implement.  I tried that once already and it
>> did not go well.
>
> I'm looking into this aspect right now.

This patch on top of yours implements proper explict_bzero and 
__explicit_bzero_chk symbols.  I put it through build-many-glibcs, and 
it results in the expected ABI everywhere.

The attached patch also fixes the compiler barrier, and removes some 
unnecessary conditionals from include/string.h (because we know that a 
current GCC is used for compiling glibc itself, so checking for that in 
an internal header does not make sense).

It is up to the architecture maintainers to add optimized 
implementations.  For explicit_bzero, this is often quite 
straightforward because many architectures already have an optimized 
bzero, and explicit_bzero can just be an alias.  But there is no 
__bzero_chk.  IFUNC is transitive: if something is an IFUNC, all callers 
in libc.so have to be an IFUNC, too.  Implementing __bzero_chk on top of 
__memset_chk requires a tiny bit of argument adjustment, but in 
practice, this means that all memset implementations need to be 
duplicated, and a new IFUNC resolver has to be added.

Nevertheless, I think this is the way to proceed.

Thanks,
Florian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: explicit_bzero.patch
Type: text/x-patch
Size: 30373 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20161214/6eca602d/attachment.bin>


More information about the Libc-alpha mailing list