glibc/string
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
..
bits New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
_strerror.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-addsep.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-append.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-count.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-create.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-ctsep.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-delete.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-extract.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-insert.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-next.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-replace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz-stringify.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
argz.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
basename.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bcopy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bug-envz1.c * string/Makefile (tests): Add bug-envz1. 2006-06-04 16:36:04 +00:00
bug-strcoll1.c Update. 2001-04-26 20:45:18 +00:00
bug-strcoll2.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bug-strncat1.c * malloc/memusagestat.c (main): Use return instead of exit to 2000-12-31 10:52:32 +00:00
bug-strpbrk1.c * malloc/memusagestat.c (main): Use return instead of exit to 2000-12-31 10:52:32 +00:00
bug-strspn1.c * malloc/memusagestat.c (main): Use return instead of exit to 2000-12-31 10:52:32 +00:00
bug-strtok1.c [BZ #2126] 2006-01-10 00:25:07 +00:00
byteswap.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bzero.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Depend Update. 2001-03-19 21:40:15 +00:00
endian.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
envz.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
envz.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
explicit_bzero.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
ffs.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ffsll.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
inl-tester.c Update. 1997-09-11 12:09:10 +00:00
Makefile New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
memccpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memcmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memfrob.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memmem.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memmove.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memory.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mempcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memrchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memset.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
noinl-tester.c Update. 1997-09-16 00:42:43 +00:00
rawmemchr.c Improve generic rawmemchr for targets that don't have an 2016-12-14 13:16:13 +00:00
stpcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stpncpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
str-two-way.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
stratcliff.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcasecmp_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcasecmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcasestr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcat.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strchrnul.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcoll_l.c Bug 20729: Fix building with -Os. 2016-10-29 23:50:56 -04:00
strcoll.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcspn.c Use PTR_ALIGN_DOWN on strcspn and strspn 2016-04-01 18:33:03 -03:00
strdup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strerror_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strerror.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strfry.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
string-inlines.c Improve strtok and strtok_r performance. Instead of calling strpbrk which 2016-12-14 15:12:18 +00:00
string.h New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
strings.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strlen.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncase_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncase.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncat.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strndup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strnlen.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strpbrk.c Improve generic strpbrk performance 2016-04-01 10:44:45 -03:00
strrchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strsep.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strsignal.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strspn.c Use PTR_ALIGN_DOWN on strcspn and strspn 2016-04-01 18:33:03 -03:00
strstr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strtok_r.c Improve strtok and strtok_r performance. Instead of calling strpbrk which 2016-12-14 15:12:18 +00:00
strtok.c Improve strtok and strtok_r performance. Instead of calling strpbrk which 2016-12-14 15:12:18 +00:00
strverscmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strxfrm_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strxfrm.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
swab.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-bcopy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-bzero.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-explicit_bzero.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
test-ffs.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memccpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memchr.c Fix typos and missing closing bracket in test-memchr.c 2016-12-16 14:37:54 -02:00
test-memcmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memcpy.c Clear destination buffer updated by the previous run 2016-05-18 05:51:59 -07:00
test-memmem.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memmove.c Clear destination buffer updated by the previous run 2016-05-18 05:51:59 -07:00
test-mempcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memrchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-memset.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
test-rawmemchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-stpcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-stpncpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcasecmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcasestr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcat.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strchrnul.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strcspn.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-string.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strlen.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strncasecmp.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strncat.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strncmp.c Fix wide-char testsuite SIGBUS on platforms such as Sparc. 2016-08-02 17:46:58 -07:00
test-strncpy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strnlen.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strpbrk.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strrchr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strspn.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-strstr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
testcopy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tester.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-bswap.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-cmp.c string: More tests for strcmp, strcasecmp, strncmp, strncasecmp 2016-08-26 14:28:46 +02:00
tst-endian.c S390: Fix build failure in test string/tst-endian.c with gcc 6. 2016-01-25 12:44:46 +01:00
tst-inlcall.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-strcoll-overflow.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-strfry.c * stdlib/random_r.c (__initstate_r): Don't use non-existing state. 2005-04-12 15:29:07 +00:00
tst-strlen.c Modify several tests to use test-skeleton.c 2015-08-06 02:59:04 -04:00
tst-strtok_r.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-strtok.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-strxfrm2.c Let 'make check subdirs=string' succeed even when it's invoked 2015-09-28 16:55:57 -04:00
tst-strxfrm.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-svc2.c [BZ #9893] 2009-03-14 23:57:33 +00:00
tst-svc.c Modify several tests to use test-skeleton.c 2015-08-06 02:59:04 -04:00
tst-svc.expect * string/strverscmp.c (__strverscmp): Fix last cleanups. 2009-04-07 06:51:59 +00:00
tst-svc.input * string/strverscmp.c (__strverscmp): Fix last cleanups. 2009-04-07 06:51:59 +00:00
tst-xbzero-opt.c New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
Versions New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
wordcopy.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
xpg-strerror.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00