summaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 17:46:17 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 17:46:17 +0000
commit8833066b122427710a9e14a888ce6cfa862332d3 (patch)
tree29591019d695919417b3698618d6a342e97381d6 /debug
parentfedca46896bdb702cb988837a0c2c5447e72ba2b (diff)
Updated to fedora-glibc-20070731T1624cvs/fedora-glibc-2_6_90-1
Diffstat (limited to 'debug')
-rw-r--r--debug/Makefile4
-rw-r--r--debug/chk_fail.c7
-rw-r--r--debug/fortify_fail.c34
-rw-r--r--debug/fprintf_chk.c4
-rw-r--r--debug/fwprintf_chk.c4
-rw-r--r--debug/printf_chk.c4
-rw-r--r--debug/stack_chk_fail.c7
-rw-r--r--debug/test-strcpy_chk.c11
-rw-r--r--debug/vfprintf_chk.c4
-rw-r--r--debug/vfwprintf_chk.c4
-rw-r--r--debug/vprintf_chk.c4
-rw-r--r--debug/vwprintf_chk.c4
-rw-r--r--debug/wprintf_chk.c4
13 files changed, 63 insertions, 32 deletions
diff --git a/debug/Makefile b/debug/Makefile
index 9d9b6ac96a..b9902cb4bf 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2001,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 1998-2001,2004,2005,2006,2007 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -42,7 +42,7 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \
gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
wcstombs_chk \
- stack_chk_fail \
+ stack_chk_fail fortify_fail \
$(static-only-routines)
static-only-routines := warning-nop stack_chk_fail_local
diff --git a/debug/chk_fail.c b/debug/chk_fail.c
index 0cfca295a9..bff17e4d3a 100644
--- a/debug/chk_fail.c
+++ b/debug/chk_fail.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,9 +26,6 @@ void
__attribute__ ((noreturn))
__chk_fail (void)
{
- /* The loop is added only to keep gcc happy. */
- while (1)
- __libc_message (2, "*** buffer overflow detected ***: %s terminated\n",
- __libc_argv[0] ?: "<unknown>");
+ __fortify_fail ("buffer overflow detected");
}
libc_hidden_def (__chk_fail)
diff --git a/debug/fortify_fail.c b/debug/fortify_fail.c
new file mode 100644
index 0000000000..66494a678f
--- /dev/null
+++ b/debug/fortify_fail.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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.
+
+ 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+extern char **__libc_argv attribute_hidden;
+
+void
+__attribute__ ((noreturn))
+__fortify_fail (msg)
+ const char *msg;
+{
+ /* The loop is added only to keep gcc happy. */
+ while (1)
+ __libc_message (2, "*** %s ***: %s terminated\n",
+ msg, __libc_argv[0] ?: "<unknown>");
+}
diff --git a/debug/fprintf_chk.c b/debug/fprintf_chk.c
index 58b5fb2b3e..77c50311f7 100644
--- a/debug/fprintf_chk.c
+++ b/debug/fprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -29,7 +29,7 @@ ___fprintf_chk (FILE *fp, int flag, const char *format, ...)
va_list ap;
int done;
- _IO_acquire_lock (fp);
+ _IO_acquire_lock_clear_flags2 (fp);
if (flag > 0)
fp->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/fwprintf_chk.c b/debug/fwprintf_chk.c
index 710c89f3c8..b7e3494c7d 100644
--- a/debug/fwprintf_chk.c
+++ b/debug/fwprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -29,7 +29,7 @@ __fwprintf_chk (FILE *fp, int flag, const wchar_t *format, ...)
va_list ap;
int done;
- _IO_acquire_lock (fp);
+ _IO_acquire_lock_clear_flags2 (fp);
if (flag > 0)
fp->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/printf_chk.c b/debug/printf_chk.c
index b8f00965dc..7bea9f6b06 100644
--- a/debug/printf_chk.c
+++ b/debug/printf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -29,7 +29,7 @@ ___printf_chk (int flag, const char *format, ...)
va_list ap;
int done;
- _IO_acquire_lock (stdout);
+ _IO_acquire_lock_clear_flags2 (stdout);
if (flag > 0)
stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/stack_chk_fail.c b/debug/stack_chk_fail.c
index 298b323671..77e42f2dcb 100644
--- a/debug/stack_chk_fail.c
+++ b/debug/stack_chk_fail.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,8 +26,5 @@ void
__attribute__ ((noreturn))
__stack_chk_fail (void)
{
- /* The loop is added only to keep gcc happy. */
- while (1)
- __libc_message (1, "*** stack smashing detected ***: %s terminated\n",
- __libc_argv[0] ?: "<unknown>");
+ __fortify_fail ("stack smashing detected");
}
diff --git a/debug/test-strcpy_chk.c b/debug/test-strcpy_chk.c
index ac9f9448cf..e08141dad0 100644
--- a/debug/test-strcpy_chk.c
+++ b/debug/test-strcpy_chk.c
@@ -141,8 +141,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t dlen, int max_char)
if (align2 + len >= page_size)
return;
- s1 = buf1 + align1;
- s2 = buf2 + align2;
+ s1 = (char *) buf1 + align1;
+ s2 = (char *) buf2 + align2;
for (i = 0; i < len; i++)
s1[i] = 32 + 23 * i % (max_char - 32);
@@ -233,7 +233,9 @@ do_random_tests (void)
chk_fail_ok = 1;
if (setjmp (chk_fail_buf) == 0)
{
- res = CALL (impl, p2 + align2, p1 + align1, dlen);
+ res = (unsigned char *)
+ CALL (impl, (char *) p2 + align2,
+ (char *) p1 + align1, dlen);
printf ("Iteration %zd - did not __chk_fail\n", n);
chk_fail_ok = 0;
ret = 1;
@@ -242,7 +244,8 @@ do_random_tests (void)
continue;
}
memset (p2 - 64, '\1', 512 + 64);
- res = CALL (impl, p2 + align2, p1 + align1, dlen);
+ res = (unsigned char *)
+ CALL (impl, (char *) p2 + align2, (char *) p1 + align1, dlen);
if (res != STRCPY_RESULT (p2 + align2, len))
{
printf ("\
diff --git a/debug/vfprintf_chk.c b/debug/vfprintf_chk.c
index bd2796eaf7..7146986d5e 100644
--- a/debug/vfprintf_chk.c
+++ b/debug/vfprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,7 +28,7 @@ ___vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap)
{
int done;
- _IO_acquire_lock (fp);
+ _IO_acquire_lock_clear_flags2 (fp);
if (flag > 0)
fp->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/vfwprintf_chk.c b/debug/vfwprintf_chk.c
index a2612d53e9..f0ae041c2e 100644
--- a/debug/vfwprintf_chk.c
+++ b/debug/vfwprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,7 +28,7 @@ __vfwprintf_chk (FILE *fp, int flag, const wchar_t *format, va_list ap)
{
int done;
- _IO_acquire_lock (fp);
+ _IO_acquire_lock_clear_flags2 (fp);
if (flag > 0)
fp->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/vprintf_chk.c b/debug/vprintf_chk.c
index 68a63ee7f9..68ff4909ba 100644
--- a/debug/vprintf_chk.c
+++ b/debug/vprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,7 +28,7 @@ ___vprintf_chk (int flag, const char *format, va_list ap)
{
int done;
- _IO_acquire_lock (stdout);
+ _IO_acquire_lock_clear_flags2 (stdout);
if (flag > 0)
stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/vwprintf_chk.c b/debug/vwprintf_chk.c
index 3b959b2968..48306a7438 100644
--- a/debug/vwprintf_chk.c
+++ b/debug/vwprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -29,7 +29,7 @@ __vwprintf_chk (int flag, const wchar_t *format, va_list ap)
{
int done;
- _IO_acquire_lock (stdout);
+ _IO_acquire_lock_clear_flags2 (stdout);
if (flag > 0)
stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
diff --git a/debug/wprintf_chk.c b/debug/wprintf_chk.c
index e0a82617ad..ef60f8a9f8 100644
--- a/debug/wprintf_chk.c
+++ b/debug/wprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -30,7 +30,7 @@ __wprintf_chk (int flag, const wchar_t *format, ...)
va_list ap;
int done;
- _IO_acquire_lock (stdout);
+ _IO_acquire_lock_clear_flags2 (stdout);
if (flag > 0)
stdout->_flags2 |= _IO_FLAGS2_FORTIFY;