use explicit_bzero() instead of memset_explicit()
authorDebian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
Tue, 26 May 2026 12:46:55 +0000 (15:46 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 26 May 2026 12:46:55 +0000 (15:46 +0300)
commitec8bc2927d7700fbb9ffef35da427ab908d6edca
treea18f8cea2172bf8304ad0c7d49b6fdf365e7a662
parentcb8780024644c3943d2dc16c09b8b118b3438784
use explicit_bzero() instead of memset_explicit()

lib/replace/replace.h header defines ZERO_STRUCT macro
which uses memset_explicit() function (which is similar to
memset() but can not be optimized out by the compiler).
Glibc has explicit_bzero() with similar property, while
memset_explicit() is implemented in lib/replace/replace.c, -
this way, some binaries needlessly link to libreplace
just to get rep_memset_explicit() symbol.  By using
explicit_bzero() instead, this endless linkage is eliminated,
so we can package, for example, libldb (which uses ZERO_STRUCT)
without it linking to libreplace-samba4.

Unfortunately there are just insane amount of similar
but non-standard functions, and upstream don't want
to stay on something simple and robust in this context.

Gbp-Pq: Name use-explicit_bzero-to-zero-memory.diff
lib/replace/replace.h