Correct access attribute on memfrob (bug 28475)
Florian Weimer
fweimer@redhat.com
Tue Oct 19 19:48:47 GMT 2021
* Joseph Myers:
> As noted in bug 28475, the access attribute on memfrob in <string.h>
> is incorrect: the function both reads and writes the memory pointed to
> by its argument, so it needs to use __read_write__, not
> __write_only__. This incorrect attribute results in a build failure
> for accessing uninitialized memory for s390x-linux-gnu-O3 with
> build-many-glibcs.py using GCC mainline.
> Correct the attribute.
That part looks okay.
> Fixing this shows up that some calls to memfrob in elf/ tests are
> reading uninitialized memory; I'm not entirely sure of the purpose of
> those calls, but guess they are about ensuring that the stack space is
> indeed allocated at that point in the function, and so it matters that
> they are calling a function whose semantics are unknown to the
> compiler. Thus, add a memset call before the memfrob call in those
> tests to avoid the use of uninitialized memory.
Using explicit_bzero would be more idomatic, I think.
Florian
More information about the Libc-alpha
mailing list