2022-01-02 02:54:23 +08:00
|
|
|
# Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
1998-06-09 03:06:31 +08: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 12:58:11 +08: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-09 03:06:31 +08: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 12:58:11 +08:00
|
|
|
# Lesser General Public License for more details.
|
1998-06-09 03:06:31 +08:00
|
|
|
|
2001-07-06 12:58:11 +08:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-10 07:18:22 +08: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 13:40:42 +08:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1998-06-09 03:06:31 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Sub-makefile for debug portion of the library.
|
|
|
|
#
|
|
|
|
subdir := debug
|
|
|
|
|
2014-02-27 07:12:03 +08:00
|
|
|
include ../Makeconfig
|
|
|
|
|
1998-06-09 03:06:31 +08:00
|
|
|
headers := execinfo.h
|
|
|
|
|
2013-05-07 06:58:44 +08: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 08:35:23 +08: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 12:17:19 +08:00
|
|
|
memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
|
2005-07-15 18:32:45 +08: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 12:17:19 +08: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-22 07:14:10 +08:00
|
|
|
gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
|
|
|
|
read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
|
2006-04-25 01:01:40 +08:00
|
|
|
readlink_chk readlinkat_chk getwd_chk getcwd_chk \
|
2013-05-07 06:19:14 +08:00
|
|
|
realpath_chk fread_chk fread_u_chk \
|
2005-07-15 18:32:45 +08: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-07 06:58:44 +08: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 15:43:27 +08:00
|
|
|
gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
|
2005-07-26 05:41:45 +08: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 15:05:13 +08:00
|
|
|
wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
|
2018-03-08 03:32:03 +08:00
|
|
|
vdprintf_chk obprintf_chk vobprintf_chk \
|
2009-05-16 10:28:04 +08:00
|
|
|
longjmp_chk ____longjmp_chk \
|
2012-01-09 00:55:32 +08: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 19:29:44 +08:00
|
|
|
explicit_bzero_chk \
|
2007-05-25 07:55:28 +08:00
|
|
|
stack_chk_fail fortify_fail \
|
2005-03-01 08:35:23 +08:00
|
|
|
$(static-only-routines)
|
2020-11-05 12:50:32 +08:00
|
|
|
static-only-routines := stack_chk_fail_local
|
1998-06-09 03:06:31 +08:00
|
|
|
|
2017-07-19 23:21:27 +08: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 17:08:57 +08:00
|
|
|
# Building the stack-protector failure routines with stack protection
|
2018-07-06 01:28:11 +08: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 17:08:57 +08:00
|
|
|
|
2017-12-12 05:11:16 +08: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-07 06:37:57 +08: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-12 05:11:16 +08: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 21:05:44 +08:00
|
|
|
CPPFLAGS-tst-realpath-chk.c += -D_FORTIFY_SOURCE=2
|
1998-06-09 03:06:31 +08:00
|
|
|
|
2007-08-26 09:19:56 +08: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 21:16:27 +08: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.
|
2017-12-12 05:11:16 +08:00
|
|
|
CFLAGS-tst-chk1.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk2.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk3.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk4.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk5.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk6.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
2021-10-20 20:43:05 +08:00
|
|
|
CFLAGS-tst-chk7.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-chk8.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
2017-12-12 05:11:16 +08:00
|
|
|
CFLAGS-tst-lfschk1.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-lfschk2.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-lfschk3.c += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-lfschk4.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-lfschk5.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
|
|
|
CFLAGS-tst-lfschk6.cc += -Wno-format -Wno-deprecated-declarations -Wno-error
|
2012-09-08 05:12:12 +08:00
|
|
|
LDLIBS-tst-chk4 = -lstdc++
|
|
|
|
LDLIBS-tst-chk5 = -lstdc++
|
|
|
|
LDLIBS-tst-chk6 = -lstdc++
|
2021-10-20 20:43:05 +08:00
|
|
|
LDLIBS-tst-chk8 = -lstdc++
|
2012-09-08 05:12:12 +08:00
|
|
|
LDLIBS-tst-lfschk4 = -lstdc++
|
|
|
|
LDLIBS-tst-lfschk5 = -lstdc++
|
|
|
|
LDLIBS-tst-lfschk6 = -lstdc++
|
2005-07-15 18:49:02 +08:00
|
|
|
|
2013-01-18 23:49:43 +08: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-21 04:01:59 +08:00
|
|
|
CFLAGS-tst-backtrace6.c += -funwind-tables
|
2013-01-18 23:49:43 +08:00
|
|
|
LDFLAGS-tst-backtrace2 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace3 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace4 = -rdynamic
|
|
|
|
LDFLAGS-tst-backtrace5 = -rdynamic
|
2013-08-21 04:01:59 +08:00
|
|
|
LDFLAGS-tst-backtrace6 = -rdynamic
|
2013-01-18 23:49:43 +08:00
|
|
|
|
2017-12-12 05:11:16 +08:00
|
|
|
CFLAGS-tst-ssp-1.c += -fstack-protector-all
|
2017-07-11 22:44:01 +08:00
|
|
|
|
2009-05-16 10:28:04 +08:00
|
|
|
tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
|
* misc/sys/cdefs.h (__va_arg_pack): Define for GCC 4.3+.
* misc/bits/syslog.h (syslog): When __va_arg_pack is defined,
implement as __extern_always_inline function.
(vsyslog): Define as __extern_always_inline function unconditionally.
* libio/bits/stdio2.h (sprintf, snprintf, printf, fprintf):
When __va_arg_pack is defined, implement as __extern_always_inline
functions.
(vsprintf, vsnprintf, vprintf, vfprintf): Define as
__extern_always_inline functions unconditionally.
* libio/bits/stdio.h (vprintf): Ifdef out the inline when
bits/stdio2.h will be included.
* wcsmbs/bits/wchar2.h (__swprintf_alias): New redirect.
(swprintf, wprintf, fwprintf): When __va_arg_pack is defined,
implement as __extern_always_inline functions.
(vswprintf, vwprintf, vfwprintf): Define as
__extern_always_inline functions unconditionally.
* debug/tst-chk1.c (do_test): Enable remaining tests for C++.
2007-09-03 Jakub Jelinek <jakub@redhat.com>
* misc/sys/cdefs.h (__extern_inline, __extern_always_inline): Only
define in C++ for GCC 4.3+, in C++ always use __gnu_inline__
attribute.
* include/features.h (__USE_EXTERN_INLINES): Define only when
__extern_inline is defined.
* stdlib/stdlib.h: Include bits/stdlib.h when __extern_always_inline
is defined instead of when not __cplusplus.
* misc/sys/syslog.h: Include bits/syslog.h when __extern_always_inline
is defined instead of when not __cplusplus.
* socket/sys/socket.h: Include bits/socket2.h when
__extern_always_inline is defined instead of when not __cplusplus.
* libio/stdio.h: Include bits/stdio2.h when __extern_always_inline
is defined instead of when not __cplusplus.
* posix/unistd.h: Include bits/unistd.h when __extern_always_inline
is defined instead of when not __cplusplus.
* string/string.h: Include bits/string3.h when __extern_always_inline
is defined instead of when not __cplusplus.
* wcsmbs/wchar.h: Include bits/wchar2.h when __extern_always_inline
is defined instead of when not __cplusplus.
(btowc, wctob): Don't guard the inlines with ifndef __cplusplus.
* io/fcntl.h: Don't include bits/fcntl2.h if __extern_always_inline
is not defined.
* misc/bits/syslog-ldbl.h: Guard *_chk stuff with
defined __extern_always_inline instead of !defined __cplusplus.
* libio/bits/stdio-ldbl.h: Likewise.
* wcsmbs/bits/wchar-ldbl.h: Likewise.
* misc/bits/syslog.h (syslog): Don't define for C++.
(vsyslog): Use __extern_always_inline function for C++ instead of
a macro.
* libio/bits/stdio.h (__STDIO_INLINE): Define to __extern_inline
whenever that macro is defined.
(vprintf): Don't provide the inline for C++.
(fread_unlocked, fwrite_unlocked): Don't define the macros for C++.
* libio/bits/stdio2.h (sprintf, snprintf, printf, fprintf): Don't
define the macros for C++.
(vsprintf, vsnprintf, vprintf, vfprintf): Define as
__extern_always_inline functions for C++.
* io/sys/stat.h (stat, lstat, fstat, fstatat, mknod, mknodat,
stat64, lstat64, fstat64, fstatat64): Don't define if not
__USE_EXTERN_INLINES.
* wcsmbs/bits/wchar2.h: Fix #error message.
(swprintf, wprintf, fwprintf): Don't define the macros for C++.
(vswprintf, vwprintf, vfwprintf): Define using
__extern_always_inline functions for C++.
* string/bits/string3.h: Don't #undef macros if __cplusplus.
(memcpy, memmove, mempcpy, memset, bcopy, bzero, strcpy, stpcpy,
strncpy, strcat, strncat): Define as __extern_always_inline
functions instead of macros for C++.
* math/bits/cmathcalls.h: Guard __extern_inline routines with
defined __extern_inline.
* sysdeps/alpha/fpu/bits/mathinline.h (__MATH_INLINE): Define
to __extern_inline whenever that macro is defined.
* sysdeps/ia64/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/i386/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/i386/i486/bits/string.h (__STRING_INLINE): Likewise.
* sysdeps/s390/bits/string.h (__STRING_INLINE): Likewise.
* sysdeps/s390/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/powerpc/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/x86_64/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/sparc/fpu/bits/mathinline.h (__MATH_INLINE): Likewise.
* sysdeps/unix/sysv/linux/sys/sysmacros.h (gnu_dev_major,
gnu_dev_minor, gnu_dev_makedev): Remove __extern_inline from
prototypes. Only provide __extern_inline routines if
__USE_EXTERN_INLINES.
* debug/Makefile: Add rules to build and run tst-{,lfs}chk{4,5,6}
tests.
* debug/tst-chk1.c (do_prepare, do_test): Allow compilation as C++.
For now avoid some *printf tests in C++. Skip all testing
if __USE_FORTIFY_LEVEL is defined, but __extern_always_inline macro
is not.
* debug/tst-chk4.cc: New file.
* debug/tst-chk5.cc: New file.
* debug/tst-chk6.cc: New file.
* debug/tst-lfschk4.cc: New file.
* debug/tst-lfschk5.cc: New file.
* debug/tst-lfschk6.cc: New file.
* include/wchar.h (__vfwprintf_chk, __vswprintf_chk): Avoid
prototypes in C++.
* include/stdio.h (__sprintf_chk, __snprintf_chk, __vsprintf_chk,
__vsnprintf_chk, __printf_chk, __fprintf_chk, __vprintf_chk,
__vfprintf_chk, __fgets_unlocked_chk, __fgets_chk): Likewise.
2007-09-15 10:38:04 +08:00
|
|
|
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
|
2021-10-20 20:43:05 +08:00
|
|
|
tst-chk4 tst-chk5 tst-chk6 tst-chk7 tst-chk8 tst-lfschk4 tst-lfschk5 \
|
|
|
|
tst-lfschk6 tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 \
|
2021-12-17 21:05:44 +08:00
|
|
|
tst-backtrace4 tst-backtrace5 tst-backtrace6 tst-realpath-chk
|
1998-06-09 03:06:31 +08:00
|
|
|
|
2017-07-11 22:44:01 +08:00
|
|
|
ifeq ($(have-ssp),yes)
|
|
|
|
tests += tst-ssp-1
|
|
|
|
endif
|
|
|
|
|
2015-03-11 06:13:14 +08:00
|
|
|
ifeq (,$(CXX))
|
2021-10-20 20:43:05 +08:00
|
|
|
tests-unsupported = tst-chk4 tst-chk5 tst-chk6 tst-chk8 \
|
2015-03-11 06:13:14 +08:00
|
|
|
tst-lfschk4 tst-lfschk5 tst-lfschk6
|
2015-03-05 05:52:45 +08:00
|
|
|
endif
|
|
|
|
|
1999-08-09 06:20:38 +08:00
|
|
|
extra-libs = libSegFault libpcprofile
|
1998-07-17 04:08:44 +08:00
|
|
|
extra-libs-others = $(extra-libs)
|
|
|
|
|
|
|
|
libSegFault-routines = segfault
|
|
|
|
libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
|
|
|
|
|
1999-08-09 06:20:38 +08:00
|
|
|
libpcprofile-routines = pcprofile
|
|
|
|
libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
|
|
|
|
|
1999-10-13 02:38:32 +08:00
|
|
|
others = pcprofiledump
|
2001-08-30 07:31:38 +08:00
|
|
|
install-bin = pcprofiledump
|
|
|
|
install-bin-script = xtrace
|
1999-10-07 15:25:16 +08:00
|
|
|
|
1999-03-21 01:07:46 +08:00
|
|
|
ifeq ($(build-shared),yes)
|
2001-08-30 07:31:38 +08:00
|
|
|
install-bin-script += catchsegv
|
1998-10-19 23:22:14 +08:00
|
|
|
endif
|
2014-03-01 05:00:27 +08:00
|
|
|
generated += catchsegv xtrace
|
1998-07-17 07:08:48 +08:00
|
|
|
|
1998-06-09 03:06:31 +08:00
|
|
|
include ../Rules
|
1998-07-17 04:08:44 +08:00
|
|
|
|
2015-10-12 18:24:41 +08:00
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
LOCALES := de_DE.UTF-8
|
|
|
|
include ../gen-locales.mk
|
|
|
|
|
|
|
|
$(objpfx)tst-chk1.out: $(gen-locales)
|
2020-02-10 21:37:10 +08:00
|
|
|
$(objpfx)tst-chk2.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-chk3.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-chk4.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-chk5.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-chk6.out: $(gen-locales)
|
2021-10-20 20:43:05 +08:00
|
|
|
$(objpfx)tst-chk7.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-chk8.out: $(gen-locales)
|
2020-02-10 21:37:10 +08:00
|
|
|
$(objpfx)tst-lfschk1.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-lfschk2.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-lfschk3.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-lfschk4.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-lfschk5.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-lfschk6.out: $(gen-locales)
|
2015-10-12 18:24:41 +08:00
|
|
|
endif
|
|
|
|
|
2006-05-20 00:48:27 +08:00
|
|
|
sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
|
|
|
|
|
1998-07-17 07:08:48 +08:00
|
|
|
$(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
|
|
|
|
$(common-objpfx)config.make
|
2004-10-20 00:05:21 +08:00
|
|
|
slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \
|
2012-11-10 06:13:45 +08:00
|
|
|
sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" \
|
|
|
|
-e 's|@PKGVERSION@|$(PKGVERSION)|' \
|
|
|
|
-e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $< > $@.new
|
1998-07-17 07:08:48 +08:00
|
|
|
chmod 555 $@.new
|
|
|
|
mv -f $@.new $@
|
|
|
|
|
1999-10-07 15:25:16 +08:00
|
|
|
$(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
|
|
|
|
|
|
|
|
$(objpfx)xtrace: xtrace.sh
|
|
|
|
rm -f $@.new
|
2021-05-12 10:15:33 +08:00
|
|
|
sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
|
|
|
|
-e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
|
2012-11-10 06:13:45 +08:00
|
|
|
-e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
|
1999-10-07 15:25:16 +08:00
|
|
|
&& rm -f $@ && mv $@.new $@ && chmod +x $@
|