glibc/debug
Zack Weinberg ea1bd74def New string function explicit_bzero (from OpenBSD).
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.
2016-12-16 16:21:54 -05:00
..
asprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
backtrace-tst.c
backtrace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
backtracesyms.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
backtracesymsfd.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
catchsegv.sh Make shebang interpreter directives consistent 2016-01-07 04:03:21 -05:00
chk_fail.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
confstr_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Depend
dprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
execinfo.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
explicit_bzero_chk.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
fdelt_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgets_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgets_u_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgetws_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgetws_u_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fortify_fail.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fread_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fread_u_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fwprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
getcwd_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
getdomainname_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
getgroups_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
gethostname_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
gets_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
getwd_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
longjmp_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Makefile New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
mbsnrtowcs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mbsrtowcs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mbstowcs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memmove_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mempcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memset_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
noophooks.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
obprintf_chk.c libio: Implement vtable verification [BZ #20191] 2016-06-23 20:01:52 +02:00
pcprofile.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
pcprofiledump.c Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00
poll_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ppoll_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
pread64_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
pread_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
printf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
read_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
readlink_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
readlinkat_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
readonly-area.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
realpath_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
recv_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
recvfrom_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
segfault.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
snprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stack_chk_fail_local.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stack_chk_fail.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stpncpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcat_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncat_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
swprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-stpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-backtrace2.c debug: Additional compiler barriers for backtrace tests [BZ #20956] 2016-12-10 21:16:57 +01:00
tst-backtrace3.c debug: Additional compiler barriers for backtrace tests [BZ #20956] 2016-12-10 21:16:57 +01:00
tst-backtrace4.c debug: Additional compiler barriers for backtrace tests [BZ #20956] 2016-12-10 21:16:57 +01:00
tst-backtrace5.c debug: Additional compiler barriers for backtrace tests [BZ #20956] 2016-12-10 21:16:57 +01:00
tst-backtrace6.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-backtrace.h debug: Additional compiler barriers for backtrace tests [BZ #20956] 2016-12-10 21:16:57 +01:00
tst-chk1.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
tst-chk2.c
tst-chk3.c
tst-chk4.cc
tst-chk5.cc
tst-chk6.cc
tst-lfschk1.c
tst-lfschk2.c
tst-lfschk3.c
tst-lfschk4.cc
tst-lfschk5.cc
tst-lfschk6.cc
tst-longjmp_chk2.c test-skeleton.c: Add write_message function 2016-06-23 11:00:36 +02:00
tst-longjmp_chk3.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-longjmp_chk.c
ttyname_r_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vasprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vdprintf_chk.c libio: Implement vtable verification [BZ #20191] 2016-06-23 20:01:52 +02:00
Versions New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
vfprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vfwprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vsnprintf_chk.c libio: Implement vtable verification [BZ #20191] 2016-06-23 20:01:52 +02:00
vsprintf_chk.c libio: Implement vtable verification [BZ #20191] 2016-06-23 20:01:52 +02:00
vswprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
vwprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
warning-nop.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcpncpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcrtomb_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcscat_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcscpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcsncat_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcsncpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcsnrtombs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcsrtombs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcstombs_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wctomb_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wmemcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wmemmove_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wmempcpy_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wmemset_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wprintf_chk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
xtrace.sh Update copyright dates not handled by scripts/update-copyrights. 2016-01-04 16:26:30 +00:00