[PATCH 2/4] New string function explicit_bzero (from OpenBSD).

Zack Weinberg zackw@panix.com
Fri Aug 19 19:54:00 GMT 2016


On Fri, Aug 19, 2016 at 12:31 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> Well, current memset_chk default implementation just does:
>
>   if (__glibc_unlikely (dstlen < len))
>     __chk_fail ();
>
> So it would be feasible imho to just this add and call memset instead
> of memset_chk.

For clarity, you are imagining this as the in-libc, out-of-line
implementation of __explicit_bzero_chk?  Because as long as there's
*some* inline definition of explicit_bzero, we have to have the
exported __glibc_read_memory and then I don't see why we shouldn't
have a string2.h non-fortified inline as well.

> The problem, as pointed out by Florian, is not the symbol being exported
> itself, but the inline definition where all the 'inline' definition might
> either not being supported by the target compiler or have non-expected
> side effects (as for C++ with -O0).

Did you miss that there *is* an out-of-line non-fortified
explicit_bzero?  Which means that the bug you pointed out should be a
non-issue.

zw



More information about the Libc-alpha mailing list