diff options
author | Greg McGary <greg@mcgary.org> | 2000-06-26 22:15:00 +0000 |
---|---|---|
committer | Greg McGary <greg@mcgary.org> | 2000-06-26 22:15:00 +0000 |
commit | 2fc0882697f83d4ef8fe7090c66a27d9396095ba (patch) | |
tree | 3c5fbeca60aec00a55bdd6443735e2cd241f9c98 /sysdeps/i386/i686 | |
parent | c2eee429d3cbb5e81b84bca109db19b119dbedc2 (diff) | |
download | glibc-2fc0882697f83d4ef8fe7090c66a27d9396095ba.tar.gz glibc-2fc0882697f83d4ef8fe7090c66a27d9396095ba.tar.xz glibc-2fc0882697f83d4ef8fe7090c66a27d9396095ba.zip |
* sysdeps/i386/add_n.S: Wrap entry-point symbol in BP_SYM ().
Check bounds of arguments. * sysdeps/i386/addmul_1.S: Likewise. * sysdeps/i386/lshift.S: Likewise. * sysdeps/i386/mul_1.S: Likewise. * sysdeps/i386/rshift.S: Likewise. * sysdeps/i386/sub_n.S: Likewise. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/i586/add_n.S: Likewise. * sysdeps/i386/i586/addmul_1.S: Likewise. * sysdeps/i386/i586/lshift.S: Likewise. * sysdeps/i386/i586/rshift.S: Likewise. * sysdeps/i386/i586/sub_n.S: Likewise. * sysdeps/i386/i686/add_n.S: Likewise. * sysdeps/i386/memchr.S: Likewise. * sysdeps/i386/memcmp.S: Likewise. * sysdeps/i386/rawmemchr.S: Likewise. * sysdeps/i386/i586/bzero.S: Likewise. * sysdeps/i386/i586/memcpy.S: Likewise. * sysdeps/i386/i586/mempcpy.S: Likewise. * sysdeps/i386/i586/memset.S: Likewise. * sysdeps/i386/i686/bzero.S: Likewise. * sysdeps/i386/i686/memcpy.S: Likewise. * sysdeps/i386/i686/mempcpy.S: Likewise. * sysdeps/i386/i686/memset.S: Likewise. * sysdeps/i386/stpcpy.S: Likewise. * sysdeps/i386/stpncpy.S: Likewise. * sysdeps/i386/strchr.S: Likewise. * sysdeps/i386/strchrnul.S: Likewise. * sysdeps/i386/strcspn.S: Likewise. * sysdeps/i386/strpbrk.S: Likewise. * sysdeps/i386/strrchr.S: Likewise. * sysdeps/i386/strspn.S: Likewise. * sysdeps/i386/strtok.S: Likewise. * sysdeps/i386/strtok_r.S: Likewise. * sysdeps/i386/i486/strcat.S: Likewise. * sysdeps/i386/i486/strlen.S: Likewise. * sysdeps/i386/i586/strchr.S: Likewise. * sysdeps/i386/i586/strcpy.S: Likewise. * sysdeps/i386/i586/strlen.S: Likewise. * sysdeps/i386/i686/strcmp.S: Likewise. * sysdeps/i386/i686/strtok.S: Likewise. * sysdeps/i386/i686/strtok_r.S: Likewise. * sysdeps/i386/fpu/fegetenv.c: Wrap symbol names with BP_SYM (). * sysdeps/i386/fpu/fesetenv.c: Likewise. * sysdeps/i386/fpu/feupdateenv.c: Likewise. * sysdeps/i386/fpu/fgetexcptflg.c: Likewise. * sysdeps/i386/fpu/fsetexcptflg.c: Likewise. * sysdeps/i386/add_n.S: Wrap entry-point symbol in BP_SYM (). Check bounds of arguments. * sysdeps/i386/addmul_1.S: Likewise. * sysdeps/i386/lshift.S: Likewise. * sysdeps/i386/mul_1.S: Likewise. * sysdeps/i386/rshift.S: Likewise. * sysdeps/i386/sub_n.S: Likewise. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/i586/add_n.S: Likewise. * sysdeps/i386/i586/addmul_1.S: Likewise. * sysdeps/i386/i586/lshift.S: Likewise. * sysdeps/i386/i586/rshift.S: Likewise. * sysdeps/i386/i586/sub_n.S: Likewise. * sysdeps/i386/i686/add_n.S: Likewise. * sysdeps/i386/memchr.S: Likewise. * sysdeps/i386/memcmp.S: Likewise. * sysdeps/i386/rawmemchr.S: Likewise. * sysdeps/i386/i586/bzero.S: Likewise. * sysdeps/i386/i586/memcpy.S: Likewise. * sysdeps/i386/i586/mempcpy.S: Likewise. * sysdeps/i386/i586/memset.S: Likewise. * sysdeps/i386/i686/bzero.S: Likewise. * sysdeps/i386/i686/memcpy.S: Likewise. * sysdeps/i386/i686/mempcpy.S: Likewise. * sysdeps/i386/i686/memset.S: Likewise. * sysdeps/i386/stpcpy.S: Likewise. * sysdeps/i386/stpncpy.S: Likewise. * sysdeps/i386/strchr.S: Likewise. * sysdeps/i386/strchrnul.S: Likewise. * sysdeps/i386/strcspn.S: Likewise. * sysdeps/i386/strpbrk.S: Likewise. * sysdeps/i386/strrchr.S: Likewise. * sysdeps/i386/strspn.S: Likewise. * sysdeps/i386/strtok.S: Likewise. * sysdeps/i386/strtok_r.S: Likewise. * sysdeps/i386/i486/strcat.S: Likewise. * sysdeps/i386/i486/strlen.S: Likewise. * sysdeps/i386/i586/strchr.S: Likewise. * sysdeps/i386/i586/strcpy.S: Likewise. * sysdeps/i386/i586/strlen.S: Likewise. * sysdeps/i386/i686/strcmp.S: Likewise. * sysdeps/i386/i686/strtok.S: Likewise. * sysdeps/i386/i686/strtok_r.S: Likewise. * sysdeps/i386/fpu/fegetenv.c: Wrap symbol names with BP_SYM (). * sysdeps/i386/fpu/fesetenv.c: Likewise. * sysdeps/i386/fpu/feupdateenv.c: Likewise. * sysdeps/i386/fpu/fgetexcptflg.c: Likewise. * sysdeps/i386/fpu/fsetexcptflg.c: Likewise.
Diffstat (limited to 'sysdeps/i386/i686')
-rw-r--r-- | sysdeps/i386/i686/add_n.S | 13 | ||||
-rw-r--r-- | sysdeps/i386/i686/bzero.S | 2 | ||||
-rw-r--r-- | sysdeps/i386/i686/memcpy.S | 9 | ||||
-rw-r--r-- | sysdeps/i386/i686/mempcpy.S | 10 | ||||
-rw-r--r-- | sysdeps/i386/i686/memset.S | 9 | ||||
-rw-r--r-- | sysdeps/i386/i686/strcmp.S | 19 | ||||
-rw-r--r-- | sysdeps/i386/i686/strtok.S | 17 | ||||
-rw-r--r-- | sysdeps/i386/i686/strtok_r.S | 2 |
8 files changed, 60 insertions, 21 deletions
diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S index 45e1284b1b..0b0684f931 100644 --- a/sysdeps/i386/i686/add_n.S +++ b/sysdeps/i386/i686/add_n.S @@ -20,6 +20,7 @@ #include "sysdep.h" #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" #define PARMS LINKAGE+8 /* space for 2 saved regs */ @@ -33,7 +34,7 @@ L(1): addl (%esp), %eax ret #endif -ENTRY(__mpn_add_n) +ENTRY (BP_SYM (__mpn_add_n)) ENTER pushl %edi @@ -43,7 +44,13 @@ ENTRY(__mpn_add_n) movl S1(%esp),%esi movl S2(%esp),%edx movl SIZE(%esp),%ecx - +#if __BOUNDED_POINTERS__ + shll $2, %ecx /* convert limbs to bytes */ + CHECK_BOUNDS_BOTH_WIDE (%edi, RES(%esp), %ecx) + CHECK_BOUNDS_BOTH_WIDE (%esi, S1(%esp), %ecx) + CHECK_BOUNDS_BOTH_WIDE (%edx, S2(%esp), %ecx) + shrl $2, %ecx +#endif movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -104,4 +111,4 @@ L(oop): movl (%esi),%eax LEAVE ret -END(__mpn_add_n) +END (BP_SYM (__mpn_add_n)) diff --git a/sysdeps/i386/i686/bzero.S b/sysdeps/i386/i686/bzero.S index 34b0faa91b..c1e4a6d50e 100644 --- a/sysdeps/i386/i686/bzero.S +++ b/sysdeps/i386/i686/bzero.S @@ -1,3 +1,3 @@ #define memset __bzero #include <sysdeps/i386/i686/memset.S> -weak_alias (__bzero, bzero) +weak_alias (BP_SYM (__bzero), BP_SYM (bzero)) diff --git a/sysdeps/i386/i686/memcpy.S b/sysdeps/i386/i686/memcpy.S index 8e8cc41fbc..cf836f438f 100644 --- a/sysdeps/i386/i686/memcpy.S +++ b/sysdeps/i386/i686/memcpy.S @@ -21,6 +21,7 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" #define PARMS LINKAGE /* no space for saved regs */ @@ -30,7 +31,7 @@ #define LEN SRC+PTR_SIZE .text -ENTRY(memcpy) +ENTRY (BP_SYM (memcpy)) ENTER movl LEN(%esp), %ecx @@ -38,6 +39,9 @@ ENTRY(memcpy) movl DEST(%esp), %edi movl %esi, %edx movl SRC(%esp), %esi + CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx) + CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx) + cld shrl $1, %ecx jnc 1f @@ -50,7 +54,8 @@ ENTRY(memcpy) movl %eax, %edi movl %edx, %esi movl DEST(%esp), %eax + RETURN_BOUNDED_POINTER (DEST(%esp)) LEAVE RET_PTR -END(memcpy) +END (BP_SYM (memcpy)) diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S index c851d06d44..685c599742 100644 --- a/sysdeps/i386/i686/mempcpy.S +++ b/sysdeps/i386/i686/mempcpy.S @@ -21,6 +21,7 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" #define PARMS LINKAGE /* no space for saved regs */ @@ -30,14 +31,16 @@ #define LEN SRC+PTR_SIZE .text -ENTRY(__mempcpy) +ENTRY (BP_SYM (__mempcpy)) ENTER movl LEN(%esp), %ecx movl %edi, %eax movl DEST(%esp), %edi + CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx) movl %esi, %edx movl SRC(%esp), %esi + CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx) cld shrl $1, %ecx jnc 1f @@ -49,8 +52,9 @@ ENTRY(__mempcpy) movsl xchgl %edi, %eax movl %edx, %esi + RETURN_BOUNDED_POINTER (DEST(%esp)) LEAVE RET_PTR -END(__mempcpy) -weak_alias (__mempcpy, mempcpy) +END (BP_SYM (__mempcpy)) +weak_alias (BP_SYM (__mempcpy), BP_SYM (mempcpy)) diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 74ce87bfc7..98ba39d3d0 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -21,6 +21,7 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" /* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */ @@ -38,13 +39,14 @@ #endif .text -ENTRY (memset) +ENTRY (BP_SYM (memset)) ENTER cld pushl %edi movl DEST(%esp), %edx movl LEN(%esp), %ecx + CHECK_BOUNDS_BOTH_WIDE (%edx, DEST(%esp), %ecx) #if BZERO_P xorl %eax, %eax /* fill with 0 */ #else @@ -79,7 +81,8 @@ ENTRY (memset) 1: #if !BZERO_P - movl DEST(%esp), %eax + movl DEST(%esp), %eax /* start address of destination is result */ + RETURN_BOUNDED_POINTER (DEST(%esp)) #endif popl %edi @@ -89,4 +92,4 @@ ENTRY (memset) #else RET_PTR #endif -END (memset) +END (BP_SYM (memset)) diff --git a/sysdeps/i386/i686/strcmp.S b/sysdeps/i386/i686/strcmp.S index efda8515aa..b353db7e9d 100644 --- a/sysdeps/i386/i686/strcmp.S +++ b/sysdeps/i386/i686/strcmp.S @@ -20,6 +20,7 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" #define PARMS LINKAGE /* no space for saved regs */ @@ -27,27 +28,37 @@ #define STR2 STR1+PTR_SIZE .text -ENTRY (strcmp) +ENTRY (BP_SYM (strcmp)) ENTER movl STR1(%esp), %ecx movl STR2(%esp), %edx + CHECK_BOUNDS_LOW (%ecx, STR1(%esp)) + CHECK_BOUNDS_LOW (%edx, STR2(%esp)) L(oop): movb (%ecx), %al - incl %ecx cmpb (%edx), %al jne L(neq) + incl %ecx incl %edx testb %al, %al jnz L(oop) xorl %eax, %eax + /* when strings are equal, pointers rest one beyond + the end of the NUL terminators. */ + CHECK_BOUNDS_HIGH (%ecx, STR1(%esp), jbe) + CHECK_BOUNDS_HIGH (%edx, STR2(%esp), jbe) jmp L(out) L(neq): movl $1, %eax - ja L(out) + ja L(chk) negl %eax + /* When strings differ, pointers rest on + the unequal characters. */ +L(chk): CHECK_BOUNDS_HIGH (%ecx, STR1(%esp), jb) + CHECK_BOUNDS_HIGH (%edx, STR2(%esp), jb) L(out): LEAVE ret -END (strcmp) +END (BP_SYM (strcmp)) diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S index 18aa7c8c7b..96b3b5dc33 100644 --- a/sysdeps/i386/i686/strtok.S +++ b/sysdeps/i386/i686/strtok.S @@ -1,6 +1,6 @@ /* strtok (str, delim) -- Return next DELIM separated token from STR. For Intel 80686. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -21,6 +21,8 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" +#include "bp-asm.h" /* This file can be used for three variants of the strtok function: @@ -45,7 +47,7 @@ save_ptr: .space 4 -#define FUNCTION strtok +#define FUNCTION BP_SYM (strtok) #endif .text @@ -55,7 +57,14 @@ save_ptr: ret #endif -ENTRY (FUNCTION) +#define PARMS LINKAGE /* no space for saved regs */ +#define RTN PARMS +#define STR RTN+RTN_SIZE +#define DELIM STR+PTR_SIZE +#define SAVE DELIM+PTR_SIZE + +ENTRY (BP_SYM (FUNCTION)) + ENTER #if !defined USE_AS_STRTOK_R && defined PIC pushl %ebx /* Save PIC register. */ @@ -226,4 +235,4 @@ L(return): L(returnNULL): xorl %eax, %eax jmp L(return) -END (FUNCTION) +END (BP_SYM (FUNCTION)) diff --git a/sysdeps/i386/i686/strtok_r.S b/sysdeps/i386/i686/strtok_r.S index 70048db2c4..cbaeabbabe 100644 --- a/sysdeps/i386/i686/strtok_r.S +++ b/sysdeps/i386/i686/strtok_r.S @@ -1,4 +1,4 @@ #define FUNCTION __strtok_r #define USE_AS_STRTOK_R 1 #include <sysdeps/i386/i686/strtok.S> -weak_alias (__strtok_r, strtok_r) +weak_alias (BP_SYM (__strtok_r), BP_SYM (strtok_r)) |