glibc/sysdeps/unix/sysv/linux
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
..
aarch64 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
alpha New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
arm New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
bits Include <linux/falloc.h> in bits/fcntl-linux.h. 2016-12-14 18:23:15 +00:00
generic Consolidate rename Linux implementation 2016-12-14 15:31:24 -02:00
hppa New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
i386 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
ia64 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
include/sys Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
m68k New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
microblaze New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
mips New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
net Installed-header hygiene (BZ#20366): time.h types. 2016-09-23 08:43:56 -04:00
netash
netatalk
netax25
neteconet
netinet Installed-header hygiene (BZ#20366): obsolete BSD u_* types. 2016-09-23 08:43:56 -04:00
netipx Installed-header hygiene (BZ#20366): obsolete BSD u_* types. 2016-09-23 08:43:56 -04:00
netiucv Add missing iucv related defines. 2016-04-27 09:08:29 +02:00
netpacket
netrom
netrose Installed-header hygiene (BZ#20366): Simple self-contained fixes. 2016-09-23 08:43:55 -04:00
nfs
nios2 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
powerpc New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
s390 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
scsi
sh New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
sparc New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
sys Installed-header hygiene (BZ#20366): time.h types. 2016-09-23 08:43:56 -04:00
tile New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
wordsize-64 Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
x86 Get rid of __elision_available 2016-12-07 09:35:07 +01:00
x86_64 New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
Implies
Makefile Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
Versions
_G_config.h
_exit.c
a.out.h
accept.c
accept4.c
access.c New internal function __access_noerrno 2016-11-16 15:53:58 -02:00
adjtime.c
aio_misc.h
aio_sigqueue.c
arch-fork.h
bind.c
check_native.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
check_pf.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
clock.c
clock_getcpuclockid.c
clock_getres.c
clock_gettime.c
clock_nanosleep.c
clock_settime.c
cmsg_nxthdr.c
configure
configure.ac
connect.c
createthread.c Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
default-sched.h
device-nrs.h
dl-brk.c
dl-execstack.c
dl-fxstatat64.c
dl-getcwd.c
dl-librecon.h
dl-openat64.c Assume __NR_openat is always defined 2016-03-23 23:35:08 +01:00
dl-opendir.c
dl-origin.c
dl-osinfo.h
dl-sbrk.c
dl-sysdep.c
dl-sysdep.h
dl-vdso.c
dl-vdso.h
dl-writev.h
epoll_pwait.c
errqueue.h
eventfd_read.c
eventfd_write.c
exit-thread.h
faccessat.c
fallocate.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
fallocate64.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
fatal-prepare.h
fchmodat.c
fcntl.c
fd_to_filename.h
fexecve.c
fips-private.h
fpathconf.c
fstatfs64.c Fix for [f]statfs64/[f]statfs aliasing patch 2016-11-28 08:51:01 -08:00
fstatvfs.c
fstatvfs64.c
ftime.c
ftruncate.c Consolidate Linux ftruncate implementations 2016-11-09 17:46:11 -02:00
ftruncate64.c Consolidate Linux ftruncate implementations 2016-11-09 17:46:11 -02:00
futex-internal.h
futimens.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
futimes.c
futimesat.c
fxstat.c Always define XSTAT_IS_XSTAT64 2016-11-21 08:23:12 -08:00
fxstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
fxstatat.c Always define XSTAT_IS_XSTAT64 2016-11-21 08:23:12 -08:00
fxstatat64.c
gai_sigqueue.c
getclktck.c
getcwd.c
getdents.c Remove __ASSUME_GETDENTS64_SYSCALL. 2016-03-22 00:32:20 +00:00
getdents64.c
getdirentries.c
getdirentries64.c
getdtsz.c
getentropy.c Add getentropy, getrandom, <sys/random.h> [BZ #17252] 2016-12-12 17:28:04 +01:00
gethostid.c
getipv4sourcefilter.c
getloadavg.c
getlogin.c
getlogin_r.c
getpagesize.c
getpeername.c
getpriority.c
getpt.c
getrandom.c Add getentropy, getrandom, <sys/random.h> [BZ #17252] 2016-12-12 17:28:04 +01:00
getrlimit.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
getrlimit64.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
getsockname.c
getsockopt.c
getsourcefilter.c
getsysstats.c
gettimeofday.c
grantpt.c
if_index.c
ifaddrs.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
ifreq.c
internal_statvfs.c
internal_statvfs64.c
ipc_priv.h
kernel-features.h Remove __ASSUME_FUTEX_LOCK_PI 2016-06-13 08:36:34 -03:00
kernel-posix-cpu-timers.h
kernel-posix-timers.h
kernel_sigaction.h
kernel_stat.h Allow [f]statfs64 to alias [f]statfs 2016-11-22 09:59:12 -08:00
kernel_termios.h
ldd-rewrite.sed
lddlibc4.c
ldsodefs.h Fix build with HAVE_AUX_VECTOR 2016-04-11 10:27:25 +02:00
libc_fatal.c
linux_fsinfo.h
listen.c
local-setxid.h
lowlevellock-futex.h
lseek.c Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
lseek64.c Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
lutimes.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
lxstat.c Always define XSTAT_IS_XSTAT64 2016-11-21 08:23:12 -08:00
lxstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
malloc-sysdep.h
mmap64.c
mq_close.c
mq_getattr.c
mq_notify.c
mq_open.c
mq_receive.c
mq_send.c
mq_unlink.c
msgctl.c
msgget.c
msgrcv.c
msgsnd.c
netlink_assert_response.c
netlinkaccess.h
nice.c
not-cancel.h
nptl-signals.h Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
nscd_setup_thread.c
ntp_gettime.c
ntp_gettimex.c
open64.c
openat.c
openat64.c
opendir.c
opensock.c
pathconf.c
pathconf.h
paths.h
personality.c
posix_fadvise.c Consolidate posix_fadvise implementations 2016-10-07 14:16:41 -03:00
posix_fadvise64.c Consolidate posix_fadvise implementations 2016-10-07 14:16:41 -03:00
posix_fallocate.c Consolidate posix_fallocate{64} implementations 2016-10-07 14:16:41 -03:00
posix_fallocate64.c Consolidate posix_fallocate{64} implementations 2016-10-07 14:16:41 -03:00
posix_madvise.c
ppoll.c Remove __ASSUME_PPOLL. 2016-03-15 21:11:07 +00:00
pread.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pread64.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
preadv.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
preadv64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
prlimit.c
prof-freq.c
profil.c
pselect.c
pt-raise.c Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
pthread-pids.h Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
pthread_getaffinity.c
pthread_getcpuclockid.c
pthread_getname.c
pthread_kill.c Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
pthread_setaffinity.c
pthread_setname.c
pthread_sigmask.c
pthread_sigqueue.c Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
ptrace.c
ptsname.c
pwrite.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pwrite64.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pwritev.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pwritev64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
raise.c Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
readahead.c
readdir64.c
readdir64_r.c
readonly-area.c
reboot.c
recv.c
recvfrom.c
recvmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
recvmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
remove.c
rename.c Consolidate rename Linux implementation 2016-12-14 15:31:24 -02:00
renameat.c Consolidate renameat Linux implementation 2016-12-14 15:31:24 -02:00
sa_len.c
safe-fatal.h
sched_getaffinity.c
sched_getcpu.c
sched_setaffinity.c
segfault.c
semctl.c
semget.c
semop.c
semtimedop.c
send.c
sendmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendto.c
setegid.c
seteuid.c
setgid.c
setgroups.c
sethostid.c
setipv4sourcefilter.c
setregid.c
setresgid.c
setresuid.c
setreuid.c
setrlimit.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
setrlimit64.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
setsockopt.c
setsourcefilter.c
setuid.c
shlib-versions
shm-directory.c
shmat.c
shmctl.c
shmdt.c
shmget.c
shutdown.c
sigaction.c
siglist.h
signal.c
signalfd.c Remove __ASSUME_SIGNALFD4. 2016-03-21 16:30:05 +00:00
sigpending.c
sigprocmask.c
sigqueue.c
sigreturn.c
sigset-cvt-mask.h
sigstack.c
sigsuspend.c
sigtimedwait.c
sigwait.c
sigwaitinfo.c
sizes.h
socket.c
socketcall.h
socketpair.c
spawni.c posix: Fix open file action for posix_spawn on Linux 2016-09-28 14:07:35 -07:00
speed.c
statfs64.c Fix for [f]statfs64/[f]statfs aliasing patch 2016-11-28 08:51:01 -08:00
statvfs.c
statvfs64.c
sync_file_range.c Consolidate Linux sync_file_range implementations 2016-10-11 16:21:12 -03:00
syscalls.list Consolidate renameat Linux implementation 2016-12-14 15:31:24 -02:00
sysconf.c
sysctl.c
sysctl.mk
sysdep-vdso.h
sysdep.h Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
syslog.c
system.c
tcdrain.c
tcflow.c
tcflush.c
tcgetattr.c
tcgetpgrp.c
tcsendbrk.c
tcsetattr.c
tcsetpgrp.c
termio.h
time.c
timer_create.c
timer_delete.c
timer_getoverr.c
timer_gettime.c
timer_routines.c
timer_settime.c
times.c Expand comments in Linux times() implementation. 2016-06-19 15:47:00 -04:00
timespec_get.c
truncate.c Consolidate Linux truncate implementations 2016-11-09 17:46:17 -02:00
truncate64.c Consolidate Linux truncate implementations 2016-11-09 17:46:17 -02:00
tst-affinity-pid.c
tst-affinity.c
tst-align-clone.c
tst-clone.c
tst-clone2.c Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
tst-fallocate-common.c support: Introduce new subdirectory for test infrastructure 2016-12-09 08:18:27 +01:00
tst-fallocate.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
tst-fallocate64.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
tst-fanotify.c
tst-getpid1.c
tst-personality.c
tst-quota.c Base <sys/quota.h> on Linux kernel headers [BZ #20525] 2016-09-01 15:53:13 +02:00
tst-setgetname.c Fix -Wformat-length warning in tst-setgetname.c 2016-10-24 09:43:54 -07:00
tst-skeleton-affinity.c
tst-skeleton-thread-affinity.c
tst-sync_file_range.c support: Introduce new subdirectory for test infrastructure 2016-12-09 08:18:27 +01:00
tst-thread-affinity-pthread.c
tst-thread-affinity-pthread2.c
tst-thread-affinity-sched.c
ttyname.c
ttyname_r.c
ualarm.c
umount.S
umount2.S
unlockpt.c
updwtmp.c
ustat.c
utimensat.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
utimes.c
utmp_file.c
vfork.c
wait.c Remove union wait [BZ #19613] 2016-04-14 08:54:57 +02:00
wait3.c
waitid.c
waitpid.c
xmknod.c
xmknodat.c
xstat.c Always define XSTAT_IS_XSTAT64 2016-11-21 08:23:12 -08:00
xstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
xstatconv.c Always define XSTAT_IS_XSTAT64 2016-11-21 08:23:12 -08:00
xstatconv.h