Implement C23 memset_explicit (bug 32378)

Collin Funk collin.funk1@gmail.com
Sat Sep 27 23:47:36 GMT 2025


Joseph Myers <josmyers@redhat.com> writes:

> Add the C23 memset_explicit function to glibc.  Everything here is
> closely based on the approach taken for explicit_bzero.  This includes
> the bits that relate to internal uses of explicit_bzero within glibc
> (although we don't currently have any such internal uses of
> memset_explicit), and also includes the nonnull attribute (when we
> move to nonnull_if_nonzero for various functions following C2y, this
> function should be included in that change).
>
> Although the function is only declared here for __GLIBC_USE (ISOC23),
> there's a reasonable argument for making it more widely available by
> inclusion in __USE_MISC.
>
> Tested for x86_64 and x86.

Patch looks good to me and passes all tests. So,

Reviewed-by: Collin Funk <collin.funk1@gmail.com>

I wrote my reasoning for preferring to not make this available under
__USE_MISC in a reply to Paul. Maybe give others some time to voice
disagreement, if any, before pushing.

Collin


More information about the Libc-alpha mailing list