glibc/debug
Zack Weinberg 4e2f43f842 Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
The _chk variants of all of the printf functions become much simpler.
This is the last thing that we needed _IO_acquire_lock_clear_flags2
for, so it can go as well.  I took the opportunity to make the headers
included and the names of all local variables consistent across all the
affected files.

Since we ultimately want to get rid of __no_long_double as well, it
must be possible to get all of the nontrivial effects of the _chk
functions by calling the _internal functions with appropriate flags.
For most of the __(v)xprintf_chk functions, this is covered by
PRINTF_FORTIFY plus some up-front argument checks that can be
duplicated.  However, __(v)sprintf_chk installs a custom jump table so
that it can crash instead of overflowing the output buffer.  This
functionality is moved to __vsprintf_internal, which now has a
'maxlen' argument like __vsnprintf_internal; to get the unsafe
behavior of ordinary (v)sprintf, pass -1 for that argument.

obstack_printf_chk and obstack_vprintf_chk are no longer in the same
file.

As a side-effect of the unification of both fortified and non-fortified
vdprintf initialization, this patch fixes bug 11319 for __dprintf_chk
and __vdprintf_chk, which was previously fixed only for dprintf and
vdprintf by the commit

commit 7ca890b88e
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Feb 24 16:07:57 2010 -0800

    Fix reporting of I/O errors in *dprintf functions.

This patch adds a test case to avoid regressions.

Tested for powerpc and powerpc64le.
2018-12-05 18:15:43 -02:00
..
asprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
backtrace-tst.c
backtrace.c Use x86_64 backtrace as generic version. 2018-03-21 17:25:30 +00:00
backtracesyms.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
backtracesymsfd.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
catchsegv.sh Update copyright dates not handled by scripts/update-copyrights. 2018-01-01 00:41:16 +00:00
chk_fail.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
confstr_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Depend
dprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
execinfo.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
explicit_bzero_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fdelt_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fgets_chk.c Remove _IO_file_flags define. 2018-02-21 14:22:50 -05:00
fgets_u_chk.c Remove _IO_file_flags define. 2018-02-21 14:22:50 -05:00
fgetws_chk.c Remove _IO_file_flags define. 2018-02-21 14:22:50 -05:00
fgetws_u_chk.c Remove _IO_file_flags define. 2018-02-21 14:22:50 -05:00
fortify_fail.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
fread_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fread_u_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fwprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
getcwd_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getdomainname_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getgroups_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gethostname_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gets_chk.c Remove _IO_file_flags define. 2018-02-21 14:22:50 -05:00
getwd_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
longjmp_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Makefile Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
mbsnrtowcs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mbsrtowcs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mbstowcs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memmove_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mempcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
memset_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
noophooks.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
obprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
pcprofile.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pcprofiledump.c Update copyright dates not handled by scripts/update-copyrights. 2018-01-01 00:41:16 +00:00
poll_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ppoll_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pread64_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pread_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
printf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
read_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
readlink_chk.c __readlink_chk: Remove micro-optimization 2018-08-21 11:24:12 +02:00
readlinkat_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
readonly-area.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
realpath_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
recv_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
recvfrom_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
segfault.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
snprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
sprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
stack_chk_fail_local.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stack_chk_fail.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stpncpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strcat_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strncat_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
strncpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
swprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
test-stpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-strcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace2.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace3.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace4.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace5.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace6.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-backtrace.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-chk1.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00: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. 2018-01-01 00:32:25 +00:00
tst-longjmp_chk.c
tst-ssp-1.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ttyname_r_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
vasprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vdprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
Versions New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
vfprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vfwprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vobprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vsnprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vsprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vswprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
vwprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
warning-nop.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcpcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcpncpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcrtomb_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcscat_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcscpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcsncat_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcsncpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcsnrtombs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcsrtombs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wcstombs_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wctomb_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wmemcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wmemmove_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wmempcpy_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wmemset_chk.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wprintf_chk.c Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319) 2018-12-05 18:15:43 -02:00
xtrace.sh Update copyright dates not handled by scripts/update-copyrights. 2018-01-01 00:41:16 +00:00