2022-01-01 18:54:23 +00:00
|
|
|
# Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
2022-01-12 18:04:23 +00:00
|
|
|
# Copyright The GNU Toolchain Authors.
|
1998-06-08 19:06:31 +00:00
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
1998-06-08 19:06:31 +00:00
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
# Lesser General Public License for more details.
|
1998-06-08 19:06:31 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
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
2019-09-07 05:40:42 +00:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1998-06-08 19:06:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Sub-makefile for debug portion of the library.
|
|
|
|
#
|
|
|
|
subdir := debug
|
|
|
|
|
2014-02-26 23:12:03 +00:00
|
|
|
include ../Makeconfig
|
|
|
|
|
1998-06-08 19:06:31 +00:00
|
|
|
headers := execinfo.h
|
|
|
|
|
2013-05-06 22:58:44 +00:00
|
|
|
# Note that ptsname_r_chk and getlogin_r are not here, but in
|
|
|
|
# login/Makefile instead. If that subdir is omitted from the
|
|
|
|
# build, its _FORTIFY_SOURCE support will be too.
|
2005-03-01 00:35:23 +00:00
|
|
|
routines = backtrace backtracesyms backtracesymsfd noophooks \
|
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-18 04:17:19 +00:00
|
|
|
memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
|
2005-07-15 10:32:45 +00:00
|
|
|
strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
|
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-15 Jakub Jelinek <jakub@redhat.com>
* elf/dl-minimal.c (__chk_fail): New. Add rtld_hidden_def.
* sysdeps/unix/sysv/linux/readonly-area.c: New file.
* sysdeps/i386/i686/memmove.S (__memmove_chk): Add checking
routine.
* sysdeps/i386/i686/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/i386/i686/mempcpy.S (__mempcpy_chk): Likewise.
* sysdeps/i386/i686/memset.S (__memset_chk): Likewise.
* sysdeps/i386/i686/memmove-chk.S: New file.
* sysdeps/i386/i686/memcpy-chk.S: Likewise.
* sysdeps/i386/i686/mempcpy-chk.S: Likewise.
* sysdeps/i386/i686/memset-chk.S: Likewise.
* sysdeps/generic/strcat-chk.c (__strcat_chk): Don't __chk_fail
if exactly fitting into buffer.
* sysdeps/generic/strncat-chk.c (__strncat_chk): Likewise.
* sysdeps/generic/readonly-area.c: New file.
* sysdeps/generic/strncpy-chk.c (__strncpy_chk): Only test
destlen once.
* sysdeps/x86_64/memset.S (__memset_chk): Add checking routine.
* sysdeps/x86_64/memcpy.S (__memcpy_chk): Likewise.
* sysdeps/x86_64/mempcpy.S (__memcpy_chk): Define to __mempcpy_chk.
* sysdeps/x86_64/memcpy-chk.S: New file.
* sysdeps/x86_64/mempcpy-chk.S: Likewise.
* sysdeps/x86_64/memset-chk.S: Likewise.
* sysdeps/x86_64/strcpy-chk.S: Likewise.
* sysdeps/x86_64/stpcpy-chk.S: Likewise.
* argp/argp-xinl.c (__OPTIMIZE__): Define to 1 instead of nothing.
* argp/argp-fs-xinl.c (__OPTIMIZE__): Likewise.
* debug/tst-chk1.c: New test.
* debug/tst-chk2.c: Likewise.
* debug/tst-chk3.c: Likewise.
* debug/test-strcpy_chk.c: Likewise.
* debug/test-stpcpy_chk.c: Likewise.
* debug/vsprintf_chk.c (__vsprintf_chk): If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* debug/Makefile (routines): Add printf_chk, fprintf_chk, vprintf_chk,
vfprintf_chk, gets_chk and readonly-area.
(CFLAGS-*_chk.c): Set.
(tests): Add tst-chk1, tst-chk2, tst-chk3, test-strcpy_chk and
test-stpcpy_chk.
* debug/vprintf_chk.c: New file.
* debug/printf_chk.c: Likewise.
* debug/vfprintf_chk.c: Likewise.
* debug/fprintf_chk.c: Likewise.
* debug/gets_chk.c: Likewise.
* debug/chk_fail.c (__chk_fail): Add libc_hidden_def.
* debug/snprintf_chk.c (__snprintf_chk): Fix order of arguments
passed to __vsnprintf_chk.
* debug/Versions (libc): Export __printf_chk, __fprintf_chk,
__vprintf_chk, __vfprintf_chk and __gets_chk @GLIBC_2.3.4.
* debug/vsnprintf_chk.c (__vsnprintf_chk): Don't call
__vsnprintf, instead create a temporary file with
_IO_strn_jumps jumptable. If flags > 0, request
_IO_FLAGS2_CHECK_PERCENT_N. Add libc_hidden_def.
* libio/Makefile (headers): Add bits/stdio2.h.
* libio/stdio.h: Include <bits/stdio2.h> if __USE_FORTIFY_LEVEL.
(sprintf, snprintf, vsprintf, vsnprintf): Remove defines.
* libio/strfile.h (_IO_strnfile): New type.
(_IO_strn_jumps): New extern.
* libio/vsnprintf.c (_IO_strnfile): Remove.
(_IO_strn_jumps): Remove static.
* libio/bits/stdio2.h: New file.
* libio/vswprintf.c (_IO_strnfile): Rename type to...
(_IO_wstrnfile): ...this. Adjust all uses.
* libio/libio.h (_IO_FLAGS2_CHECK_PERCENT_N): Define.
* stdio-common/vfprintf.c (STR_LEN): Define.
(vfprintf): Add readonly_format variable.
Handle _IO_FLAGS2_CHECK_PERCENT_N.
(buffered_vfprintf): Copy _flags2.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk): New prototypes.
(__vsprintf_chk, __vsnprintf_chk): Add libc_hidden_proto.
* include/string.h (__memcpy_chk, __memmove_chk, __mempcpy_chk,
__memset_chk, __strcpy_chk, __stpcpy_chk, __strncpy_chk, __strcat_chk,
__strncat_chk): New prototypes.
* include/bits/string3.h: New file.
* include/sys/cdefs.h (__chk_fail): Add libc_hidden_proto
and rtld_hidden_proto.
* string/Makefile (headers): Add bits/string3.h.
* string/bits/string3.h (bcopy, bzero): New defines.
(memset, memcpy, memmove, strcpy, strncpy, strcat, strncat): Change
macros so that inlines are used only if unknown destination size
or side-effects in destination argument.
(mempcpy, stpcpy): Likewise. Protect with #ifdef __USE_GNU.
2004-09-16 Ulrich Drepper <drepper@redhat.com>
* debug/Makefile (routines): Add *_chk.
* debug/Versions (libc): Export __chk_fail, __memcpy_chk,
__memmove_chk, __mempcpy_chk, __memset_chk, __stpcpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__sprintf_chk, __vsprintf_chk, __snprintf_chk, __vsnprintf_chk
@GLIBC_2.3.4.
* debug/chk_fail.c: New file.
* debug/snprintf_chk.c: Likewise.
* debug/sprintf_chk.c: Likewise.
* debug/vsnprintf_chk.c: Likewise.
* debug/vsprintf_chk.c: Likewise.
* include/features.h (_FORTIFY_SOURCE): Document, handle.
(__USE_FORTIFY_LEVEL): Define.
(__GNUC_PREREQ): Move to earlier location.
* include/sys/cdefs.h (__chk_fail): New prototype.
* libio/bits/stdio.h (sprintf, vsprintf, snprintf, vsnprintf):
Define if __USE_FORTIFY_LEVEL.
* misc/sys/cdefs.h (__bos, __bos0): Define.
* string/string.h: Include <bits/string3.h> if __USE_FORTIFY_LEVEL.
* bits/string/string3.h: New header.
* sysdeps/generic/memcpy_chk.c: New file.
* sysdeps/generic/memmove_chk.c: Likewise.
* sysdeps/generic/mempcpy_chk.c: Likewise.
* sysdeps/generic/memset_chk.c: Likewise.
* sysdeps/generic/stpcpy_chk.c: Likewise.
* sysdeps/generic/strcat_chk.c: Likewise.
* sysdeps/generic/strcpy_chk.c: Likewise.
* sysdeps/generic/strncat_chk.c: Likewise.
* sysdeps/generic/strncpy_chk.c: Likewise.
2004-10-18 04:17:19 +00:00
|
|
|
sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
|
|
|
|
printf_chk fprintf_chk vprintf_chk vfprintf_chk \
|
* sysdeps/unix/sysv/linux/libc_fatal.c: Print backtrace and memory
map if requested.
* debug/chk_fail.c: Request backtrace and memory map dump.
* Versions.def: Add GLIBC_2.4 for libc.
* debug/fgets_chk.c: New file.
* debug/fgets_u_chk.c: New file.
* debug/getcwd_chk.c: New file.
* debug/getwd_chk.c: New file.
* debug/readlink_chk.c: New file.
* debug/read_chk.c: New file.
* debug/pread_chk.c: New file.
* debug/pread64_chk.c: New file.
* debug/recv_chk.c: New file.
* debug/recvfrom_chk.c: New file.
* debug/Versions: Add all new functions with version GLIBC_2.4.
* debug/Makefile (routines): Add fgets_chk, fgets_u_chk, read_chk,
pread_chk, pread64_chk, recv_chk, recvfrom_chk, readlink_chk,
getwd_chk, and getcwd_chk. Plus appropriate CFLAGS definitions.
* debug/tst-chk1.c: Add more tests.
* libio/bits/stdio2.h: Add macros for fgets and fgets_unlocked.
* include/stdio.h: Declare __fgets_chk and __fgets_unlocked_chk.
* posix/unistd.h: Include <bits/unistd.h> for fortification.
* posix/bits/unistd.h: New file.
* posix/Makefile (headers): Add bits/unistd.h.
* socket/sys/socket.h: Include <bits/socket2.h> for fortification.
* socket/bits/socket2.h: New file.
* socket/Makefile (headers): Add bits/socket2.h.
* string/bits/string3.h: Extend memset macro to check for zero 3rd
parameter and use __memset_zero_constant_len_parameter in that case.
* sysdeps/generic/memset_chk.c: Add
__memset_zero_constant_len_parameter alias and linker warning.
* debug/Versions: Add __memset_zero_constant_len_parameter to libc
with version GLIBC_2.4.
* sysdeps/generic/bits/types.h: Don't unnecessarily use __extension__
in __STD_TYPE definition.
2005-02-21 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (malloc_printerr): If MALLOC_CHECK_={5,7}, print
the error message rather than program name.
2005-02-21 Ulrich Drepper <drepper@redhat.com>
2005-02-21 23:14:10 +00:00
|
|
|
gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
|
|
|
|
read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
|
2006-04-24 17:01:40 +00:00
|
|
|
readlink_chk readlinkat_chk getwd_chk getcwd_chk \
|
2013-05-06 22:19:14 +00:00
|
|
|
realpath_chk fread_chk fread_u_chk \
|
2005-07-15 10:32:45 +00:00
|
|
|
wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
|
|
|
|
wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
|
|
|
|
wcpncpy_chk \
|
|
|
|
swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
|
|
|
|
vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
|
2013-05-06 22:58:44 +00:00
|
|
|
confstr_chk getgroups_chk ttyname_r_chk \
|
* wcsmbs/bits/wchar2.h: Add definitions for wcrtomb, mbsrtowcs,
wcsrtombs, mbsnrtowcs, and wcsnrtombs.
* debug/Makefile (routines): Add wcrtomb_chk, mbsrtowcs_chk,
wcsrtombs_chk, mbsnrtowcs_chk, and wcsnrtombs_chk.
* debug/Versions: Add __wcrtomb_chk, __mbsrtowcs_chk,
__wcsrtombs_chk, __mbsnrtowcs_chk, and __wcsnrtombs_chk.
* debug/tst-chk1.c: Add tests for new functions.
* debug/mbsnrtowcs_chk.c: New file.
* debug/mbsrtowcs_chk.c: New file.
* debug/wcrtomb_chk.c: New file.
* debug/wcsnrtombs_chk.c: New file.
* debug/wcsrtombs_chk.c: New file.
* include/stdio.h: Add declaration for __fxprintf.
2005-07-20 07:43:27 +00:00
|
|
|
gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
|
2005-07-25 21:41:45 +00:00
|
|
|
wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
|
* include/stdio.h (__asprintf_chk, __dprintf_chk,
__obstack_printf_chk): New prototypes.
(__vasprintf_chk, __vdprintf_chk,
__obstack_vprintf_chk): Likewise.
Add libc_hidden_proto.
* libio/obprintf.c
(_IO_obstack_jumps): No longer static, add attribute_hidden.
* libio/bits/stdio-ldbl.h (__asprintf_chk, __dprintf_chk,
__obstack_printf_chk, __vasprintf_chk, __vdprintf_chk,
__obstack_vprintf_chk): Add __LDBL_REDIR_DECL.
* libio/bits/stdio2.h (__asprintf_chk, __dprintf_chk,
__obstack_printf_chk, __vasprintf_chk, __vdprintf_chk,
__obstack_vprintf_chk): New prototypes.
(asprintf, __asprintf, dprintf, obstack_printf, vasprintf, vdprintf,
obstack_vprintf): New inlines.
* debug/dprintf_chk.c: New file.
* debug/vdprintf_chk.c: New file.
* debug/asprintf_chk.c: New file.
* debug/vasprintf_chk.c: New file.
* debug/obprintf_chk.c: New file.
* debug/tst-chk1.c (do_test): Add asprintf and obstack_printf tests.
* debug/Versions (__asprintf_chk, __dprintf_chk, __obstack_printf_chk,
__vasprintf_chk, __vdprintf_chk, __obstack_vprintf_chk): Export
@@GLIBC_2.8.
* debug/Makefile: Build asprintf_chk, vasprintf_chk, dprintf_chk,
vdprintf_chk and obprintf_chk, set CFLAGS for them.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c (__nldbl___vasprintf_chk,
__nldbl___vdprintf_chk, __nldbl___obstack_vprintf_chk): Add
libc_hidden_proto.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl___vasprintf_chk,
__nldbl___vdprintf_chk, __nldbl___obstack_vprintf_chk): New prototypes.
* sysdeps/ieee754/ldbl-opt/Versions (__nldbl___asprintf_chk,
__nldbl___vasprintf_chk, __nldbl___dprintf_chk, __nldbl___vdprintf_chk,
__nldbl___obstack_printf_chk, __nldbl___obstack_vprintf_chk): Export
@@GLIBC_2.8.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add asprintf_chk,
vasprintf_chk, dprintf_chk, vdprintf_chk, obstack_printf_chk and
obstack_vprintf_chk.
* sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf_chk.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-dprintf_chk.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf_chk.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-asprintf_chk.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-vdprintf_chk.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-vasprintf_chk.c: New file.
2008-03-05 07:05:13 +00:00
|
|
|
wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
|
2018-03-07 19:32:03 +00:00
|
|
|
vdprintf_chk obprintf_chk vobprintf_chk \
|
2009-05-16 02:28:04 +00:00
|
|
|
longjmp_chk ____longjmp_chk \
|
2012-01-08 16:55:32 +00:00
|
|
|
fdelt_chk poll_chk ppoll_chk \
|
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-09-15 11:29:44 +00:00
|
|
|
explicit_bzero_chk \
|
2007-05-24 23:55:28 +00:00
|
|
|
stack_chk_fail fortify_fail \
|
2005-03-01 00:35:23 +00:00
|
|
|
$(static-only-routines)
|
2020-11-05 04:50:32 +00:00
|
|
|
static-only-routines := stack_chk_fail_local
|
1998-06-08 19:06:31 +00:00
|
|
|
|
2017-07-19 15:21:27 +00:00
|
|
|
# Don't add stack_chk_fail_local.o to libc.a since __stack_chk_fail_local
|
|
|
|
# is an alias of __stack_chk_fail in stack_chk_fail.o.
|
|
|
|
elide-routines.o := stack_chk_fail_local
|
|
|
|
|
2016-12-26 09:08:57 +00:00
|
|
|
# Building the stack-protector failure routines with stack protection
|
2018-07-05 17:28:11 +00:00
|
|
|
# is not required since we have already failed a stack check and are
|
|
|
|
# exiting the process. However, the local aliases which jump to the
|
|
|
|
# real routines should still be compiled with stack protection
|
|
|
|
# (stack_chk_fail_local.c), so that the statically linked parts of the
|
|
|
|
# library have the expected flags.
|
2016-12-26 09:08:57 +00:00
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-stack_chk_fail.c += $(no-stack-protector)
|
|
|
|
|
|
|
|
CFLAGS-backtrace.c += -fno-omit-frame-pointer -funwind-tables
|
|
|
|
CFLAGS-sprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-snprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-vsprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-vsnprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-asprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-vasprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-obprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-dprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-vdprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-printf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-vprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-vfprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-gets_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fgets_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fgets_u_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fread_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fread_u_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-swprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-vswprintf_chk.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-wprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fwprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-vwprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-vfwprintf_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fgetws_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-fgetws_u_chk.c += $(libio-mtsafe) -fexceptions
|
|
|
|
CFLAGS-read_chk.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CFLAGS-pread_chk.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CFLAGS-pread64_chk.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CFLAGS-recv_chk.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CFLAGS-recvfrom_chk.c += -fexceptions -fasynchronous-unwind-tables
|
2012-05-06 22:37:57 +00:00
|
|
|
|
|
|
|
# Need to make sure the settings here override what configure might have
|
|
|
|
# set up for us, so keep the CFLAGS/CPPFLAGS split logical as the order is:
|
|
|
|
# <user CFLAGS> <test CFLAGS> <user CPPFLAGS> <test CPPFLAGS>
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-tst-longjmp_chk.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CPPFLAGS-tst-longjmp_chk.c += -D_FORTIFY_SOURCE=1
|
|
|
|
CFLAGS-tst-longjmp_chk2.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CPPFLAGS-tst-longjmp_chk2.c += -D_FORTIFY_SOURCE=1
|
|
|
|
CFLAGS-tst-longjmp_chk3.c += -fexceptions -fasynchronous-unwind-tables
|
|
|
|
CPPFLAGS-tst-longjmp_chk3.c += -D_FORTIFY_SOURCE=1
|
2021-12-17 13:05:44 +00:00
|
|
|
CPPFLAGS-tst-realpath-chk.c += -D_FORTIFY_SOURCE=2
|
2022-06-27 20:37:45 +00:00
|
|
|
CPPFLAGS-tst-chk-cancel.c += -D_FORTIFY_SOURCE=2
|
1998-06-08 19:06:31 +00:00
|
|
|
|
2022-01-12 18:04:23 +00:00
|
|
|
# _FORTIFY_SOURCE tests.
|
|
|
|
# Auto-generate tests for _FORTIFY_SOURCE for different levels, compilers and
|
|
|
|
# preprocessor conditions based on tst-fortify.c.
|
|
|
|
#
|
|
|
|
# To add a new test condition, define a cflags-$(cond) make variable to set
|
|
|
|
# CFLAGS for the file.
|
|
|
|
|
|
|
|
tests-all-chk = tst-fortify
|
2022-11-04 19:02:52 +00:00
|
|
|
tests-c-def-chk =
|
|
|
|
tests-cc-def-chk =
|
|
|
|
tests-c-time64-chk =
|
|
|
|
tests-cc-time64-chk =
|
2022-01-12 18:04:23 +00:00
|
|
|
|
|
|
|
CFLAGS-tst-fortify.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
|
|
|
|
# No additional flags for the default tests.
|
|
|
|
define cflags-default
|
|
|
|
endef
|
|
|
|
|
|
|
|
define cflags-lfs
|
2022-11-04 19:02:52 +00:00
|
|
|
CFLAGS-tst-fortify-$(1)-lfs-$(2)-$(3).$(1) += -D_FILE_OFFSET_BITS=64
|
2022-01-12 18:04:23 +00:00
|
|
|
endef
|
|
|
|
|
2022-01-12 18:04:48 +00:00
|
|
|
define cflags-nongnu
|
2022-11-04 19:02:52 +00:00
|
|
|
CFLAGS-tst-fortify-$(1)-nongnu-$(2)-$(3).$(1) += -D_LARGEFILE64_SOURCE=1
|
2022-01-12 18:04:48 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
src-chk-nongnu = \#undef _GNU_SOURCE
|
|
|
|
|
2007-08-26 01:19:56 +00:00
|
|
|
# We know these tests have problems with format strings, this is what
|
Clean up conditionals for declaration of gets.
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.
2016-11-21 13:16:27 +00:00
|
|
|
# we are testing. Disable that warning. They are also testing
|
|
|
|
# deprecated functions (notably gets) so disable that warning as well.
|
|
|
|
# And they also generate warnings from warning attributes, which
|
|
|
|
# cannot be disabled via pragmas, so require -Wno-error to be used.
|
2022-01-12 18:04:23 +00:00
|
|
|
define gen-chk-test
|
2022-11-04 19:02:52 +00:00
|
|
|
tests-$(1)-$(4)-chk += tst-fortify-$(1)-$(2)-$(3)-$(4)
|
|
|
|
CFLAGS-tst-fortify-$(1)-$(2)-$(3)-$(4).$(1) += -D_FORTIFY_SOURCE=$(3) -Wno-format \
|
2022-01-12 18:04:23 +00:00
|
|
|
-Wno-deprecated-declarations \
|
|
|
|
-Wno-error
|
2022-11-04 19:02:52 +00:00
|
|
|
$(eval $(call cflags-$(2),$(1),$(3),$(4)))
|
|
|
|
$(objpfx)tst-fortify-$(1)-$(2)-$(3)-$(4).$(1): tst-fortify.c Makefile
|
2022-01-12 18:04:23 +00:00
|
|
|
( echo "/* Autogenerated from Makefile. */"; \
|
2022-01-12 18:04:48 +00:00
|
|
|
echo "$(src-chk-$(2))"; \
|
2022-01-12 18:04:23 +00:00
|
|
|
echo "#include \"tst-fortify.c\"" ) > $$@.tmp
|
|
|
|
mv $$@.tmp $$@
|
|
|
|
endef
|
|
|
|
|
|
|
|
chk-extensions = c cc
|
2022-01-12 18:04:48 +00:00
|
|
|
chk-types = default lfs nongnu
|
2022-11-04 19:02:52 +00:00
|
|
|
# 64 bit time_t implies LFS.
|
|
|
|
chk-types-time64 = default nongnu
|
2022-01-12 18:04:23 +00:00
|
|
|
chk-levels = 1 2 3
|
|
|
|
|
|
|
|
$(foreach e,$(chk-extensions), \
|
|
|
|
$(foreach t,$(chk-types), \
|
|
|
|
$(foreach l,$(chk-levels), \
|
2022-11-04 19:02:52 +00:00
|
|
|
$(eval $(call gen-chk-test,$(e),$(t),$(l),def)))))
|
2022-01-12 18:04:23 +00:00
|
|
|
|
2022-11-04 19:02:52 +00:00
|
|
|
tests-all-chk += $(tests-c-def-chk) $(tests-cc-def-chk)
|
|
|
|
|
|
|
|
$(foreach e,$(chk-extensions), \
|
|
|
|
$(foreach t,$(chk-types-time64), \
|
|
|
|
$(foreach l,$(chk-levels), \
|
|
|
|
$(eval $(call gen-chk-test,$(e),$(t),$(l),time64)))))
|
|
|
|
|
|
|
|
tests-all-time64-chk += $(tests-c-time64-chk) $(tests-cc-time64-chk)
|
2022-01-12 18:04:23 +00:00
|
|
|
|
|
|
|
define link-cc
|
|
|
|
LDLIBS-$(1) = -lstdc++
|
|
|
|
endef
|
2022-11-04 19:02:52 +00:00
|
|
|
$(foreach t,$(tests-cc-def-chk), $(eval $(call link-cc,$(t))))
|
|
|
|
$(foreach t,$(tests-cc-time64-chk), $(eval $(call link-cc,$(t))))
|
2005-07-15 10:49:02 +00:00
|
|
|
|
2013-01-18 15:49:43 +00:00
|
|
|
# backtrace_symbols only works if we link with -rdynamic. backtrace
|
|
|
|
# requires unwind tables on most architectures.
|
|
|
|
CFLAGS-tst-backtrace2.c += -funwind-tables
|
|
|
|
CFLAGS-tst-backtrace3.c += -funwind-tables
|
|
|
|
CFLAGS-tst-backtrace4.c += -funwind-tables
|
|
|
|
CFLAGS-tst-backtrace5.c += -funwind-tables
|
2013-08-20 20:01:59 +00:00
|
|
|
CFLAGS-tst-backtrace6.c += -funwind-tables
|
2013-01-18 15:49:43 +00:00
|
|
|
LDFLAGS-tst-backtrace2 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace3 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace4 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace5 = -rdynamic
|
2013-08-20 20:01:59 +00:00
|
|
|
LDFLAGS-tst-backtrace6 = -rdynamic
|
2013-01-18 15:49:43 +00:00
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-tst-ssp-1.c += -fstack-protector-all
|
2017-07-11 14:44:01 +00:00
|
|
|
|
2022-01-12 18:04:23 +00:00
|
|
|
tests = backtrace-tst \
|
|
|
|
tst-longjmp_chk \
|
|
|
|
test-strcpy_chk \
|
|
|
|
test-stpcpy_chk \
|
|
|
|
tst-longjmp_chk2 \
|
|
|
|
tst-backtrace2 \
|
|
|
|
tst-backtrace3 \
|
|
|
|
tst-backtrace4 \
|
|
|
|
tst-backtrace5 \
|
|
|
|
tst-backtrace6 \
|
|
|
|
tst-realpath-chk \
|
|
|
|
$(tests-all-chk)
|
1998-06-08 19:06:31 +00:00
|
|
|
|
2022-11-04 19:02:52 +00:00
|
|
|
tests-time64 += \
|
|
|
|
$(tests-all-time64-chk) \
|
|
|
|
# tests-time64
|
|
|
|
|
2017-07-11 14:44:01 +00:00
|
|
|
ifeq ($(have-ssp),yes)
|
|
|
|
tests += tst-ssp-1
|
|
|
|
endif
|
|
|
|
|
2022-06-22 11:16:30 +00:00
|
|
|
ifeq ($(have-thread-library), yes)
|
2022-06-27 20:37:45 +00:00
|
|
|
tests += tst-chk-cancel
|
2022-06-22 11:16:30 +00:00
|
|
|
endif
|
|
|
|
|
2015-03-10 22:13:14 +00:00
|
|
|
ifeq (,$(CXX))
|
2022-11-04 19:02:52 +00:00
|
|
|
tests-unsupported = $(tests-cc-def-chk) $(test-cc-time64-chk)
|
2015-03-04 21:52:45 +00:00
|
|
|
endif
|
|
|
|
|
2021-12-20 11:41:55 +00:00
|
|
|
extra-libs = libpcprofile
|
1998-07-16 20:08:44 +00:00
|
|
|
extra-libs-others = $(extra-libs)
|
|
|
|
|
1999-08-08 22:20:38 +00:00
|
|
|
libpcprofile-routines = pcprofile
|
|
|
|
libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
|
|
|
|
|
1999-10-12 18:38:32 +00:00
|
|
|
others = pcprofiledump
|
2001-08-29 23:31:38 +00:00
|
|
|
install-bin = pcprofiledump
|
|
|
|
install-bin-script = xtrace
|
1999-10-07 07:25:16 +00:00
|
|
|
|
2021-12-20 11:41:55 +00:00
|
|
|
generated += xtrace
|
1998-07-16 23:08:48 +00:00
|
|
|
|
1998-06-08 19:06:31 +00:00
|
|
|
include ../Rules
|
1998-07-16 20:08:44 +00:00
|
|
|
|
2015-10-12 10:24:41 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
LOCALES := de_DE.UTF-8
|
|
|
|
include ../gen-locales.mk
|
|
|
|
|
2022-01-12 18:04:23 +00:00
|
|
|
define chk-gen-locales
|
|
|
|
$(objpfx)$(1).out: $(gen-locales)
|
|
|
|
endef
|
|
|
|
$(foreach t, $(tests-all-chk), $(eval $(call chk-gen-locales,$(t))))
|
2022-11-04 19:02:52 +00:00
|
|
|
$(foreach t, $(tests-all-time64-chk), $(eval $(call chk-gen-locales,$(t))))
|
2015-10-12 10:24:41 +00:00
|
|
|
endif
|
|
|
|
|
2006-05-19 16:48:27 +00:00
|
|
|
sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
|
|
|
|
|
1999-10-07 07:25:16 +00:00
|
|
|
$(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
|
|
|
|
|
|
|
|
$(objpfx)xtrace: xtrace.sh
|
|
|
|
rm -f $@.new
|
2021-05-12 02:15:33 +00:00
|
|
|
sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
|
|
|
|
-e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
|
2012-11-09 22:13:45 +00:00
|
|
|
-e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
|
1999-10-07 07:25:16 +00:00
|
|
|
&& rm -f $@ && mv $@.new $@ && chmod +x $@
|
2022-06-22 11:16:30 +00:00
|
|
|
|
2022-06-27 20:37:45 +00:00
|
|
|
$(objpfx)tst-chk-cancel: $(shared-thread-library)
|