mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
ea1bd74def
explicit_bzero(s, n) is the same as memset(s, 0, n), except that the compiler is not allowed to delete a call to explicit_bzero even if the memory pointed to by 's' is dead after the call. Right now, this effect is achieved externally by having explicit_bzero be a function whose semantics are unknown to the compiler, and internally, with a no-op asm statement that clobbers memory. This does mean that small explicit_bzero operations cannot be expanded inline as small memset operations can, but on the other hand, small memset operations do get deleted by the compiler. Hopefully full compiler support for explicit_bzero will happen relatively soon. There are two new tests: test-explicit_bzero.c verifies the visible semantics in the same way as the existing test-bzero.c, and tst-xbzero-opt.c verifies the not-being-optimized-out property. The latter is conceptually based on a test written by Matthew Dempsky for the OpenBSD regression suite. The crypt() implementation has an immediate use for this new feature. We avoid having to add a GLIBC_PRIVATE alias for explicit_bzero by running all of libcrypt's calls through the fortified variant, __explicit_bzero_chk, which is in the impl namespace anyway. Currently I'm not aware of anything in libc proper that needs this, but the glue is all in place if it does become necessary. The legacy DES implementation wasn't bothering to clear its buffers, so I added that, mostly for consistency's sake. * string/explicit_bzero.c: New routine. * string/test-explicit_bzero.c, string/tst-xbzero-opt.c: New tests. * string/Makefile (routines, strop-tests, tests): Add them. * string/test-memset.c: Add ifdeffage for testing explicit_bzero. * string/string.h [__USE_MISC]: Declare explicit_bzero. * debug/explicit_bzero_chk.c: New routine. * debug/Makefile (routines): Add it. * debug/tst-chk1.c: Test fortification of explicit_bzero. * string/bits/string3.h: Fortify explicit_bzero. * manual/string.texi: Document explicit_bzero. * NEWS: Mention addition of explicit_bzero. * crypt/crypt-entry.c (__crypt_r): Clear key-dependent intermediate data before returning, using explicit_bzero. * crypt/md5-crypt.c (__md5_crypt_r): Likewise. * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. * include/string.h: Redirect internal uses of explicit_bzero to __explicit_bzero_chk[_internal]. * string/Versions [GLIBC_2.25]: Add explicit_bzero. * debug/Versions [GLIBC_2.25]: Add __explicit_bzero_chk. * sysdeps/arm/nacl/libc.abilist * sysdeps/unix/sysv/linux/aarch64/libc.abilist * sysdeps/unix/sysv/linux/alpha/libc.abilist * sysdeps/unix/sysv/linux/arm/libc.abilist * sysdeps/unix/sysv/linux/hppa/libc.abilist * sysdeps/unix/sysv/linux/i386/libc.abilist * sysdeps/unix/sysv/linux/ia64/libc.abilist * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist * sysdeps/unix/sysv/linux/microblaze/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist * sysdeps/unix/sysv/linux/nios2/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist * sysdeps/unix/sysv/linux/sh/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Add entries for explicit_bzero and __explicit_bzero_chk.
89 lines
1.8 KiB
Plaintext
89 lines
1.8 KiB
Plaintext
libc {
|
|
GLIBC_2.0 {
|
|
# functions with required interface outside normal name space
|
|
__argz_count; __argz_stringify; __argz_next;
|
|
|
|
# functions used in inline functions or macros
|
|
__bzero; __strtok_r;
|
|
|
|
# functions used in other libraries
|
|
__ffs; __mempcpy; __stpncpy; __stpcpy; __strcasecmp; __strdup;
|
|
__strerror_r;
|
|
|
|
# a*
|
|
argz_add; argz_add_sep; argz_append; argz_count; argz_create;
|
|
argz_create_sep; argz_delete; argz_extract; argz_insert; argz_next;
|
|
argz_replace; argz_stringify;
|
|
|
|
# b*
|
|
basename; bcmp; bcopy; bzero;
|
|
|
|
# e*
|
|
envz_add; envz_entry; envz_get; envz_merge; envz_remove;
|
|
envz_strip;
|
|
|
|
# f*
|
|
ffs;
|
|
|
|
# i*
|
|
index;
|
|
|
|
# m*
|
|
memccpy; memchr; memcmp; memcpy; memfrob; memmem; memmove; memset;
|
|
|
|
# r*
|
|
rindex;
|
|
|
|
# s*
|
|
stpcpy; stpncpy; strcasecmp; strcat; strchr; strcmp; strcoll; strcpy;
|
|
strcspn; strdup; strerror; strerror_r; strfry; strlen; strncasecmp;
|
|
strncat; strncmp; strncpy; strndup; strnlen; strpbrk; strrchr; strsep;
|
|
strsignal; strspn; strstr; strtok; strtok_r; strxfrm; swab;
|
|
}
|
|
GLIBC_2.1 {
|
|
# functions used in macros and other libraries
|
|
__rawmemchr; __strcasestr;
|
|
|
|
# f*
|
|
ffsl; ffsll;
|
|
|
|
# m*
|
|
mempcpy;
|
|
|
|
# r*
|
|
rawmemchr;
|
|
|
|
# s*
|
|
strcasestr; strverscmp;
|
|
}
|
|
GLIBC_2.1.1 {
|
|
# extern inline functions used by <bits/string2.h>
|
|
__mempcpy_small; __stpcpy_small; __strcspn_c1; __strcspn_c2; __strcspn_c3;
|
|
__strcpy_small; __strspn_c1; __strspn_c2; __strspn_c3; __strpbrk_c2;
|
|
__strpbrk_c3; __strsep_1c; __strsep_2c; __strsep_3c; __strsep_g;
|
|
__strtok_r_1c;
|
|
|
|
# s*
|
|
strchrnul; __strverscmp;
|
|
}
|
|
GLIBC_2.2 {
|
|
# functions used in macros.
|
|
__strndup;
|
|
|
|
# m*
|
|
memrchr;
|
|
}
|
|
GLIBC_2.3.4 {
|
|
# x*
|
|
__xpg_strerror_r;
|
|
}
|
|
GLIBC_2.6 {
|
|
strerror_l;
|
|
}
|
|
GLIBC_2.24 {
|
|
}
|
|
GLIBC_2.25 {
|
|
explicit_bzero;
|
|
}
|
|
}
|