| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We stopped adding "Contributed by" or similar lines in sources in 2012
in favour of git logs and keeping the Contributors section of the
glibc manual up to date. Removing these lines makes the license
header a bit more consistent across files and also removes the
possibility of error in attribution when license blocks or files are
copied across since the contributed-by lines don't actually reflect
reality in those cases.
Move all "Contributed by" and similar lines (Written by, Test by,
etc.) into a new file CONTRIBUTED-BY to retain record of these
contributions. These contributors are also mentioned in
manual/contrib.texi, so we just maintain this additional record as a
courtesy to the earlier developers.
The following scripts were used to filter a list of files to edit in
place and to clean up the CONTRIBUTED-BY file respectively. These
were not added to the glibc sources because they're not expected to be
of any use in future given that this is a one time task:
https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc
https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
/bin/bash instead
(FYI, this is a repost of
https://sourceware.org/pipermail/libc-alpha/2019-July/105035.html now
that FSF papers have been signed and confirmed on FSF side).
This trivial patch attemps to fix BZ 24106. Basically the bash locally
used when building glibc on the host shall not leak on the installed
glibc, as the system where it is installed might be different and use
another bash location.
So I have looked for all occurences of @BASH@ or $(BASH) in installed
files, and replaced it by /bin/bash. This was suggested by Florian
Weimer in the bug report.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
| |
This reimplements the generic version of backtrace.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
This will be used to consolidate the libgcc_s access for backtrace
and pthread_cancel.
Unlike the existing backtrace implementations, it provides some
hardening based on pointer mangling.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Signal number is written into the tail of buf, but printed from the
beginning, outputting garbage on the screen. Fix this by printing
from the correct position.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2021. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files. As well as the usual annual
updates, mainly dates in --version output (minus csu/version.c which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a small change to the copyright notice
in NEWS which should let NEWS get updated automatically next year.
Please remember to include 2021 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I used these shell commands:
../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")
and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 6694 files FOO.
I then removed trailing white space from benchtests/bench-pthread-locks.c
and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this
diagnostic from Savannah:
remote: *** pre-commit check failed ...
remote: *** error: lines with trailing whitespace found
remote: error: hook declined to update refs/heads/master
|
|
|
|
|
|
| |
The macro is not used anymore, so remove it and warning-nop.c.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The symbol was deprecated by strsignal and its usage imposes issues
such as copy relocations.
Its internal name is changed to __sys_siglist and __sys_sigabbrev to
avoid static linking usage. The compat code is also refactored, since
both Linux and Hurd usage the same strategy: export the same array with
different object sizes.
The libSegfault change avoids calling strsignal on the SIGFAULT signal
handler (the current usage is already sketchy, adding a call that
potentially issue locale internal function is even sketchier).
Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
on all affected platforms.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MIPS fallback code handle a frame where its FDE can not be obtained
(for instance a signal frame) by reading the kernel allocated signal frame
and adding '2' to the value of 'sc_pc' [1]. The added value is used to
recognize an end of an EH region on mips16 [2].
The fix adjust the obtained signal frame value and remove the libgcc added
value by checking if the previous frame is a signal frame one.
Checked with backtrace and tst-sigcontext-get_pc tests on mips-linux-gnu
and mips64-linux-gnu.
[1] libgcc/config/mips/linux-unwind.h from gcc code.
[2] gcc/config/mips/mips.h from gcc code. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The missing dependencies result in failures like this if make check
is invoked with sufficient parallelism for the debug subdirectory:
FAIL: debug/tst-chk2
FAIL: debug/tst-chk3
FAIL: debug/tst-chk4
FAIL: debug/tst-chk5
FAIL: debug/tst-chk6
FAIL: debug/tst-lfschk1
FAIL: debug/tst-lfschk2
FAIL: debug/tst-lfschk3
FAIL: debug/tst-lfschk4
FAIL: debug/tst-lfschk5
FAIL: debug/tst-lfschk6
|
|
|
|
|
|
| |
When unwinding through a signal frame the backtrace function on PowerPC
didn't check array bounds when storing the frame address. Fixes commit
d400dcac5e ("PowerPC: fix backtrace to handle signal trampolines").
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2020. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files. As well as the usual annual
updates, mainly dates in --version output (minus libc.texinfo which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a fix to
sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in
the copyright notice meant it failed to be updated automatically.
Please remember to include 2020 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch refactor sigcontextinfo.h header to use SA_SIGINFO as default
for both gmon and debug implementations. This allows simplify
profil-counter.h on Linux to use a single implementation and remove the
requirements for newer ports to redefine __sigaction/sigaction to use
SA_SIGINFO.
The GET_PC macro is also replaced with a function sigcontext_get_pc that
returns an uintptr_t instead of a void pointer. It allows easier convertion
to integer on ILP32 architecture, such as x32, without the need to suppress
compiler warnings.
The patch also requires some refactor of register-dump.h file for some
architectures (to reflect it is now called from a sa_sigaction instead of
sa_handler signal context).
- Alpha, i386, and s390 are straighfoward to take in consideration the
new argument type.
- ia64 takes in consideration the kernel pass a struct sigcontextt
as third argument for sa_sigaction.
- sparc take in consideration the kernel pass a pt_regs struct
as third argument for sa_sigaction.
- m68k dummy function is removed and the FP state is dumped on
register_dump itself.
- For SH the register-dump.h file is consolidate on a common implementation
and the floating-point state is checked based on ownedfp field.
The register_dump does not change its output format in any affected
architecture.
I checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
arm-linux-gnueabihf, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, and powerpc64le-linux-gnu.
I also checked the libSegFault.so through catchsegv on alpha-linux-gnu,
m68k-linux-gnu and sh4-linux-gnu to confirm the output has not changed.
Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer <fweimer@redhat.com>
* debug/segfault.c (install_handler): Use SA_SIGINFO if defined.
* sysdeps/generic/profil-counter.h (__profil_counter): Cast to
uintptr_t.
* sysdeps/generic/sigcontextinfo.h (GET_PC): Rename to
sigcontext_get_pc and return aligned cast to uintptr_t.
* sysdeps/mach/hurd/i386/sigcontextinfo.h (GET_PC): Likewise.
* sysdeps/posix/profil.c (profil_count): Change PC argument to
uintptr_t.
(__profil): Use SA_SIGINFO.
* sysdeps/posix/sprofil.c (profil_count): Change PCP argument to
uintptr_t.
(__sprofil): Use SA_SIGINFO.
* sysdeps/unix/sysv/linux/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/aarch64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/csky/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/mips/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/profil-counter.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/sh/profil-counter.h: Likewise.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (__profil_counter):
Assume SA_SIGINFO and use sigcontext_get_pc instead of GET_PC.
* sysdeps/unix/sysv/linux/sparc/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h: Remove file.
* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Likewise.
* sysdpes/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT,
GET_PC, __sigaction, sigaction): Remove defines.
(sigcontext_get_pc): New function.
* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/csky/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise.
* sysdeps/sysv/linux/sparc/sparc64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/register-dump.h (register_dump):
Handle CTX argument as ucontext_t.
* sysdeps/unix/sysv/linux/i386/register-dump.h: Likewise.
Likewise.
* sysdeps/unix/sysv/linux/m68k/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-32/register-dump.h: Likewise.
* sysdeps/sysv/linux/s390/s390-64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sh/register-dump.h: New file.
* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Remove File.
* sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: Likewise.
* sysdeps/unix/sysv/linux/Makefile (tests-internal): Add
tst-sigcontextinfo-get_pc.
* sysdeps/unix/sysv/linux/tst-sigcontextinfo-get_pc.c: New file.
(CFLAGS-tst-sigcontextinfo-get_pc.c): New rule.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the process is in a bad state, we used to print backtraces in
many cases. This is problematic because doing so could involve
a lot of work, like loading libgcc_s using the dynamic linker,
and this could itself be targeted by exploit writers. For example,
if the crashing process was forked from a long-lived process, the
addresses in the error message could be used to bypass ASLR.
Commit ed421fca42fd9b4cab7c66e77894b8dd7ca57ed0 ("Avoid backtrace from
__stack_chk_fail [BZ #12189]"), backtraces where no longer printed
because backtrace_and_maps was always called with do_abort == 1.
Rather than fixing this logic error, this change removes the backtrace
functionality from the sources. With the prevalence of external crash
handlers, it does not appear to be particularly useful. The crash
handler may also destroy useful information for debugging.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
|
|
| |
The internal _IO_stdin_ variable is not updated when the application
assigns to stdin, which is a GNU extension.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With upcoming fix for BZ#12683, pthread cancellation does not act for:
1. If syscall is blocked but with some side effects already having
taken place (e.g. a partial read or write).
2. After the syscall has returned.
The main change is due the fact programs need to act in syscalls with
side-effects (for instance, to avoid leak of allocated resources or
handle partial read/write).
This patch changes the NPTL testcase that assumes the old behavior and
also changes the tst-backtrace{5,6} to ignore the cancellable wrappers.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
powerpc-linux-gnu, sparcv9-linux-gnu, and sparc64-linux-gnu.
* debug/tst-backtrace5.c (handle_signal): Avoid cancellable wrappers
in backtrace analysis.
* nptl/tst-cancel4.c (tf_write): Handle cancelled syscall with
side-effects.
(tf_send): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to ISO C99, passing the same buffer as source and destination
to sprintf, snprintf, vsprintf, or vsnprintf has undefined behavior.
Until the commit
commit 4e2f43f842ef5e253cc23383645adbaa03cedb86
Author: Zack Weinberg <zackw@panix.com>
Date: Wed Mar 7 14:32:03 2018 -0500
Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
a call to sprintf or vsprintf with overlapping buffers, for instance
vsprintf (buf, "%sTEXT", buf), would append `TEXT' into buf, while a
call to snprintf or vsnprintf would override the contents of buf.
After the aforementioned commit, the behavior of sprintf and vsprintf
changed (so that they also override the contents of buf).
This patch reverts this behavioral change, because it will likely break
applications that rely on the previous behavior, even though it is
undefined by ISO C. As noted by Szabolcs Nagy, this is used in SPEC2017
507.cactuBSSN_r/src/PUGH/PughUtils.c:
sprintf(mess," Size:");
for (i=0;i<dim+1;i++)
{
sprintf(mess,"%s %d",mess,pughGH->GFExtras[dim]->nsize[i]);
}
More important to notice is the fact that the overwriting of the
destination buffer is not the only behavior affected by the refactoring.
Before the refactoring, sprintf and vsprintf would use _IO_str_jumps,
whereas __sprintf_chk and __vsprintf_chk would use _IO_str_chk_jumps.
After the refactoring, all use _IO_str_chk_jumps, which would make
sprintf and vsprintf report buffer overflows and terminate the program.
This patch also reverts this behavior, by installing the appropriate
jump table for each *sprintf functions.
Apart from reverting the changes, this patch adds a test case that has
the old behavior hardcoded, so that regressions are noticed if something
else unintentionally changes the behavior.
Tested for powerpc64le.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2019. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.
Please remember to include 2019 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
|
|
|
|
|
|
|
| |
* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 7ca890b88e6ab7624afb1742a9fffb37ad5b3fc3
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a lot more printf variants than there are scanf variants,
and the code for setting up and tearing down their custom FILE
variants around the call to __vf(w)printf is more complicated and
variable. Therefore, I have added _internal versions of all the
v*printf variants, rather than introducing helper routines so that
they can all directly call __vf(w)printf_internal, as was done with
scanf.
As with the scanf changes, in this patch the _internal functions still
look at the environmental mode bits and all callers pass 0 for the
flags parameter.
Several of the affected public functions had _IO_ name aliases that
were not exported (but, in one case, appeared in libio.h anyway);
I was originally planning to leave them as aliases to avoid having
to touch internal callers, but it turns out ldbl_*_alias only work
for exported symbols, so they've all been removed instead. It also
turns out there were hardly any internal callers. _IO_vsprintf and
_IO_vfprintf *are* exported, so those two stick around.
Summary for the changes to each of the affected symbols:
_IO_vfprintf, _IO_vsprintf:
All internal calls removed, thus the internal declarations, as well
as uses of libc_hidden_proto and libc_hidden_def, were also removed.
The external symbol is now exposed via uses of ldbl_strong_alias
to __vfprintf_internal and __vsprintf_internal, respectively.
_IO_vasprintf, _IO_vdprintf, _IO_vsnprintf,
_IO_vfwprintf, _IO_vswprintf,
_IO_obstack_vprintf, _IO_obstack_printf:
All internal calls removed, thus declaration in internal headers
were also removed. They were never exported, so there are no
aliases tying them to the internal functions. I.e.: entirely gone.
__vsnprintf:
Internal calls were always preceded by macros such as
#define __vsnprintf _IO_vsnprintf, and
#define __vsnprintf vsnprintf
The macros were removed and their uses replaced with calls to the
new internal function __vsnprintf_internal. Since there were no
internal calls, the internal declaration was also removed. The
external symbol is preserved with ldbl_weak_alias to ___vsnprintf.
__vfwprintf:
All internal calls converted into calls to __vfwprintf_internal,
thus the internal declaration was removed. The function is now a
wrapper that calls __vfwprintf_internal. The external symbol is
preserved.
__vswprintf:
Similarly, but no external symbol.
__vasprintf, __vdprintf, __vfprintf, __vsprintf:
New internal wrappers. Not exported.
vasprintf, vdprintf, vfprintf, vsprintf, vsnprintf,
vfwprintf, vswprintf,
obstack_vprintf, obstack_printf:
These functions used to be aliases to the respective _IO_* function,
they are now aliases to their respective __* functions.
Tested for powerpc and powerpc64le.
|
| |
|
|
|
|
|
| |
The resulting object file is statically linked into applications, so
it is desirable to have (formal) stack protector coverage there.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These unmangled function pointers reside on the heap and could
be targeted by exploit writers, effectively bypassing libio vtable
validation. Instead, we ignore these pointers and always call
malloc or free.
In theory, this is a backwards-incompatible change, but using the
global heap instead of the user-supplied callback functions should
have little application impact. (The old libstdc++ implementation
exposed this functionality via a public, undocumented constructor
in its strstreambuf class.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No glibc configuration uses the present debug/backtrace.c, whereas
several #include the x86_64 version. The x86_64 version is
effectively a generic one (using _Unwind_Backtrace from libgcc, which
works much more reliably than the built-in functions used by
debug/backtrace.c). This patch moves it to debug/backtrace.c and
removes all the #includes of the x86_64 version from other
architectures which are no longer required.
I do not know whether all the other architecture-specific backtrace
implementations that are based on _Unwind_Backtrace are required, or
whether, where their differences from the generic version do something
useful, suitable hooks could be added to the generic version to reduce
the duplication involved.
Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.
* sysdeps/x86_64/backtrace.c: Move to ....
* debug/backtrace.c: ... here.
* sysdeps/aarch64/backtrace.c: Remove file.
* sysdeps/alpha/backtrace.c: Likewise.
* sysdeps/hppa/backtrace.c: Likewise.
* sysdeps/ia64/backtrace.c: Likewise.
* sysdeps/mips/backtrace.c: Likewise.
* sysdeps/nios2/backtrace.c: Likewise.
* sysdeps/riscv/backtrace.c: Likewise.
* sysdeps/sh/backtrace.c: Likewise.
* sysdeps/tile/backtrace.c: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
This entirely mechanical (except for some indentation fixups) patch
replaces all uses of _IO_file_flags with _flags and removes the #define.
Installed stripped libraries and executables are unchanged by this patch.
* libio/libio.h (_IO_file_flags): Remove macro.
All uses changed to _flags.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch eliminates the "compatibility defines"
_IO_UNIFIED_JUMPTABLES (always defined to 1, used in a number of #ifs
which are therefore always false), _STDIO_USES_IOSTREAM (unused),
__HAVE_COLUMN (unused), _IO_BE (replaced with __glibc_unlikely), and
yet another redundant definition of EOF.
Installed stripped libraries are unchanged by this patch.
* libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM)
(__HAVE_COLUMN, _IO_BE): Don't define.
(_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked)
(_IO_fwide_maybe_incompatible): Use __glibc_unlikely.
* libio/libioP.h (EOF): Don't define.
* libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c
* libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c
* libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block
testing _IO_UNIFIED_JUMPTABLES.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch mechanically removes all remaining uses, and the
definitions, of the following libio name aliases:
name replaced with
---- -------------
_IO_FILE FILE
_IO_fpos_t __fpos_t
_IO_fpos64_t __fpos64_t
_IO_size_t size_t
_IO_ssize_t ssize_t or __ssize_t
_IO_off_t off_t
_IO_off64_t off64_t
_IO_pid_t pid_t
_IO_uid_t uid_t
_IO_wint_t wint_t
_IO_va_list va_list or __gnuc_va_list
_IO_BUFSIZ BUFSIZ
_IO_cookie_io_functions_t cookie_io_functions_t
__io_read_fn cookie_read_function_t
__io_write_fn cookie_write_function_t
__io_seek_fn cookie_seek_function_t
__io_close_fn cookie_close_function_t
I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because
the definitions of fpos_t and fpos64_t depend on the largefile mode.
I used __ssize_t and __gnuc_va_list in a handful of headers where
namespace cleanliness might be relevant even though they're
internal-use-only. In all other cases, I used the public-namespace
name.
There are a tiny handful of places where I left a use of 'struct _IO_FILE'
alone, because it was being used together with 'struct _IO_FILE_plus'
or 'struct _IO_FILE_complete' in the same arithmetic expression.
Because this patch was almost entirely done with search and replace, I
may have introduced indentation botches. I did proofread the diff,
but I may have missed something.
The ChangeLog below calls out all of the places where this was not a
pure search-and-replace change.
Installed stripped libraries and executables are unchanged by this patch,
except that some assertions in vfscanf.c change line numbers.
* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
(_IO_fpos_t): Delete; all uses changed to __fpos_t.
(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
(_IO_size_t): Delete; all uses changed to size_t.
(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
(_IO_off_t): Delete; all uses changed to off_t.
(_IO_off64_t): Delete; all uses changed to off64_t.
(_IO_pid_t): Delete; all uses changed to pid_t.
(_IO_uid_t): Delete; all uses changed to uid_t.
(_IO_wint_t): Delete; all uses changed to wint_t.
(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
(_IO_cookie_io_functions_t): Delete; all uses changed to
cookie_io_functions_t.
(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
(__io_close_fn): Delete: all uses changed to cookie_close_function_t.
* libio/iofopncook.c: Remove unnecessary forward declarations.
* libio/iolibio.h: Correct outdated commentary.
* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
* stdio-common/fxprintf.c (__fxprintf_nocancel):
Remove unnecessary casts.
* stdio-common/getline.c: Use _IO_getdelim directly.
Don't redefine ssize_t.
* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
* stdio-common/printf_size.c: Don't redefine size_t or FILE.
Remove outdated comments.
* stdio-common/vfscanf.c: Don't redefine va_list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2018. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.
Please remember to include 2018 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
|
|
|
|
|
|
|
| |
* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace = with += in CFLAGS-xxx.c and CPPFLAGS-xxx.c to allow Makefile
under sysdeps to define CFLAGS-xx.c and CPPFLAGS-xxx.c.
* argp/Makefile (CFLAGS-argp-help.c): Replace = with +=.
(CFLAGS-argp-parse.c): Likewise.
(CFLAGS-argp-fmtstream.c): Likewise.
* crypt/Makefile (CPPFLAGS-sha256-crypt.c): Likewise.
(CPPFLAGS-sha512-crypt.c): Likewise.
(CPPFLAGS-md5-crypt.c): Likewise.
* debug/Makefile (CFLAGS-stack_chk_fail.c): Likewise.
(CFLAGS-stack_chk_fail_local.c): Likewise.
(CFLAGS-backtrace.c): Likewise.
(CFLAGS-sprintf_chk.c): Likewise.
(CFLAGS-snprintf_chk.c): Likewise.
(CFLAGS-vsprintf_chk.c): Likewise.
(CFLAGS-vsnprintf_chk.c): Likewise.
(CFLAGS-asprintf_chk.c): Likewise.
(CFLAGS-vasprintf_chk.c): Likewise.
(CFLAGS-obprintf_chk.c): Likewise.
(CFLAGS-dprintf_chk.c): Likewise.
(CFLAGS-vdprintf_chk.c): Likewise.
(CFLAGS-printf_chk.c): Likewise.
(CFLAGS-fprintf_chk.c): Likewise.
(CFLAGS-vprintf_chk.c): Likewise.
(CFLAGS-vfprintf_chk.c): Likewise.
(CFLAGS-gets_chk.c): Likewise.
(CFLAGS-fgets_chk.c): Likewise.
(CFLAGS-fgets_u_chk.c): Likewise.
(CFLAGS-fread_chk.c): Likewise.
(CFLAGS-fread_u_chk.c): Likewise.
(CFLAGS-swprintf_chk.c): Likewise.
(CFLAGS-vswprintf_chk.c): Likewise.
(CFLAGS-wprintf_chk.c): Likewise.
(CFLAGS-fwprintf_chk.c): Likewise.
(CFLAGS-vwprintf_chk.c): Likewise.
(CFLAGS-vfwprintf_chk.c): Likewise.
(CFLAGS-fgetws_chk.c): Likewise.
(CFLAGS-fgetws_u_chk.c): Likewise.
(CFLAGS-read_chk.c): Likewise.
(CFLAGS-pread_chk.c): Likewise.
(CFLAGS-pread64_chk.c): Likewise.
(CFLAGS-recv_chk.c): Likewise.
(CFLAGS-recvfrom_chk.c): Likewise.
(CFLAGS-tst-longjmp_chk.c): Likewise.
(CPPFLAGS-tst-longjmp_chk.c): Likewise.
(CFLAGS-tst-longjmp_chk2.c): Likewise.
(CPPFLAGS-tst-longjmp_chk2.c): Likewise.
(CFLAGS-tst-longjmp_chk3.c): Likewise.
(CPPFLAGS-tst-longjmp_chk3.c): Likewise.
(CFLAGS-tst-chk1.c): Likewise.
(CFLAGS-tst-chk2.c): Likewise.
(CFLAGS-tst-chk3.c): Likewise.
(CFLAGS-tst-chk4.cc): Likewise.
(CFLAGS-tst-chk5.cc): Likewise.
(CFLAGS-tst-chk6.cc): Likewise.
(CFLAGS-tst-lfschk1.c): Likewise.
(CFLAGS-tst-lfschk2.c): Likewise.
(CFLAGS-tst-lfschk3.c): Likewise.
(CFLAGS-tst-lfschk4.cc): Likewise.
(CFLAGS-tst-lfschk5.cc): Likewise.
(CFLAGS-tst-lfschk6.cc): Likewise.
(CFLAGS-tst-ssp-1.c): Likewise.
* dirent/Makefile (CFLAGS-scandir.c): Likewise.
(CFLAGS-scandir64.c): Likewise.
(CFLAGS-scandir-tail.c): Likewise.
(CFLAGS-scandir64-tail.c): Likewise.
* elf/Makefile (CPPFLAGS-dl-tunables.c): Likewise.
(CFLAGS-dl-tunables.c): Likewise.
(CFLAGS-dl-runtime.c): Likewise.
(CFLAGS-dl-lookup.c): Likewise.
(CFLAGS-dl-iterate-phdr.c): Likewise.
(CFLAGS-vismain.c): Likewise.
(CFLAGS-tst-linkall-static.c): Likewise.
(CFLAGS-tst-linkall-static.c): Likewise.
(CPPFLAGS-dl-load.c): Likewise.
(CFLAGS-ldconfig.c): Likewise.
(CFLAGS-dl-cache.c): Likewise.
(CFLAGS-cache.c): Likewise.
(CFLAGS-rtld.c): Likewise.
(CFLAGS-multiload.c): Likewise.
(CFLAGS-filtmod1.c): Likewise.
(CFLAGS-tst-align.c): Likewise.
(CFLAGS-tst-align2.c): Likewise.
(CFLAGS-tst-alignmod.c): Likewise.
(CFLAGS-tst-alignmod2.c): Likewise.
(CPPFLAGS-tst-execstack.c): Likewise.
(CFLAGS-tst-ptrguard1-static.c): Likewise.
(CFLAGS-tst-latepthreadmod.c): Likewise.
* grp/Makefile (CFLAGS-getgrgid_r.c): Likewise.
(CFLAGS-getgrnam_r.c): Likewise.
(CFLAGS-getgrent_r.c): Likewise.
(CFLAGS-getgrent.c): Likewise.
(CFLAGS-fgetgrent.c): Likewise.
(CFLAGS-fgetgrent_r.c): Likewise.
(CFLAGS-putgrent.c): Likewise.
(CFLAGS-initgroups.c): Likewise.
(CFLAGS-getgrgid.c): Likewise.
* gshadow/Makefile (CFLAGS-getsgent_r.c): Likewise.
(CFLAGS-getsgent.c): Likewise.
(CFLAGS-fgetsgent.c): Likewise.
(CFLAGS-fgetsgent_r.c): Likewise.
(CFLAGS-putsgent.c): Likewise.
(CFLAGS-getsgnam.c): Likewise.
(CFLAGS-getsgnam_r.c): Likewise.
* iconv/Makefile (CFLAGS-iconv_prog.c): Likewise.
(CFLAGS-iconv_charmap.c): Likewise.
(CFLAGS-dummy-repertoire.c): Likewise.
(CFLAGS-charmap.c): Likewise.
(CFLAGS-linereader.c): Likewise.
(CFLAGS-simple-hash.c): Likewise.
(CFLAGS-gconv_conf.c): Likewise.
(CFLAGS-iconvconfig.c): Likewise.
* inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise.
(CFLAGS-gethstbyad.c): Likewise.
(CFLAGS-gethstbynm_r.c): Likewise.
(CFLAGS-gethstbynm.c): Likewise.
(CFLAGS-gethstbynm2_r.c): Likewise.
(CFLAGS-gethstbynm2.c): Likewise.
(CFLAGS-gethstent_r.c): Likewise.
(CFLAGS-gethstent.c): Likewise.
(CFLAGS-rcmd.c): Likewise.
(CFLAGS-getnetbynm_r.c): Likewise.
(CFLAGS-getnetbynm.c): Likewise.
(CFLAGS-getnetbyad_r.c): Likewise.
(CFLAGS-getnetbyad.c): Likewise.
(CFLAGS-getnetent_r.c): Likewise.
(CFLAGS-getnetent.c): Likewise.
(CFLAGS-getaliasent_r.c): Likewise.
(CFLAGS-getaliasent.c): Likewise.
(CFLAGS-getrpcent_r.c): Likewise.
(CFLAGS-getrpcent.c): Likewise.
(CFLAGS-getservent_r.c): Likewise.
(CFLAGS-getservent.c): Likewise.
(CFLAGS-getprtent_r.c): Likewise.
(CFLAGS-getprtent.c): Likewise.
(CFLAGS-either_ntoh.c): Likewise.
(CFLAGS-either_hton.c): Likewise.
(CFLAGS-getnetgrent.c): Likewise.
(CFLAGS-getnetgrent_r.c): Likewise.
(CFLAGS-tst-checks-posix.c): Likewise.
(CFLAGS-tst-sockaddr.c): Likewise.
* intl/Makefile (CFLAGS-tst-gettext.c): Likewise.
(CFLAGS-tst-translit.c): Likewise.
(CFLAGS-tst-gettext2.c): Likewise.
(CFLAGS-tst-codeset.c): Likewise.
(CFLAGS-tst-gettext3.c): Likewise.
(CFLAGS-tst-gettext4.c): Likewise.
(CFLAGS-tst-gettext5.c): Likewise.
(CFLAGS-tst-gettext6.c): Likewise.
* io/Makefile (CFLAGS-open.c): Likewise.
(CFLAGS-open64.c): Likewise.
(CFLAGS-creat.c): Likewise.
(CFLAGS-creat64.c): Likewise.
(CFLAGS-fcntl.c): Likewise.
(CFLAGS-poll.c): Likewise.
(CFLAGS-ppoll.c): Likewise.
(CFLAGS-lockf.c): Likewise.
(CFLAGS-statfs.c): Likewise.
(CFLAGS-fstatfs.c): Likewise.
(CFLAGS-statvfs.c): Likewise.
(CFLAGS-fstatvfs.c): Likewise.
(CFLAGS-fts.c): Likewise.
(CFLAGS-fts64.c): Likewise.
(CFLAGS-ftw.c): Likewise.
(CFLAGS-ftw64.c): Likewise.
(CFLAGS-lockf.c): Likewise.
(CFLAGS-posix_fallocate.c): Likewise.
(CFLAGS-posix_fallocate64.c): Likewise.
(CFLAGS-fallocate.c): Likewise.
(CFLAGS-fallocate64.c): Likewise.
(CFLAGS-read.c): Likewise.
(CFLAGS-write.c): Likewise.
(CFLAGS-test-stat.c): Likewise.
(CFLAGS-test-lfs.c): Likewise.
* libio/Makefile (CFLAGS-fileops.c): Likewise.
(CFLAGS-fputc.c): Likewise.
(CFLAGS-fputwc.c): Likewise.
(CFLAGS-freopen64.c): Likewise.
(CFLAGS-freopen.c): Likewise.
(CFLAGS-fseek.c): Likewise.
(CFLAGS-fseeko64.c): Likewise.
(CFLAGS-fseeko.c): Likewise.
(CFLAGS-ftello64.c): Likewise.
(CFLAGS-ftello.c): Likewise.
(CFLAGS-fwide.c): Likewise.
(CFLAGS-genops.c): Likewise.
(CFLAGS-getc.c): Likewise.
(CFLAGS-getchar.c): Likewise.
(CFLAGS-getwc.c): Likewise.
(CFLAGS-getwchar.c): Likewise.
(CFLAGS-iofclose.c): Likewise.
(CFLAGS-iofflush.c): Likewise.
(CFLAGS-iofgetpos64.c): Likewise.
(CFLAGS-iofgetpos.c): Likewise.
(CFLAGS-iofgets.c): Likewise.
(CFLAGS-iofgetws.c): Likewise.
(CFLAGS-iofputs.c): Likewise.
(CFLAGS-iofputws.c): Likewise.
(CFLAGS-iofread.c): Likewise.
(CFLAGS-iofsetpos64.c): Likewise.
(CFLAGS-iofsetpos.c): Likewise.
(CFLAGS-ioftell.c): Likewise.
(CFLAGS-iofwrite.c): Likewise.
(CFLAGS-iogetdelim.c): Likewise.
(CFLAGS-iogetline.c): Likewise.
(CFLAGS-iogets.c): Likewise.
(CFLAGS-iogetwline.c): Likewise.
(CFLAGS-ioputs.c): Likewise.
(CFLAGS-ioseekoff.c): Likewise.
(CFLAGS-ioseekpos.c): Likewise.
(CFLAGS-iosetbuffer.c): Likewise.
(CFLAGS-iosetvbuf.c): Likewise.
(CFLAGS-ioungetc.c): Likewise.
(CFLAGS-ioungetwc.c): Likewise.
(CFLAGS-oldfileops.c): Likewise.
(CFLAGS-oldiofclose.c): Likewise.
(CFLAGS-oldiofgetpos64.c): Likewise.
(CFLAGS-oldiofgetpos.c): Likewise.
(CFLAGS-oldiofsetpos64.c): Likewise.
(CFLAGS-oldiofsetpos.c): Likewise.
(CFLAGS-peekc.c): Likewise.
(CFLAGS-putc.c): Likewise.
(CFLAGS-putchar.c): Likewise.
(CFLAGS-putwc.c): Likewise.
(CFLAGS-putwchar.c): Likewise.
(CFLAGS-rewind.c): Likewise.
(CFLAGS-wfileops.c): Likewise.
(CFLAGS-wgenops.c): Likewise.
(CFLAGS-oldiofopen.c): Likewise.
(CFLAGS-iofopen.c): Likewise.
(CFLAGS-iofopen64.c): Likewise.
(CFLAGS-oldtmpfile.c): Likewise.
(CFLAGS-tst_putwc.c): Likewise.
* locale/Makefile (CFLAGS-md5.c): Likewise.
(CFLAGS-charmap.c): Likewise.
(CFLAGS-locfile.c): Likewise.
(CFLAGS-charmap-dir.c): Likewise.
* login/Makefile (CFLAGS-grantpt.c): Likewise.
(CFLAGS-getpt.c): Likewise.
(CFLAGS-pt_chown.c): Likewise.
* malloc/Makefile (CFLAGS-mcheck-init.c): Likewise.
(CFLAGS-obstack.c): Likewise.
* math/Makefile (CFLAGS-test-tgmath3.c): Likewise.
(CFLAGS-test-double-vlen4-wrappers.c): Likewise.
(CFLAGS-test-double-vlen8-wrappers.c): Likewise.
(CFLAGS-test-float-vlen8-wrappers.c): Likewise.
(CFLAGS-test-float-vlen16-wrappers.c): Likewise.
(CFLAGS-test-tgmath.c): Likewise.
(CFLAGS-test-tgmath2.c): Likewise.
(CFLAGS-test-tgmath-ret.c): Likewise.
(CFLAGS-test-powl.c): Likewise.
(CFLAGS-test-snan.c): Likewise.
(CFLAGS-test-signgam-finite.c): Likewise.
(CFLAGS-test-signgam-finite-c99.c): Likewise.
(CFLAGS-test-signgam-finite-c11.c): Likewise.
(CFLAGS-test-signgam-uchar.c): Likewise.
(CFLAGS-test-signgam-uchar-init.c): Likewise.
(CFLAGS-test-signgam-uchar-static.c): Likewise.
(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
(CFLAGS-test-signgam-uint.c): Likewise.
(CFLAGS-test-signgam-uint-init.c): Likewise.
(CFLAGS-test-signgam-uint-static.c): Likewise.
(CFLAGS-test-signgam-uint-init-static.c): Likewise.
(CFLAGS-test-signgam-ullong.c): Likewise.
(CFLAGS-test-signgam-ullong-init.c): Likewise.
(CFLAGS-test-signgam-ullong-static.c): Likewise.
(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
(CFLAGS-test-math-cxx11.cc): Likewise.
(CFLAGS-test-math-isinff.cc): Likewise.
(CFLAGS-test-math-iszero.cc): Likewise.
(CFLAGS-test-math-issignaling.cc): Likewise.
(CFLAGS-test-math-iscanonical.cc): Likewise.
(CFLAGS-test-iszero-excess-precision.c): Likewise.
(CFLAGS-test-iseqsig-excess-precision.c): Likewise.
(CFLAGS-test-flt-eval-method.c): Likewise.
(CFLAGS-test-fe-snans-always-signal.c): Likewise.
(CFLAGS-test-finite-macros.c): Likewise.
* misc/Makefile (CFLAGS-select.c): Likewise.
(CFLAGS-tsearch.c): Likewise.
(CFLAGS-lsearch.c): Likewise.
(CFLAGS-pselect.c): Likewise.
(CFLAGS-readv.c): Likewise.
(CFLAGS-writev.c): Likewise.
(CFLAGS-preadv.c): Likewise.
(CFLAGS-preadv64.c): Likewise.
(CFLAGS-pwritev.c): Likewise.
(CFLAGS-pwritev64.c): Likewise.
(CFLAGS-preadv2.c): Likewise.
(CFLAGS-preadv64v2.c): Likewise.
(CFLAGS-pwritev2.c): Likewise.
(CFLAGS-pwritev64v2.c): Likewise.
(CFLAGS-usleep.c): Likewise.
(CFLAGS-syslog.c): Likewise.
(CFLAGS-error.c): Likewise.
(CFLAGS-getpass.c): Likewise.
(CFLAGS-mkstemp.c): Likewise.
(CFLAGS-mkstemp64.c): Likewise.
(CFLAGS-getsysstats.c): Likewise.
(CFLAGS-getusershell.c): Likewise.
(CFLAGS-err.c): Likewise.
(CFLAGS-tst-tsearch.c): Likewise.
(CFLAGS-msync.c): Likewise.
(CFLAGS-fdatasync.c): Likewise.
(CFLAGS-fsync.c): Likewise.
* nptl/Makefile (CFLAGS-nptl-init.c): Likewise.
(CFLAGS-unwind.c): Likewise.
(CFLAGS-unwind-forcedunwind.c): Likewise.
(CFLAGS-pthread_cancel.c): Likewise.
(CFLAGS-pthread_setcancelstate.c): Likewise.
(CFLAGS-pthread_setcanceltype.c): Likewise.
(CFLAGS-cancellation.c): Likewise.
(CFLAGS-libc-cancellation.c): Likewise.
(CFLAGS-pthread_exit.c): Likewise.
(CFLAGS-forward.c): Likewise.
(CFLAGS-pthread_testcancel.c): Likewise.
(CFLAGS-pthread_join.c): Likewise.
(CFLAGS-pthread_timedjoin.c): Likewise.
(CFLAGS-pthread_once.c): Likewise.
(CFLAGS-pthread_cond_wait.c): Likewise.
(CFLAGS-sem_wait.c): Likewise.
(CFLAGS-sem_timedwait.c): Likewise.
(CFLAGS-fcntl.c): Likewise.
(CFLAGS-lockf.c): Likewise.
(CFLAGS-pread.c): Likewise.
(CFLAGS-pread64.c): Likewise.
(CFLAGS-pwrite.c): Likewise.
(CFLAGS-pwrite64.c): Likewise.
(CFLAGS-wait.c): Likewise.
(CFLAGS-waitpid.c): Likewise.
(CFLAGS-sigwait.c): Likewise.
(CFLAGS-msgrcv.c): Likewise.
(CFLAGS-msgsnd.c): Likewise.
(CFLAGS-tcdrain.c): Likewise.
(CFLAGS-open.c): Likewise.
(CFLAGS-open64.c): Likewise.
(CFLAGS-pause.c): Likewise.
(CFLAGS-recv.c): Likewise.
(CFLAGS-send.c): Likewise.
(CFLAGS-accept.c): Likewise.
(CFLAGS-sendto.c): Likewise.
(CFLAGS-connect.c): Likewise.
(CFLAGS-recvfrom.c): Likewise.
(CFLAGS-recvmsg.c): Likewise.
(CFLAGS-sendmsg.c): Likewise.
(CFLAGS-close.c): Likewise.
(CFLAGS-read.c): Likewise.
(CFLAGS-write.c): Likewise.
(CFLAGS-nanosleep.c): Likewise.
(CFLAGS-sigsuspend.c): Likewise.
(CFLAGS-msync.c): Likewise.
(CFLAGS-fdatasync.c): Likewise.
(CFLAGS-fsync.c): Likewise.
(CFLAGS-pt-system.c): Likewise.
(CFLAGS-tst-cleanup2.c): Likewise.
(CFLAGS-tst-cleanupx2.c): Likewise.
(CFLAGS-flockfile.c): Likewise.
(CFLAGS-ftrylockfile.c): Likewise.
(CFLAGS-funlockfile.c): Likewise.
(CFLAGS-tst-initializers1.c): Likewise.
(CFLAGS-tst-initializers1-c89.c): Likewise.
(CFLAGS-tst-initializers1-c99.c): Likewise.
(CFLAGS-tst-initializers1-c11.c): Likewise.
(CFLAGS-tst-initializers1-gnu89.c): Likewise.
(CFLAGS-tst-initializers1-gnu99.c): Likewise.
(CFLAGS-tst-initializers1-gnu11.c): Likewise.
* nscd/Makefile (CFLAGS-nscd_getpw_r.c): Likewise.
(CFLAGS-nscd_getgr_r.c): Likewise.
(CFLAGS-nscd_gethst_r.c): Likewise.
(CFLAGS-nscd_getai.c): Likewise.
(CFLAGS-nscd_initgroups.c): Likewise.
* posix/Makefile (CFLAGS-getaddrinfo.c): Likewise.
(CFLAGS-pause.c): Likewise.
(CFLAGS-pread.c): Likewise.
(CFLAGS-pread64.c): Likewise.
(CFLAGS-pwrite.c): Likewise.
(CFLAGS-pwrite64.c): Likewise.
(CFLAGS-sleep.c): Likewise.
(CFLAGS-wait.c): Likewise.
(CFLAGS-waitid.c): Likewise.
(CFLAGS-waitpid.c): Likewise.
(CFLAGS-getopt.c): Likewise.
(CFLAGS-wordexp.c): Likewise.
(CFLAGS-sysconf.c): Likewise.
(CFLAGS-pathconf.c): Likewise.
(CFLAGS-fpathconf.c): Likewise.
(CFLAGS-spawn.c): Likewise.
(CFLAGS-spawnp.c): Likewise.
(CFLAGS-spawni.c): Likewise.
(CFLAGS-glob.c): Likewise.
(CFLAGS-glob64.c): Likewise.
(CFLAGS-getconf.c): Likewise.
(CFLAGS-nanosleep.c): Likewise.
* pwd/Makefile (CFLAGS-getpwent_r.c): Likewise.
(CFLAGS-getpwent.c): Likewise.
(CFLAGS-getpw.c): Likewise.
(CFLAGS-fgetpwent_r.c): Likewise.
* resolv/Makefile (CFLAGS-res_hconf.c): Likewise.
* rt/Makefile (CFLAGS-aio_suspend.c): Likewise.
(CFLAGS-mq_timedreceive.c): Likewise.
(CFLAGS-mq_timedsend.c): Likewise.
(CFLAGS-clock_nanosleep.c): Likewise.
(CFLAGS-librt-cancellation.c): Likewise.
* shadow/Makefile (CFLAGS-getspent_r.c): Likewise.
(CFLAGS-getspent.c): Likewise.
(CFLAGS-fgetspent.c): Likewise.
(CFLAGS-fgetspent_r.c): Likewise.
(CFLAGS-putspent.c): Likewise.
(CFLAGS-getspnam.c): Likewise.
(CFLAGS-getspnam_r.c): Likewise.
* signal/Makefile (CFLAGS-sigpause.c): Likewise.
(CFLAGS-sigsuspend.c): Likewise.
(CFLAGS-sigtimedwait.c): Likewise.
(CFLAGS-sigwait.c): Likewise.
(CFLAGS-sigwaitinfo.c): Likewise.
(CFLAGS-sigreturn.c): Likewise.
* stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise.
(CFLAGS-vfwprintf.c): Likewise.
(CFLAGS-tmpfile.c): Likewise.
(CFLAGS-tmpfile64.c): Likewise.
(CFLAGS-tempname.c): Likewise.
(CFLAGS-psignal.c): Likewise.
(CFLAGS-vprintf.c): Likewise.
(CFLAGS-cuserid.c): Likewise.
(CFLAGS-errlist.c): Likewise.
(CFLAGS-siglist.c): Likewise.
(CFLAGS-scanf15.c): Likewise.
(CFLAGS-scanf17.c): Likewise.
* stdlib/Makefile (CFLAGS-bsearch.c): Likewise.
(CFLAGS-msort.c): Likewise.
(CFLAGS-qsort.c): Likewise.
(CFLAGS-system.c): Likewise.
(CFLAGS-fmtmsg.c): Likewise.
(CFLAGS-strfmon.c): Likewise.
(CFLAGS-strfmon_l.c): Likewise.
(CFLAGS-strfromd.c): Likewise.
(CFLAGS-strfromf.c): Likewise.
(CFLAGS-strfroml.c): Likewise.
(CFLAGS-tst-bsearch.c): Likewise.
(CFLAGS-tst-qsort.c): Likewise.
(CFLAGS-tst-makecontext2.c): Likewise.
* sunrpc/Makefile (CFLAGS-xbootparam_prot.c): Likewise.
(CFLAGS-xnlm_prot.c): Likewise.
(CFLAGS-xrstat.c): Likewise.
(CFLAGS-xyppasswd.c): Likewise.
(CFLAGS-xklm_prot.c): Likewise.
(CFLAGS-xrex.c): Likewise.
(CFLAGS-xsm_inter.c): Likewise.
(CFLAGS-xmount.c): Likewise.
(CFLAGS-xrusers.c): Likewise.
(CFLAGS-xspray.c): Likewise.
(CFLAGS-xnfs_prot.c): Likewise.
(CFLAGS-xrquota.c): Likewise.
(CFLAGS-xkey_prot.c): Likewise.
(CFLAGS-auth_unix.c): Likewise.
(CFLAGS-key_call.c): Likewise.
(CFLAGS-pmap_rmt.c): Likewise.
(CFLAGS-clnt_perr.c): Likewise.
(CFLAGS-openchild.c): Likewise.
* sysvipc/Makefile (CFLAGS-msgrcv.c): Likewise.
(CFLAGS-msgsnd.c): Likewise.
* termios/Makefile (CFLAGS-tcdrain.c): Likewise.
* time/Makefile (CFLAGS-tzfile.c): Likewise.
(CFLAGS-tzset.c): Likewise.
(CFLAGS-getdate.c): Likewise.
(CFLAGS-test_time.c): Likewise.
(CPPFLAGS-tst-tzname.c): Likewise.
* timezone/Makefile (CFLAGS-zdump.c): Likewise.
(CFLAGS-zic.c): Likewise.
* wcsmbs/Makefile (CFLAGS-wcwidth.c): Likewise.
(CFLAGS-wcswidth.c): Likewise.
(CFLAGS-wcstol.c): Likewise.
(CFLAGS-wcstoul.c): Likewise.
(CFLAGS-wcstoll.c): Likewise.
(CFLAGS-wcstoull.c): Likewise.
(CFLAGS-wcstod.c): Likewise.
(CFLAGS-wcstold.c): Likewise.
(CFLAGS-wcstof128.c): Likewise.
(CFLAGS-wcstof.c): Likewise.
(CFLAGS-wcstol_l.c): Likewise.
(CFLAGS-wcstoul_l.c): Likewise.
(CFLAGS-wcstoll_l.c): Likewise.
(CFLAGS-wcstoull_l.c): Likewise.
(CFLAGS-wcstod_l.c): Likewise.
(CFLAGS-wcstold_l.c): Likewise.
(CFLAGS-wcstof128_l.c): Likewise.
(CFLAGS-wcstof_l.c): Likewise.
(CPPFLAGS-tst-wchar-h.c): Likewise.
(CPPFLAGS-wcstold_l.c): Likewise.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To support Shadow Stack (SHSTK) in Intel Control-flow Enforcement
Technology (CET) in setjmp/longjmp, we need to save shadow stack
pointer in jmp_buf. The __saved_mask field in jmp_buf has type
of __sigset_t. On Linux, __sigset_t is defined as
#define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
{
unsigned long int __val[_SIGSET_NWORDS];
} __sigset_t;
which is much bigger than expected by the __sigprocmask system call,
which has
typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
For Linux/x86, we can shrink __sigset_t used by __saved_mask in jmp_buf
to add paddings for shadow stack pointer. As long as the new __sigset_t
is not smaller than sigset_t expected by the __sigprocmask system call,
it should work correctly.
This patch adds an internal header file, <setjmpP.h>, to define
__jmp_buf_sigset_t for __saved_mask in jmp_buf for Linux/x86 with a
space to store shadow stack pointer. It verifies __jmp_buf_sigset_t has
the suitable size for the __sigprocmask system call. A run-time test,
tst-saved_mask-1.c, is added to verify that size of __jmp_buf_sigset_t
is sufficient. If its size is too small, the test fails with
rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, NULL, 0x7fa8aa28effc, 8) = -1 EFAULT (Bad address)
exit_group(1) = ?
Tested with build-many-glibcs.py.
* debug/longjmp_chk.c: Include <setjmpP.h> instead of
<setjmp.h>.
* setjmp/longjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
(__libc_siglongjmp): Cast &env[0].__saved_mask to "sigset_t *".
* setjmp/sigjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
(__sigjmp_save): Cast &env[0].__saved_mask to "sigset_t *".
* sysdeps/generic/setjmpP.h: New file.
* sysdeps/unix/sysv/linux/x86/jmp_buf-ssp.sym: Likewise.
* sysdeps/unix/sysv/linux/x86/setjmpP.h: Likewise.
* sysdeps/unix/sysv/linux/x86/tst-saved_mask-1.c: Likewise.
* sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers):
Add jmp_buf-ssp.sym.
(tests): Add tst-saved_mask-1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add unwind info to __libc_start_main so that unwinding continues one
extra level to _start. Similarly add unwind info to backtrace.
Given many targets require this, do this in a general way.
* csu/Makefile: Add -funwind-tables to libc-start.c.
* debug/Makefile: Add -funwind-tables to backtrace.c.
* sysdeps/aarch64/Makefile: Remove CFLAGS-backtrace.c.
* sysdeps/arm/Makefile: Likewise.
* sysdeps/i386/Makefile: Likewise.
* sysdeps/m68k/Makefile: Likewise.
* sysdeps/mips/Makefile: Likewise.
* sysdeps/nios2/Makefile: Likewise.
* sysdeps/sh/Makefile: Likewise.
* sysdeps/sparc/Makefile: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
debug/pcprofiledump.c contains code that tries to handle other-endian
data. This uses a condition "(word & 0xfffffff0) == bswap_32
(0xdeb00000)". This condition is always false (the LHS always has the
low four bits zero, the RHS doesn't); a correct comparison would use
0x0fffffff. This results in -Werror=tautological-compare build
failures with the tile version of bits/byteswap.h and mainline GCC.
https://sourceware.org/ml/libc-testresults/2017-q3/msg00400.html
pcprofiledump.c: In function 'main':
pcprofiledump.c:118:39: error: bitwise comparison always evaluates to false
[-Werror=tautological-compare]
int must_swap = (word & 0xfffffff0) == bswap_32 (0xdeb00000);
^~
This patch fixes the condition. Tested for x86_64, and with
build-many-glibcs.py that it fixes the build for tilegx-linux-gnu.
(Note that I have not tested the actual pcprofiledump functionality,
native or cross endian, which lacks any testsuite coverage.)
[BZ #22086]
* debug/pcprofiledump.c (main): Use byte-swapped mask when
comparing word with byte-swapped constant.
|
|
|
|
|
|
|
|
|
| |
Move ____longjmp_chk prototype to include/setjmp.h and add
attribute_hidden.
* debug/longjmp_chk.c (____longjmp_chk): Moved to ...
* include/setjmp.h (____longjmp_chk): Here. Add
attribute_hidden.
|
|
|
|
|
| |
__fortify_fail is called across DSO boundaries, so it should not
use a non-standard calling convention.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__libc_argv[0] points to address on stack and __libc_secure_getenv
accesses environment variables which are on stack. We should avoid
accessing stack when stack is corrupted.
This patch also renames function argument in __fortify_fail_abort
from do_backtrace to need_backtrace to avoid confusion with do_backtrace
from enum __libc_message_action.
[BZ #21752]
* debug/fortify_fail.c (__fortify_fail_abort): Don't pass down
__libc_argv[0] if we aren't doing backtrace. Rename do_backtrace
to need_backtrace.
* sysdeps/posix/libc_fatal.c (__libc_message): Don't call
__libc_secure_getenv if we aren't doing backtrace.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit 524a8ef2ad76af8ac049293d993a1856b0d888fb
Author: Nick Alcock <nick.alcock@oracle.com>
Date: Mon Dec 26 10:08:57 2016 +0100
PLT avoidance for __stack_chk_fail [BZ #7065]
Add a hidden __stack_chk_fail_local alias to libc.so,
and make sure that on targets which use __stack_chk_fail,
this does not introduce a local PLT reference into libc.so.
which unconditionally added
strong_alias (__stack_chk_fail, __stack_chk_fail_local)
defines __stack_chk_fail_local as an alias of __stack_chk_fail in libc.a.
There is no need to add stack_chk_fail_local.o to libc.a. We only need
to add stack_chk_fail_local.oS to libc_nonshared.a.
Tested on x86-64:
[hjl@gnu-skl-1 build-x86_64-linux]$ nm libc.a | grep __stack_chk_fail
0000000000000000 T __stack_chk_fail
0000000000000000 T __stack_chk_fail_local
[hjl@gnu-skl-1 build-x86_64-linux]$ nm libc_nonshared.a | grep __stack_chk_fail_local
0000000000000000 T __stack_chk_fail_local
[hjl@gnu-skl-1 build-x86_64-linux]$
[BZ #21740]
* debug/Makefile (elide-routines.o): New.
|
|
|
|
|
|
|
|
| |
Compile tst-ssp-1.c with -fstack-protector-all in case the the stack
protector heuristics do not instrument a thirty-byte array.
* debug/Makefile (CFLAGS-tst-ssp-1.c): Set to
-fstack-protector-all.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__stack_chk_fail is called on corrupted stack. Stack backtrace is very
unreliable against corrupted stack. __libc_message is changed to accept
enum __libc_message_action and call BEFORE_ABORT only if action includes
do_backtrace. __fortify_fail_abort is added to avoid backtrace from
__stack_chk_fail.
[BZ #12189]
* debug/Makefile (CFLAGS-tst-ssp-1.c): New.
(tests): Add tst-ssp-1 if -fstack-protector works.
* debug/fortify_fail.c: Include <stdbool.h>.
(_fortify_fail_abort): New function.
(__fortify_fail): Call _fortify_fail_abort.
(__fortify_fail_abort): Add a hidden definition.
* debug/stack_chk_fail.c: Include <stdbool.h>.
(__stack_chk_fail): Call __fortify_fail_abort, instead of
__fortify_fail.
* debug/tst-ssp-1.c: New file.
* include/stdio.h (__libc_message_action): New enum.
(__libc_message): Replace int with enum __libc_message_action.
(__fortify_fail_abort): New hidden prototype.
* malloc/malloc.c (malloc_printerr): Update __libc_message calls.
* sysdeps/posix/libc_fatal.c (__libc_message): Replace int
with enum __libc_message_action. Call BEFORE_ABORT only if
action includes do_backtrace.
(__libc_fatal): Update __libc_message call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc defines the stack_t type with the tag struct sigaltstack. This
is not permitted by POSIX; sigaltstack is only reserved with file
scope in the namespace of ordinary identifiers, not the tag namespace,
and in the case where stack_t is obtained from ucontext.h rather than
signal.h, it's not reserved with file scope at all.
This patch removes the tag accordingly and updates uses in glibc of
struct sigaltstack. This is similar to the removal of the "struct
siginfo" tag a few years ago: C++ name mangling changes are an
unavoidable consequence. A NEWS item is added to note the changed
mangling. There is inevitably some risk of breaking builds of
anything that relies on the struct sigaltstack name (though the first
few hits I looked at from codesearch.debian.net generally seemed to
involve code that could use the stack_t name conditionally, so
depending on how they determine the conditionals they may work with
glibc not defining the struct tag anyway).
Tested for x86_64 and x86, and with build-many-glibcs.py.
[BZ #21517]
* bits/types/stack_t.h (stack_t): Remove struct tag.
* sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t):
Likewise.
* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t):
Likewise.
* debug/segfault.c (install_handler): Use stack_t instead of
struct sigaltstack.
* hurd/hurd/signal.h (struct hurd_sigstate): Likewise.
* hurd/trampoline.c (_hurd_setup_sighandler): Likewise.
* include/signal.h (__sigaltstack): Likwise.
* signal/sigaltstack.c (__sigaltstack): Likewise.
* signal/signal.h (sigaltstack): Likewise.
* sysdeps/mach/hurd/i386/signal-defines.sym
(SIGALTSTACK__SS_SP__OFFSET): Likewise.
(SIGALTSTACK__SS_SIZE__OFFSET): Likewise.
(SIGALTSTACK__SS_FLAGS__OFFSET): Likewise.
* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
* sysdeps/mach/hurd/sigstack.c (sigstack): Likewise.
* sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct
elf_prstatus): Likewise.
* sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus):
Likewise.
* sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct
elf_prstatus): Likewise.
* sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus):
Likewise.
* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus):
Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replaced all imports of test-skeleton.c with support/test-driver.c.
In some cases it was needed to adjust do_test to return int
instead of static int since that is the method's signature expected by
test-driver.c.
Checked on x86_64.
* string/test-string.h (TEST_FUNCTION): Use test_main instead of
test_main ().
(CMDLINE_PROCESS): Use function instead of defined macro.
* debug/test-strcpy_chk.c: Import support/test-driver.c and also
<suppport/support.h> to use set_fortify_handler().
* string/bug-envz1.c: Import support/test-driver.c instead of
test-skeleton.c.
* string/bug-strcoll2.c: Likewise.
* string/bug-strtok1.c: Likewise.
* string/stratcliff.c: Likewise.
* string/test-ffs.c: Likewise.
* string/test-memccpy.c: Likewise.
* string/test-memchr.c: Likewise.
* string/test-memcmp.c: Likewise.
* string/test-memcpy.c: Likewise.
* string/test-memmem.c: Likewise.
* string/test-memmove.c: Likewise.
* string/test-memrchr.c: Likewise.
* string/test-memset.c: Likewise.
* string/test-rawmemchr.c: Likewise.
* string/test-strcasecmp.c: Likewise.
* string/test-strcasestr.c: Likewise.
* string/test-strcat.c: Likewise.
* string/test-strchr.c: Likewise.
* string/test-strcmp.c: Likewise.
* string/test-strcpy.c: Likewise.
* string/test-string.h: Likewise.
* string/test-strlen.c: Likewise.
* string/test-strncasecmp.c: Likewise.
* string/test-strncat.c: Likewise.
* string/test-strncmp.c: Likewise.
* string/test-strncpy.c: Likewise.
* string/test-strnlen.c: Likewise.
* string/test-strpbrk.c: Likewise.
* string/test-strrchr.c: Likewise.
* string/test-strspn.c: Likewise.
* string/test-strstr.c: Likewise.
* string/tst-bswap.c: Likewise.
* string/tst-cmp.c: Likewise.
* string/tst-endian.c: Likewise.
* string/tst-inlcall.c: Likewise.
* string/tst-strcoll-overflow.c: Likewise.
* string/tst-strfry.c: Likewise.
* string/tst-strlen.c: Likewise.
* string/tst-strtok.c: Likewise.
* string/tst-strtok_r.c: Likewise.
* string/tst-strxfrm.c: Likewise.
* string/tst-strxfrm2.c: Likewise.
* string/tst-svc.c: Likewise.
* string/tst-svc2.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
posix/wordexp-test.c used libc-internal.h for PTR_ALIGN_DOWN; similar
to what was done with libc-diag.h, I have split the definitions of
cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN
to a new header, libc-pointer-arith.h.
It then occurred to me that the remaining declarations in libc-internal.h
are mostly to do with early initialization, and probably most of the
files including it, even in the core code, don't need it anymore. Indeed,
only 19 files actually need what remains of libc-internal.h. 23 others
need libc-diag.h instead, and 12 need libc-pointer-arith.h instead.
No file needs more than one of them, and 16 don't need any of them!
So, with this patch, libc-internal.h stops including libc-diag.h as
well as losing the pointer arithmetic macros, and all including files
are adjusted.
* include/libc-pointer-arith.h: New file. Define
cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and
PTR_ALIGN_DOWN here.
* include/libc-internal.h: Definitions of above macros
moved from here. Don't include libc-diag.h anymore either.
* posix/wordexp-test.c: Include stdint.h and libc-pointer-arith.h.
Don't include libc-internal.h.
* debug/pcprofile.c, elf/dl-tunables.c, elf/soinit.c, io/openat.c
* io/openat64.c, misc/ptrace.c, nptl/pthread_clock_gettime.c
* nptl/pthread_clock_settime.c, nptl/pthread_cond_common.c
* string/strcoll_l.c, sysdeps/nacl/brk.c
* sysdeps/unix/clock_settime.c
* sysdeps/unix/sysv/linux/i386/get_clockfreq.c
* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c:
Don't include libc-internal.h.
* elf/get-dynamic-info.h, iconv/loop.c
* iconvdata/iso-2022-cn-ext.c, locale/weight.h, locale/weightwc.h
* misc/reboot.c, nis/nis_table.c, nptl_db/thread_dbP.h
* nscd/connections.c, resolv/res_send.c, soft-fp/fmadf4.c
* soft-fp/fmasf4.c, soft-fp/fmatf4.c, stdio-common/vfscanf.c
* sysdeps/ieee754/dbl-64/e_lgamma_r.c
* sysdeps/ieee754/dbl-64/k_rem_pio2.c
* sysdeps/ieee754/flt-32/e_lgammaf_r.c
* sysdeps/ieee754/flt-32/k_rem_pio2f.c
* sysdeps/ieee754/ldbl-128/k_tanl.c
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c
* sysdeps/ieee754/ldbl-96/k_tanl.c, sysdeps/nptl/futex-internal.h:
Include libc-diag.h instead of libc-internal.h.
* elf/dl-load.c, elf/dl-reloc.c, locale/programs/locarchive.c
* nptl/nptl-init.c, string/strcspn.c, string/strspn.c
* malloc/malloc.c, sysdeps/i386/nptl/tls.h
* sysdeps/nacl/dl-map-segments.h, sysdeps/x86_64/atomic-machine.h
* sysdeps/unix/sysv/linux/spawni.c
* sysdeps/x86_64/nptl/tls.h:
Include libc-pointer-arith.h instead of libc-internal.h.
* elf/get-dynamic-info.h, sysdeps/nacl/dl-map-segments.h
* sysdeps/x86_64/atomic-machine.h:
Add multiple include guard.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gets has the dubious honor of being the only C89 library feature that
has been completely removed from the current C and C++ standards.
glibc follows suit by not declaring it in _GNU_SOURCE mode either,
but it remains present in older compatibility modes. Internally,
two test cases need to see stdio.h make the declaration, but all our
internal code is of course compiled under _GNU_SOURCE. This is currently
kludged by duplicating the gets declaration, fortify wrapper and all,
in include/stdio.h. Also, the conditional in the public headers for
deciding when to declare gets is complicated and repeated in two places.
This patch adds a new macro to features.h that encapsulates the
complicated rule for when to declare gets. stdio.h and bits/stdio2.h
then simply test __GLIBC_USE (DEPRECATED_GETS), and instead of having
a duplicate gets declaration in include/stdio.h, debug/tst-chk1.c and
stdio-common/tst-gets.c can force gets to be declared.
* include/features.h (__GLIBC_USE_DEPRECATED_GETS): New macro.
* libio/stdio.h, libio/bits/stdio2.h: Condition gets on
__GLIBC_USE (DEPRECATED_GETS). Update comments to indicate
gets was removed from C++ in C++14.
* include/stdio.h: Remove redundant declaration of gets.
* debug/tst-chk1.c, stdio-common/tst-gets.c: Force gets to
be declared, since we are testing it.
* stdio-common/Makefile (tst-gets.c): Compile with
-Wno-deprecated-declarations.
* debug/Makefile (tst-chk1.c, 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):
Compile with -Wno-deprecated-declarations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2017. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.
Please remember to include 2017 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
|
| |
|
|
|
|
|
|
| |
Add a hidden __stack_chk_fail_local alias to libc.so,
and make sure that on targets which use __stack_chk_fail,
this does not introduce a local PLT reference into libc.so.
|