summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-13 21:11:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-13 21:11:40 +0000
commitac131a333b1c63000fcab69cc6723d75d7075a3a (patch)
tree1c3ca40ae25e1d14abcd13ef172247d7cb51ae0b /libc
parent2401710fc05ec38fa5d0f5a2fa68a1f8c322b883 (diff)
Remove the rest of "bounded pointers" scaffolding. gcc website says"
"Bounds Checking Projects... This project has been abandoned" for four years at least.
Diffstat (limited to 'libc')
-rw-r--r--libc/signal/sigaction.c8
-rw-r--r--libc/string/generic/bp-checks.h129
-rw-r--r--libc/string/generic/strcpy.c1
-rw-r--r--libc/string/ia64/memchr.S8
-rw-r--r--libc/string/sparc/sparc32/memchr.S2
-rw-r--r--libc/string/sparc/sparc64/memchr.S2
-rw-r--r--libc/sysdeps/linux/alpha/bits/kernel_sigaction.h4
-rw-r--r--libc/sysdeps/linux/arm/sigaction.c8
-rw-r--r--libc/sysdeps/linux/avr32/sigaction.c4
-rw-r--r--libc/sysdeps/linux/common/bits/kernel_sigaction.h8
-rw-r--r--libc/sysdeps/linux/hppa/bits/kernel_sigaction.h4
-rw-r--r--libc/sysdeps/linux/i386/sigaction.c8
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_sigaction.h4
-rw-r--r--libc/sysdeps/linux/mips/sigaction.c8
-rw-r--r--libc/sysdeps/linux/x86_64/sigaction.c8
-rw-r--r--libc/sysdeps/linux/xtensa/sigaction.c4
16 files changed, 37 insertions, 173 deletions
diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c
index f430070e6..25c1f8a74 100644
--- a/libc/signal/sigaction.c
+++ b/libc/signal/sigaction.c
@@ -62,8 +62,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {
@@ -98,8 +98,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
}
result = __syscall_sigaction(sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL);
+ act ? &kact : NULL,
+ oact ? &koact : NULL);
if (oact && result >= 0) {
oact->sa_handler = koact.k_sa_handler;
diff --git a/libc/string/generic/bp-checks.h b/libc/string/generic/bp-checks.h
deleted file mode 100644
index 08c70aa5d..000000000
--- a/libc/string/generic/bp-checks.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Bounded-pointer checking macros for C.
- Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Greg McGary <greg@mcgary.org>
-
- 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. */
-
-#ifndef _bp_checks_h_
-#define _bp_checks_h_ 1
-
-#if __BOUNDED_POINTERS__
-
-# define BOUNDS_VIOLATED (__builtin_trap (), 0)
-
-/* Verify that pointer's value >= low. Return pointer value. */
-# define CHECK_BOUNDS_LOW(ARG) \
- (((__ptrvalue (ARG) < __ptrlow (ARG)) && BOUNDS_VIOLATED), \
- __ptrvalue (ARG))
-
-/* Verify that pointer's value < high. Return pointer value. */
-# define CHECK_BOUNDS_HIGH(ARG) \
- (((__ptrvalue (ARG) > __ptrhigh (ARG)) && BOUNDS_VIOLATED), \
- __ptrvalue (ARG))
-
-# define _CHECK_N(ARG, N, COND) \
- (((COND) \
- && (__ptrvalue (ARG) < __ptrlow (ARG) \
- || __ptrvalue (ARG) + (N) > __ptrhigh (ARG)) \
- && BOUNDS_VIOLATED), \
- __ptrvalue (ARG))
-
-extern void *__unbounded __ubp_memchr (const void *__unbounded, int, unsigned);
-
-# define _CHECK_STRING(ARG, COND) \
- (((COND) \
- && (__ptrvalue (ARG) < __ptrlow (ARG) \
- || !__ubp_memchr (__ptrvalue (ARG), '\0', \
- (__ptrhigh (ARG) - __ptrvalue (ARG)))) \
- && BOUNDS_VIOLATED), \
- __ptrvalue (ARG))
-
-/* Check bounds of a pointer seated to an array of N objects. */
-# define CHECK_N(ARG, N) _CHECK_N ((ARG), (N), 1)
-/* Same as CHECK_N, but tolerate ARG == NULL. */
-# define CHECK_N_NULL_OK(ARG, N) _CHECK_N ((ARG), (N), __ptrvalue (ARG))
-
-/* Check bounds of a pointer seated to a single object. */
-# define CHECK_1(ARG) CHECK_N ((ARG), 1)
-/* Same as CHECK_1, but tolerate ARG == NULL. */
-# define CHECK_1_NULL_OK(ARG) CHECK_N_NULL_OK ((ARG), 1)
-
-/* Check for NUL-terminator within string's bounds. */
-# define CHECK_STRING(ARG) _CHECK_STRING ((ARG), 1)
-/* Same as CHECK_STRING, but tolerate ARG == NULL. */
-# define CHECK_STRING_NULL_OK(ARG) _CHECK_STRING ((ARG), __ptrvalue (ARG))
-
-/* Check bounds of signal syscall args with type sigset_t. */
-# define CHECK_SIGSET(SET) CHECK_N ((SET), _NSIG / (8 * sizeof *(SET)))
-/* Same as CHECK_SIGSET, but tolerate SET == NULL. */
-# define CHECK_SIGSET_NULL_OK(SET) CHECK_N_NULL_OK ((SET), _NSIG / (8 * sizeof *(SET)))
-
-# if defined (_IOC_SIZESHIFT) && defined (_IOC_SIZEBITS)
-/* Extract the size of the ioctl data and check its bounds. */
-# define CHECK_IOCTL(ARG, CMD) \
- CHECK_N ((const char *) (ARG), \
- (((CMD) >> _IOC_SIZESHIFT) & ((1 << _IOC_SIZEBITS) - 1)))
-# else
-/* We don't know the size of the ioctl data, so the best we can do
- is check that the first byte is within bounds. */
-# define CHECK_IOCTL(ARG, CMD) CHECK_1 ((const char *) ARG)
-# endif
-
-/* Check bounds of `struct flock *' for the locking fcntl commands. */
-# define CHECK_FCNTL(ARG, CMD) \
- (((CMD) == F_GETLK || (CMD) == F_SETLK || (CMD) == F_SETLKW) \
- ? CHECK_1 ((struct flock *) ARG) : (unsigned long) (ARG))
-
-/* Check bounds of an array of mincore residency-status flags that
- cover a region of NBYTES. Such a vector occupies one byte per page
- of memory. */
-# define CHECK_N_PAGES(ARG, NBYTES) \
- ({ int _page_size_ = __sysconf (_SC_PAGE_SIZE); \
- CHECK_N ((const char *) (ARG), \
- ((NBYTES) + _page_size_ - 1) / _page_size_); })
-
-/* Return a bounded pointer with value PTR that satisfies CHECK_N (PTR, N). */
-# define BOUNDED_N(PTR, N) \
- ({ __typeof (PTR) __bounded _p_; \
- __ptrvalue _p_ = __ptrlow _p_ = __ptrvalue (PTR); \
- __ptrhigh _p_ = __ptrvalue _p_ + (N); \
- _p_; })
-
-#else /* !__BOUNDED_POINTERS__ */
-
-/* Do nothing if not compiling with -fbounded-pointers. */
-
-# define BOUNDS_VIOLATED
-# define CHECK_BOUNDS_LOW(ARG) (ARG)
-# define CHECK_BOUNDS_HIGH(ARG) (ARG)
-# define CHECK_1(ARG) (ARG)
-# define CHECK_1_NULL_OK(ARG) (ARG)
-# define CHECK_N(ARG, N) (ARG)
-# define CHECK_N_NULL_OK(ARG, N) (ARG)
-# define CHECK_STRING(ARG) (ARG)
-# define CHECK_SIGSET(SET) (SET)
-# define CHECK_SIGSET_NULL_OK(SET) (SET)
-# define CHECK_IOCTL(ARG, CMD) (ARG)
-# define CHECK_FCNTL(ARG, CMD) (ARG)
-# define CHECK_N_PAGES(ARG, NBYTES) (ARG)
-# define BOUNDED_N(PTR, N) (PTR)
-
-#endif /* !__BOUNDED_POINTERS__ */
-
-#define BOUNDED_1(PTR) BOUNDED_N (PTR, 1)
-
-#endif /* _bp_checks_h_ */
diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c
index 5f2758153..b9a0a286a 100644
--- a/libc/string/generic/strcpy.c
+++ b/libc/string/generic/strcpy.c
@@ -20,7 +20,6 @@
#include <stddef.h>
#include "memcopy.h"
-#include "bp-checks.h"
/* Experimentally off - libc_hidden_proto(strcpy) */
/* Copy SRC to DEST. */
diff --git a/libc/string/ia64/memchr.S b/libc/string/ia64/memchr.S
index 0246b5997..f25e80302 100644
--- a/libc/string/ia64/memchr.S
+++ b/libc/string/ia64/memchr.S
@@ -126,8 +126,6 @@ ENTRY(__memchr)
END(__memchr)
-weak_alias (__memchr, memchr)
-#if !__BOUNDED_POINTERS__
-weak_alias (__memchr, __ubp_memchr)
-#endif
-libc_hidden_def (memchr)
+weak_alias(__memchr, memchr)
+weak_alias(__memchr, __ubp_memchr)
+libc_hidden_def(memchr)
diff --git a/libc/string/sparc/sparc32/memchr.S b/libc/string/sparc/sparc32/memchr.S
index 4d57a553b..d926e9787 100644
--- a/libc/string/sparc/sparc32/memchr.S
+++ b/libc/string/sparc/sparc32/memchr.S
@@ -139,6 +139,4 @@ ENTRY(memchr)
END(memchr)
libc_hidden_def(memchr)
-#if !__BOUNDED_POINTERS__
weak_alias(memchr,__ubp_memchr)
-#endif
diff --git a/libc/string/sparc/sparc64/memchr.S b/libc/string/sparc/sparc64/memchr.S
index 6096cc218..f44850b08 100644
--- a/libc/string/sparc/sparc64/memchr.S
+++ b/libc/string/sparc/sparc64/memchr.S
@@ -256,6 +256,4 @@ ENTRY(memchr)
END(memchr)
libc_hidden_def(memchr)
-#if !__BOUNDED_POINTERS__
weak_alias(memchr,__ubp_memchr)
-#endif
diff --git a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
index d111a5f3d..626af23fb 100644
--- a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
@@ -17,7 +17,7 @@ struct kernel_sigaction {
sigset_t sa_mask;
};
-extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t) attribute_hidden;
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
+ struct kernel_sigaction *, size_t) attribute_hidden;
#endif
diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c
index fc7f200d0..2307d7add 100644
--- a/libc/sysdeps/linux/arm/sigaction.c
+++ b/libc/sysdeps/linux/arm/sigaction.c
@@ -73,8 +73,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {
@@ -111,8 +111,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
}
# endif
}
- result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL);
+ result = __syscall_sigaction(sig, act ? &kact : NULL,
+ oact ? &koact : NULL);
if (oact && result >= 0) {
oact->sa_handler = koact.k_sa_handler;
oact->sa_mask.__val[0] = koact.sa_mask;
diff --git a/libc/sysdeps/linux/avr32/sigaction.c b/libc/sysdeps/linux/avr32/sigaction.c
index 45d0abb5a..8113c9ca6 100644
--- a/libc/sysdeps/linux/avr32/sigaction.c
+++ b/libc/sysdeps/linux/avr32/sigaction.c
@@ -46,8 +46,8 @@ int __libc_sigaction(int signum, const struct sigaction *act,
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(signum,
- act ? __ptrvalue(&kact) : NULL,
- oldact ? __ptrvalue(&koact) : NULL,
+ act ? &kact : NULL,
+ oldact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oldact && result >= 0) {
diff --git a/libc/sysdeps/linux/common/bits/kernel_sigaction.h b/libc/sysdeps/linux/common/bits/kernel_sigaction.h
index 89aa2bb88..a39aa324b 100644
--- a/libc/sysdeps/linux/common/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/common/bits/kernel_sigaction.h
@@ -65,11 +65,11 @@ struct kernel_sigaction {
#endif
#ifndef NO_OLD_SIGACTION
-extern int __syscall_sigaction (int, const struct old_kernel_sigaction *__unbounded,
- struct old_kernel_sigaction *__unbounded) attribute_hidden;
+extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
+ struct old_kernel_sigaction *) attribute_hidden;
#endif
-extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t) attribute_hidden;
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
+ struct kernel_sigaction *, size_t) attribute_hidden;
#endif /* _BITS_SIGACTION_STRUCT_H */
diff --git a/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h b/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h
index 4ae53fd3c..8a8491da0 100644
--- a/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/hppa/bits/kernel_sigaction.h
@@ -20,7 +20,7 @@ struct kernel_sigaction {
sigset_t sa_mask;
};
-extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t) attribute_hidden;
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
+ struct kernel_sigaction *, size_t) attribute_hidden;
#endif
diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c
index e323d0938..a69c872a7 100644
--- a/libc/sysdeps/linux/i386/sigaction.c
+++ b/libc/sysdeps/linux/i386/sigaction.c
@@ -66,8 +66,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {
@@ -110,8 +110,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
"popl %%ebx"
: "=a" (result), "=m" (koact)
: "0" (__NR_sigaction), "r" (sig), "m" (kact),
- "c" (act ? __ptrvalue (&kact) : 0),
- "d" (oact ? __ptrvalue (&koact) : 0));
+ "c" (act ? &kact : 0),
+ "d" (oact ? &koact : 0));
if (result < 0) {
__set_errno(-result);
diff --git a/libc/sysdeps/linux/mips/bits/kernel_sigaction.h b/libc/sysdeps/linux/mips/bits/kernel_sigaction.h
index 5c8454837..6a7b939c4 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_sigaction.h
@@ -42,7 +42,7 @@ struct kernel_sigaction {
int s_resv[1]; /* reserved */
};
-extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t) attribute_hidden;
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
+ struct kernel_sigaction *, size_t) attribute_hidden;
#endif
diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c
index ca39740af..7c933ffd5 100644
--- a/libc/sysdeps/linux/mips/sigaction.c
+++ b/libc/sysdeps/linux/mips/sigaction.c
@@ -70,8 +70,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {
@@ -109,8 +109,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
# endif
}
- result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL);
+ result = __syscall_sigaction(sig, act ? &kact : NULL,
+ oact ? &koact : NULL);
if (result < 0) {
__set_errno(-result);
diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c
index e53e30442..58466c8ef 100644
--- a/libc/sysdeps/linux/x86_64/sigaction.c
+++ b/libc/sysdeps/linux/x86_64/sigaction.c
@@ -66,8 +66,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {
@@ -107,8 +107,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
__asm__ __volatile__ ("syscall\n"
: "=a" (result)
: "0" (__NR_sigaction), "mr" (sig),
- "c" (act ? __ptrvalue (&kact) : 0),
- "d" (oact ? __ptrvalue (&koact) : 0));
+ "c" (act ? &kact : 0),
+ "d" (oact ? &koact : 0));
if (result < 0) {
__set_errno(-result);
diff --git a/libc/sysdeps/linux/xtensa/sigaction.c b/libc/sysdeps/linux/xtensa/sigaction.c
index f5425e76a..123cb5085 100644
--- a/libc/sysdeps/linux/xtensa/sigaction.c
+++ b/libc/sysdeps/linux/xtensa/sigaction.c
@@ -45,8 +45,8 @@ int __libc_sigaction (int signum, const struct sigaction *act,
/* NB: kernel (as of 2.6.25) will return EINVAL
* if sizeof(kact.sa_mask) does not match kernel's sizeof(sigset_t) */
result = __syscall_rt_sigaction(signum,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof(kact.sa_mask));
if (oact && result >= 0) {