From 61062f56304750c367c5c1533351621353c112a7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 1 Mar 2005 00:35:23 +0000 Subject: * posix/bits/unistd.h: Avoid calling __*_chk variants if we can determine the call will never trigger a failure. * sysdeps/i386/i686/memset_chk.S: Remove alias and warning. * sysdeps/x86_64/memset_chk.S: Likewise. 2005-02-24 Roland McGrath * debug/Versions (libc: GLIBC_2.4): Remove __memset_zero_constant_len_parameter. * sysdeps/generic/memset_chk.c: Remove alias and warning. * misc/sys/cdefs.h (__warndecl): New macro. * debug/warning-nop.c: New file. * string/bits/string3.h (memset): Call __warn_memset_zero_len with no arguments, instead of calling __memset_zero_constant_len_parameter. Use __warndecl for __warn_memset_zero_len. * debug/Makefile (routines): Add $(static-only-routines). (static-only-routines): New variable. --- posix/bits/unistd.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'posix') diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index 3b9c67c..0e5417c 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -25,6 +25,7 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __wur; #define read(fd, buf, nbytes) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __read_chk (fd, buf, nbytes, __bos (buf)) \ : read (fd, buf, nbytes)) @@ -36,11 +37,13 @@ extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, # ifndef __USE_FILE_OFFSET64 # define pread(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread64_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread (fd, buf, offset, nbytes)) # else # define pread(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread (fd, buf, offset, nbytes)) # endif @@ -48,6 +51,7 @@ extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, # ifdef __USE_LARGEFILE64 # define pread64(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread64_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread64 (fd, buf, offset, nbytes)) # endif @@ -60,6 +64,7 @@ extern int __readlink_chk (__const char *__restrict __path, __THROW __nonnull ((1, 2)) __wur; # define readlink(path, buf, len) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (len) || (len) > __bos (buf)) \ ? __readlink_chk (path, buf, len, __bos (buf)) \ : readlink (path, buf, len)) #endif @@ -68,6 +73,7 @@ extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) __THROW __wur; #define getcwd(buf, size) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (size) || (size) > __bos (buf)) \ ? __getcwd_chk (buf, size, buflen) : getcwd (buf, size)) #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -- cgit v1.1