This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: BP checks for many ix86 asm funcs


I built non-BP before & after for i[3456]86, and diff'ed the disassemblies.

Here is a summary of binary differences (commentary follows in []):

OK?

	ix86 generic:

--- /3/gnu/libc/ASM-i386-pc-linux-gnu/string/strpbrk.dis	Mon Jun 26 13:07:40 2000
+++ /3/gnu/libc-bp/ASM-i386-pc-linux-gnu/string/strpbrk.dis	Mon Jun 26 13:07:42 2000
@@ -107,6 +107,7 @@
   a4:	40                   	inc    %eax
   a5:	81 c4 00 01 00 00    	add    $0x100,%esp
   ab:	08 c9                	or     %cl,%cl
-  ad:	75 02                	jne    b1 <strpbrk+0xb1>
+  ad:	75 03                	jne    b2 <strpbrk+0xb2>
   af:	31 c0                	xor    %eax,%eax
   b1:	c3                   	ret    
+  b2:	c3                   	ret    

[ I added a RETURN_NULL_BOUNDED_POINTER case with its own `ret'.  I
  can put `#if __BOUNDED_POINTERS__' around that part if desired... ]

--- /3/gnu/libc/ASM-i386-pc-linux-gnu/string/strspn.dis	Mon Jun 26 13:07:39 2000
+++ /3/gnu/libc-bp/ASM-i386-pc-linux-gnu/string/strspn.dis	Mon Jun 26 13:07:42 2000
@@ -105,6 +105,6 @@
   a2:	40                   	inc    %eax
   a3:	40                   	inc    %eax
   a4:	40                   	inc    %eax
-  a5:	29 d0                	sub    %edx,%eax
-  a7:	81 c4 00 01 00 00    	add    $0x100,%esp
+  a5:	81 c4 00 01 00 00    	add    $0x100,%esp
+  ab:	29 d0                	sub    %edx,%eax
   ad:	c3                   	ret    
--- /3/gnu/libc/ASM-i386-pc-linux-gnu/string/strcspn.dis	Mon Jun 26 13:07:39 2000
+++ /3/gnu/libc-bp/ASM-i386-pc-linux-gnu/string/strcspn.dis	Mon Jun 26 13:07:42 2000
@@ -105,6 +105,6 @@
   a2:	40                   	inc    %eax
   a3:	40                   	inc    %eax
   a4:	40                   	inc    %eax
-  a5:	29 d0                	sub    %edx,%eax
-  a7:	81 c4 00 01 00 00    	add    $0x100,%esp
+  a5:	81 c4 00 01 00 00    	add    $0x100,%esp
+  ab:	29 d0                	sub    %edx,%eax
   ad:	c3                   	ret    

[ Pop stopset space earlier so that argument-offset constants
  (notably DEST) are valid. ]

	i686:

--- /3/gnu/libc/ASM-i686-pc-linux-gnu/string/strcmp.dis	Mon Jun 26 13:08:16 2000
+++ /3/gnu/libc-bp/ASM-i686-pc-linux-gnu/string/strcmp.dis	Mon Jun 26 13:08:18 2000
@@ -7,9 +7,9 @@
    0:	8b 4c 24 04          	mov    0x4(%esp,1),%ecx
    4:	8b 54 24 08          	mov    0x8(%esp,1),%edx
    8:	8a 01                	mov    (%ecx),%al
-   a:	41                   	inc    %ecx
-   b:	3a 02                	cmp    (%edx),%al
-   d:	75 09                	jne    18 <strcmp+0x18>
+   a:	3a 02                	cmp    (%edx),%al
+   c:	75 0a                	jne    18 <strcmp+0x18>
+   e:	41                   	inc    %ecx
    f:	42                   	inc    %edx
   10:	84 c0                	test   %al,%al
   12:	75 f4                	jne    8 <strcmp+0x8>

[ Increment %ecx alongside %edx so that the pointers stay in sync for
  later high-bound check.  This has some impact on insn scheduling. ]

All other objects are identical.

------------------------------------------------------------------------------

2000-06-26  Greg McGary  <greg@mcgary.org>

	* 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.

Index: sysdeps/i386/add_n.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/add_n.S,v
retrieving revision 1.10
diff -u -p -r1.10 add_n.S
--- add_n.S	2000/06/09 06:14:38	1.10
+++ add_n.S	2000/06/26 21:39:33
@@ -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 */
@@ -29,7 +30,7 @@
 #define SIZE	S2+PTR_SIZE
 
 	.text
-ENTRY(__mpn_add_n)
+ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl %edi
@@ -39,7 +40,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
@@ -103,4 +110,4 @@ L(oop):	movl	(%esi),%eax
 
 	LEAVE
 	ret
-END(__mpn_add_n)
+END (BP_SYM (__mpn_add_n))
Index: sysdeps/i386/addmul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/addmul_1.S,v
retrieving revision 1.9
diff -u -p -r1.9 addmul_1.S
--- addmul_1.S	2000/06/26 18:20:42	1.9
+++ addmul_1.S	2000/06/26 21:39:33
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16	/* space for 4 saved regs */
@@ -34,7 +35,7 @@
 #define s2_limb ebx
 
 	.text
-ENTRY(__mpn_addmul_1)
+ENTRY (BP_SYM (__mpn_addmul_1))
 	ENTER
 
 	pushl	%edi
@@ -46,7 +47,13 @@ ENTRY(__mpn_addmul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %sizeP
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %sizeP	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
+	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %sizeP)
+	shrl	$2, %sizeP
+#endif
 	leal	(%res_ptr,%sizeP,4), %res_ptr
 	leal	(%s1_ptr,%sizeP,4), %s1_ptr
 	negl	%sizeP
@@ -72,4 +79,4 @@ L(oop):
 
 	LEAVE
 	ret
-END(__mpn_addmul_1)
+END (BP_SYM (__mpn_addmul_1))
Index: sysdeps/i386/lshift.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/lshift.S,v
retrieving revision 1.8
diff -u -p -r1.8 lshift.S
--- lshift.S	2000/06/09 06:14:39	1.8
+++ lshift.S	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+12		/* space for 3 saved regs */
@@ -28,7 +29,7 @@
 #define CNT	SIZE+4
 
 	.text
-ENTRY(__mpn_lshift)
+ENTRY (BP_SYM (__mpn_lshift))
 	ENTER
 
 	pushl	%edi
@@ -39,7 +40,12 @@ ENTRY(__mpn_lshift)
 	movl	S(%esp),%esi
 	movl	SIZE(%esp),%edx
 	movl	CNT(%esp),%ecx
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %edx		/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%edi, RES(%esp), %edx)
+	CHECK_BOUNDS_BOTH_WIDE (%esi, S(%esp), %edx)
+	shrl	$2, %edx
+#endif
 	subl	$4,%esi			/* adjust s_ptr */
 
 	movl	(%esi,%edx,4),%ebx	/* read most significant limb */
@@ -84,4 +90,4 @@ L(end):	shll	%cl,%ebx		/* compute least 
 
 	LEAVE
 	ret
-END(__mpn_lshift)
+END (BP_SYM (__mpn_lshift))
Index: sysdeps/i386/memchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/memchr.S,v
retrieving revision 1.7
diff -u -p -r1.7 memchr.S
--- memchr.S	2000/06/09 06:14:39	1.7
+++ memchr.S	2000/06/26 21:39:33
@@ -32,6 +32,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 */
@@ -41,7 +42,7 @@
 #define LEN	CHR+4
 
 	.text
-ENTRY (memchr)
+ENTRY (BP_SYM (memchr))
 	ENTER
 
 	/* Save callee-safe registers used in this function.  */
@@ -52,6 +53,7 @@ ENTRY (memchr)
 	movl STR(%esp), %eax	/* str: pointer to memory block.  */
 	movl CHR(%esp), %edx	/* c: byte we are looking for.  */
 	movl LEN(%esp), %esi	/* len: length of memory block.  */
+	CHECK_BOUNDS_BOTH_WIDE (%eax, STR(%esp), %esi)
 
 	/* If my must not test more than three characters test
 	   them one by one.  This is especially true for 0.  */
@@ -310,10 +312,17 @@ L(8):	testb %cl, %cl		/* test first byte
 	incl %eax		/* increment source pointer */
 
 	/* No further test needed we we know it is one of the four bytes.  */
-
-L(9):	popl %edi		/* pop saved registers */
+L(9):
+#if __BOUNDED_POINTERS__
+	/* If RTN pointer is phony, don't copy return value into it.  */
+	movl RTN(%esp), %ecx
+	testl %ecx, %ecx
+	jz L(pop)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+#endif
+L(pop):	popl %edi		/* pop saved registers */
 	popl %esi
 
 	LEAVE
 	RET_PTR
-END (memchr)
+END (BP_SYM (memchr))
Index: sysdeps/i386/memcmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/memcmp.S,v
retrieving revision 1.7
diff -u -p -r1.7 memcmp.S
--- memcmp.S	2000/06/09 06:14:39	1.7
+++ memcmp.S	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4	/* space for 1 saved reg */
@@ -27,7 +28,7 @@
 #define LEN	BLK2+PTR_SIZE
 
 	.text
-ENTRY (memcmp)
+ENTRY (BP_SYM (memcmp))
 	ENTER
 
 	pushl %esi		/* Save callee-safe registers.  */
@@ -37,6 +38,8 @@ ENTRY (memcmp)
 	movl BLK1(%esp), %esi
 	movl BLK2(%esp), %edi
 	movl LEN(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%esi, BLK1(%esp), %ecx)
+	CHECK_BOUNDS_BOTH_WIDE (%edi, BLK2(%esp), %ecx)
 
 	cld			/* Set direction of comparison.  */
 
@@ -64,7 +67,7 @@ L(1):	popl %esi		/* Restore registers.  
 
 	LEAVE
 	ret
-END (memcmp)
+END (BP_SYM (memcmp))
 
 #undef bcmp
-weak_alias (memcmp, bcmp)
+weak_alias (BP_SYM (memcmp), BP_SYM (bcmp))
Index: sysdeps/i386/mul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/mul_1.S,v
retrieving revision 1.7
diff -u -p -r1.7 mul_1.S
--- mul_1.S	2000/06/26 18:20:42	1.7
+++ mul_1.S	2000/06/26 21:39:33
@@ -20,6 +20,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16	/* space for 4 saved regs */
@@ -34,7 +35,7 @@
 #define s2_limb ebx
 
 	.text
-ENTRY(__mpn_mul_1)
+ENTRY (BP_SYM (__mpn_mul_1))
 	ENTER
 
 	pushl	%edi
@@ -46,7 +47,13 @@ ENTRY(__mpn_mul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %size	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
+	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %size)
+	shrl	$2, %size
+#endif
 	leal	(%res_ptr,%size,4), %res_ptr
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
@@ -72,4 +79,4 @@ L(oop):
 	LEAVE
 	ret
 #undef size
-END(__mpn_mul_1)
+END (BP_SYM (__mpn_mul_1))
Index: sysdeps/i386/rawmemchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/rawmemchr.S,v
retrieving revision 1.2
diff -u -p -r1.2 rawmemchr.S
--- rawmemchr.S	2000/06/09 06:14:39	1.2
+++ rawmemchr.S	2000/06/26 21:39:33
@@ -31,6 +31,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4	/* space for 1 saved reg */
@@ -39,7 +40,7 @@
 #define CHR	STR+PTR_SIZE
 
 	.text
-ENTRY (__rawmemchr)
+ENTRY (BP_SYM (__rawmemchr))
 	ENTER
 
 	/* Save callee-safe register used in this function.  */
@@ -48,6 +49,7 @@ ENTRY (__rawmemchr)
 	/* Load parameters into registers.  */
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
+	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	/* At the moment %edx contains C.  What we need for the
 	   algorithm is C in all bytes of the dword.  Avoid
@@ -213,9 +215,13 @@ L(8):	testb %cl, %cl		/* test first byte
 
 	/* No further test needed we we know it is one of the four bytes.  */
 
-L(9):	popl %edi		/* pop saved register */
+L(9):
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+	popl %edi		/* pop saved register */
 
 	LEAVE
-	ret
-END (__rawmemchr)
-weak_alias (__rawmemchr, rawmemchr)
+	RET_PTR
+END (BP_SYM (__rawmemchr))
+
+weak_alias (BP_SYM (__rawmemchr), BP_SYM (rawmemchr))
Index: sysdeps/i386/rshift.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/rshift.S,v
retrieving revision 1.8
diff -u -p -r1.8 rshift.S
--- rshift.S	2000/06/09 06:14:39	1.8
+++ rshift.S	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+12		/* space for 3 saved regs */
@@ -28,7 +29,7 @@
 #define CNT	SIZE+4
 
 	.text
-ENTRY(__mpn_rshift)
+ENTRY (BP_SYM (__mpn_rshift))
 	ENTER
 
 	pushl	%edi
@@ -39,7 +40,12 @@ ENTRY(__mpn_rshift)
 	movl	S(%esp),%esi
 	movl	SIZE(%esp),%edx
 	movl	CNT(%esp),%ecx
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %edx		/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%edi, RES(%esp), %edx)
+	CHECK_BOUNDS_BOTH_WIDE (%esi, S(%esp), %edx)
+	shrl	$2, %edx
+#endif
 	leal	-4(%edi,%edx,4),%edi
 	leal	(%esi,%edx,4),%esi
 	negl	%edx
@@ -86,4 +92,4 @@ L(end):	shrl	%cl,%ebx		/* compute most s
 
 	LEAVE
 	ret
-END(__mpn_rshift)
+END (BP_SYM (__mpn_rshift))
Index: sysdeps/i386/stpcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/stpcpy.S,v
retrieving revision 1.6
diff -u -p -r1.6 stpcpy.S
--- stpcpy.S	2000/06/09 06:14:39	1.6
+++ stpcpy.S	2000/06/26 21:39:33
@@ -24,6 +24,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE		/* no space for saved regs */
@@ -32,11 +33,13 @@
 #define SRC	DEST+PTR_SIZE
 
 	.text
-ENTRY (__stpcpy)
+ENTRY (BP_SYM (__stpcpy))
 	ENTER
 
 	movl DEST(%esp), %eax
 	movl SRC(%esp), %ecx
+	CHECK_BOUNDS_LOW (%eax, DEST(%esp))
+	CHECK_BOUNDS_LOW (%ecx, SRC(%esp))
 	subl %eax, %ecx		/* magic: reduce number of loop variants
 				   to one using addressing mode */
 
@@ -82,9 +85,11 @@ L(1):	addl $4, %eax		/* increment loop c
 L(4):	incl %eax
 L(3):	incl %eax
 L(2):
+	CHECK_BOUNDS_HIGH (%eax, DEST(%esp), jb)
+	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	LEAVE
 	RET_PTR
-END (__stpcpy)
+END (BP_SYM (__stpcpy))
 
-weak_alias (__stpcpy, stpcpy)
+weak_alias (BP_SYM (__stpcpy), BP_SYM (stpcpy))
Index: sysdeps/i386/stpncpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/stpncpy.S,v
retrieving revision 1.6
diff -u -p -r1.6 stpncpy.S
--- stpncpy.S	2000/06/09 06:14:39	1.6
+++ stpncpy.S	2000/06/26 21:39:33
@@ -26,6 +26,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4	/* space for 1 saved reg */
@@ -35,7 +36,7 @@
 #define LEN	SRC+PTR_SIZE
 
 	.text
-ENTRY (__stpncpy)
+ENTRY (BP_SYM (__stpncpy))
 	ENTER
 
 	pushl %esi
@@ -43,6 +44,8 @@ ENTRY (__stpncpy)
 	movl DEST(%esp), %eax
 	movl SRC(%esp), %esi
 	movl LEN(%esp), %ecx
+	CHECK_BOUNDS_LOW (%eax, DEST(%esp))
+	CHECK_BOUNDS_LOW (%esi, SRC(%esp))
 
 	subl %eax, %esi		/* magic: reduce number of loop variants
 				   to one using addressing mode */
@@ -137,10 +140,17 @@ L(8):
 L(3):	decl %ecx		/* all bytes written? */
 	jnz L(8)		/* no, then again */
 
-L(9):	popl %esi		/* restore saved register content */
+L(9):
+#if __BOUNDED_POINTERS__
+	addl %eax, %esi		/* undo magic: %esi now points beyond end of SRC */
+	CHECK_BOUNDS_HIGH (%esi, SRC(%esp), jb)
+	CHECK_BOUNDS_HIGH (%eax, DEST(%esp), jb)
+	RETURN_BOUNDED_POINTER (DEST(%esp))
+#endif
+	popl %esi		/* restore saved register content */
 
 	LEAVE
 	RET_PTR
-END (__stpncpy)
+END (BP_SYM (__stpncpy))
 
-weak_alias (__stpncpy, stpncpy)
+weak_alias (BP_SYM (__stpncpy), BP_SYM (stpncpy))
Index: sysdeps/i386/strchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strchr.S,v
retrieving revision 1.9
diff -u -p -r1.9 strchr.S
--- strchr.S	2000/06/09 06:14:39	1.9
+++ strchr.S	2000/06/26 21:39:33
@@ -22,6 +22,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4		/* space for 1 saved reg */
@@ -30,12 +31,13 @@
 #define CHR	STR+PTR_SIZE
 
 	.text
-ENTRY (strchr)
+ENTRY (BP_SYM (strchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
+	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	/* At the moment %edx contains C.  What we need for the
 	   algorithm is C in all bytes of the dword.  Avoid
@@ -239,7 +241,8 @@ L(11):	movl (%eax), %ecx	/* get word (= 
 	jz L(1)			/* no NUL found => restart loop */
 
 L(2):	/* Return NULL.  */
-	xorl %eax, %eax		/* load NULL in return value register */
+	xorl %eax, %eax
+	RETURN_NULL_BOUNDED_POINTER
 	popl %edi		/* restore saved register content */
 
 	LEAVE
@@ -274,10 +277,13 @@ L(7):	testb %cl, %cl		/* is first byte C
 	/* It must be in the fourth byte and it cannot be NUL.  */
 	incl %eax
 
-L(6):	popl %edi		/* restore saved register content */
+L(6):
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+	popl %edi		/* restore saved register content */
 
 	LEAVE
 	RET_PTR
-END (strchr)
+END (BP_SYM (strchr))
 
-weak_alias (strchr, index)
+weak_alias (BP_SYM (strchr), BP_SYM (index))
Index: sysdeps/i386/strchrnul.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strchrnul.S,v
retrieving revision 1.4
diff -u -p -r1.4 strchrnul.S
--- strchrnul.S	2000/06/09 06:14:39	1.4
+++ strchrnul.S	2000/06/26 21:39:33
@@ -23,6 +23,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4	/* space for 1 saved reg */
@@ -31,13 +32,14 @@
 #define CHR	STR+PTR_SIZE
 
 	.text
-ENTRY (__strchrnul)
+ENTRY (BP_SYM (__strchrnul))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
 
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
+	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	/* At the moment %edx contains CHR.  What we need for the
 	   algorithm is CHR in all bytes of the dword.  Avoid
@@ -269,10 +271,12 @@ L(7):	testb %cl, %cl		/* is first byte C
 	/* It must be in the fourth byte and it cannot be NUL.  */
 	incl %eax
 
-L(6):	popl %edi		/* restore saved register content */
+L(6):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+	popl %edi		/* restore saved register content */
 
 	LEAVE
 	RET_PTR
-END (__strchrnul)
+END (BP_SYM (__strchrnul))
 
-weak_alias (__strchrnul, strchrnul)
+weak_alias (BP_SYM (__strchrnul), BP_SYM (strchrnul))
Index: sysdeps/i386/strcspn.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strcspn.S,v
retrieving revision 1.6
diff -u -p -r1.6 strcspn.S
--- strcspn.S	2000/06/09 06:14:39	1.6
+++ strcspn.S	2000/06/26 21:39:33
@@ -23,6 +23,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,11 +31,12 @@
 #define STOP	STR+PTR_SIZE
 
 	.text
-ENTRY (strcspn)
+ENTRY (BP_SYM (strcspn))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl STOP(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
 
 	/* First we create a table with flags for all possible characters.
 	   For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
@@ -169,11 +171,11 @@ L(3):	addl $4, %eax		/* adjust pointer f
 L(6):	incl %eax
 L(5):	incl %eax
 
-L(4):	subl %edx, %eax		/* we have to return the number of valid
+L(4):	addl $256, %esp		/* remove stopset */
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
 				   non-valid character */
-	addl $256, %esp		/* remove stopset */
-
 	LEAVE
 	ret
-END (strcspn)
+END (BP_SYM (strcspn))
Index: sysdeps/i386/strpbrk.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strpbrk.S,v
retrieving revision 1.5
diff -u -p -r1.5 strpbrk.S
--- strpbrk.S	2000/06/09 06:14:39	1.5
+++ strpbrk.S	2000/06/26 21:39:33
@@ -23,6 +23,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE		/* no space for saved regs */
@@ -31,11 +32,12 @@
 #define STOP	STR+PTR_SIZE
 
 	.text
-ENTRY (strpbrk)
+ENTRY (BP_SYM (strpbrk))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl STOP(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
 
 	/* First we create a table with flags for all possible characters.
 	   For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
@@ -172,10 +174,17 @@ L(5):	incl %eax
 
 L(4):	addl $256, %esp		/* remove stopset */
 
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	orb %cl, %cl		/* was last character NUL? */
-	jnz L(7)			/* no => return pointer */
-	xorl %eax, %eax		/* return NULL */
+	jnz L(7)		/* no => return pointer */
+	xorl %eax, %eax
+	RETURN_NULL_BOUNDED_POINTER
 
-L(7):	LEAVE
+	LEAVE
 	RET_PTR
-END (strpbrk)
+
+L(7):	RETURN_BOUNDED_POINTER (STR(%esp))
+
+	LEAVE
+	RET_PTR
+END (BP_SYM (strpbrk))
Index: sysdeps/i386/strrchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strrchr.S,v
retrieving revision 1.8
diff -u -p -r1.8 strrchr.S
--- strrchr.S	2000/06/09 06:14:39	1.8
+++ strrchr.S	2000/06/26 21:39:33
@@ -22,6 +22,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 */
@@ -30,7 +31,7 @@
 #define CHR	STR+PTR_SIZE
 
 	.text
-ENTRY (strrchr)
+ENTRY (BP_SYM (strrchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
@@ -39,6 +40,7 @@ ENTRY (strrchr)
 	xorl %eax, %eax
 	movl STR(%esp), %esi
 	movl CHR(%esp), %ecx
+	CHECK_BOUNDS_LOW (%esi, STR(%esp))
 
 	/* At the moment %ecx contains C.  What we need for the
 	   algorithm is C in all bytes of the dword.  Avoid
@@ -319,11 +321,13 @@ L(26):	testb %dl, %dl		/* is third byte 
 	jne L(2)		/* no => skip */
 	leal 3(%esi), %eax	/* store address as result */
 
-L(2):	popl %esi		/* restore saved register content */
+L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+	popl %esi		/* restore saved register content */
 	popl %edi
 
 	LEAVE
 	RET_PTR
-END (strrchr)
+END (BP_SYM (strrchr))
 
-weak_alias (strrchr, rindex)
+weak_alias (BP_SYM (strrchr), BP_SYM (rindex))
Index: sysdeps/i386/strspn.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strspn.S,v
retrieving revision 1.6
diff -u -p -r1.6 strspn.S
--- strspn.S	2000/06/09 06:14:39	1.6
+++ strspn.S	2000/06/26 21:39:33
@@ -23,6 +23,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,11 +31,12 @@
 #define SKIP	STR+PTR_SIZE
 
 	.text
-ENTRY (strspn)
+ENTRY (BP_SYM (strspn))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl SKIP(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
 
 	/* First we create a table with flags for all possible characters.
 	   For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
@@ -169,11 +171,11 @@ L(3):	addl $4, %eax		/* adjust pointer f
 L(6):	incl %eax
 L(5):	incl %eax
 
-L(4):	subl %edx, %eax		/* we have to return the number of valid
+L(4):	addl $256, %esp		/* remove stopset */
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
 				   non-valid character */
-	addl $256, %esp		/* remove stopset */
-
 	LEAVE
 	ret
-END (strspn)
+END (BP_SYM (strspn))
Index: sysdeps/i386/strtok.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strtok.S,v
retrieving revision 1.8
diff -u -p -r1.8 strtok.S
--- strtok.S	2000/06/09 06:14:39	1.8
+++ strtok.S	2000/06/26 21:39:33
@@ -21,6 +21,7 @@
 
 #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:
@@ -56,12 +57,13 @@ save_ptr:
 #define SAVE	DELIM+PTR_SIZE
 
 	.text
-
-ENTRY (FUNCTION)
+ENTRY (BP_SYM (FUNCTION))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl DELIM(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
+	CHECK_BOUNDS_LOW (%eax, DELIM(%esp))
 
 #if !defined (USE_AS_STRTOK_R) && defined (PIC)
 	pushl %ebx			/* Save PIC register.  */
@@ -169,17 +171,17 @@ L(0):
 
 L(2):	movb (%eax), %cl	/* get byte from stopset */
 	testb %cl, %cl		/* is NUL char? */
-	jz L(1)			/* yes => start compare loop */
+	jz L(1_1)		/* yes => start compare loop */
 	movb %cl, (%esp,%ecx)	/* set corresponding byte in stopset table */
 
 	movb 1(%eax), %cl	/* get byte from stopset */
 	testb $0xff, %cl	/* is NUL char? */
-	jz L(1)			/* yes => start compare loop */
+	jz L(1_2)		/* yes => start compare loop */
 	movb %cl, (%esp,%ecx)	/* set corresponding byte in stopset table */
 
 	movb 2(%eax), %cl	/* get byte from stopset */
 	testb $0xff, %cl	/* is NUL char? */
-	jz L(1)			/* yes => start compare loop */
+	jz L(1_3)		/* yes => start compare loop */
 	movb %cl, (%esp,%ecx)	/* set corresponding byte in stopset table */
 
 	movb 3(%eax), %cl	/* get byte from stopset */
@@ -188,7 +190,16 @@ L(2):	movb (%eax), %cl	/* get byte from 
 	testb $0xff, %cl	/* is NUL char? */
 	jnz L(2)		/* no => process next dword from stopset */
 
-L(1):	leal -4(%edx), %eax	/* prepare loop */
+#if __BOUNDED_POINTERS__
+	jmp L(1_0)		/* pointer is correct for bounds check */
+L(1_3):	incl %eax		/* adjust pointer for bounds check */
+L(1_2):	incl %eax		/* ditto */
+L(1_1):	incl %eax		/* ditto */
+L(1_0):	CHECK_BOUNDS_HIGH (%eax, DELIM(%esp), jb)
+#else
+L(1_3):; L(1_2):; L(1_1):	/* fall through */
+#endif
+	leal -4(%edx), %eax	/* prepare loop */
 
 	/* We use a neat trick for the following loop.  Normally we would
 	   have to test for two termination conditions
@@ -275,10 +286,19 @@ L(return):
 	popl %ebx
 # endif
 #endif
+#if __BOUNDED_POINTERS__
+	testl %eax, %eax
+	jz L(ret)
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+L(ret):
+#endif
 	LEAVE
 	RET_PTR
 
 L(returnNULL):
 	xorl %eax, %eax
+	RETURN_NULL_BOUNDED_POINTER
 	jmp L(return)
-END (FUNCTION)
+
+END (BP_SYM (FUNCTION))
Index: sysdeps/i386/strtok_r.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/strtok_r.S,v
retrieving revision 1.2
diff -u -p -r1.2 strtok_r.S
--- strtok_r.S	1998/03/19 14:30:05	1.2
+++ strtok_r.S	2000/06/26 21:39:33
@@ -1,4 +1,4 @@
 #define FUNCTION __strtok_r
 #define USE_AS_STRTOK_R	1
 #include <sysdeps/i386/strtok.S>
-weak_alias (__strtok_r, strtok_r)
+weak_alias (BP_SYM (__strtok_r), BP_SYM (strtok_r))
Index: sysdeps/i386/sub_n.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/sub_n.S,v
retrieving revision 1.10
diff -u -p -r1.10 sub_n.S
--- sub_n.S	2000/06/09 06:14:39	1.10
+++ sub_n.S	2000/06/26 21:39:33
@@ -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 */
@@ -29,7 +30,7 @@
 #define SIZE	S2+PTR_SIZE
 
 	.text
-ENTRY(__mpn_sub_n)
+ENTRY (BP_SYM (__mpn_sub_n))
 	ENTER
 
 	pushl %edi
@@ -39,7 +40,13 @@ ENTRY(__mpn_sub_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
@@ -103,4 +110,4 @@ L(oop):	movl	(%esi),%eax
 
 	LEAVE
 	ret
-END(__mpn_sub_n)
+END (BP_SYM (__mpn_sub_n))
Index: sysdeps/i386/submul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/submul_1.S,v
retrieving revision 1.9
diff -u -p -r1.9 submul_1.S
--- submul_1.S	2000/06/26 18:20:42	1.9
+++ submul_1.S	2000/06/26 21:39:33
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16	/* space for 4 saved regs */
@@ -34,7 +35,7 @@
 #define s2_limb ebx
 
 	.text
-ENTRY(__mpn_submul_1)
+ENTRY (BP_SYM (__mpn_submul_1))
 	ENTER
 
 	pushl	%edi
@@ -46,7 +47,13 @@ ENTRY(__mpn_submul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %sizeP
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %sizeP	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
+	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %sizeP)
+	shrl	$2, %sizeP
+#endif
 	leal	(%res_ptr,%sizeP,4), %res_ptr
 	leal	(%s1_ptr,%sizeP,4), %s1_ptr
 	negl	%sizeP
@@ -72,4 +79,4 @@ L(oop):
 
 	LEAVE
 	ret
-END(__mpn_submul_1)
+END (BP_SYM (__mpn_submul_1))
Index: sysdeps/i386/fpu/fegetenv.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/fegetenv.c,v
retrieving revision 1.3
diff -u -p -r1.3 fegetenv.c
--- fegetenv.c	2000/02/26 01:09:38	1.3
+++ fegetenv.c	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fenv.h>
+#include <bp-sym.h>
 
 int
 __fegetenv (fenv_t *envp)
@@ -29,5 +30,5 @@ __fegetenv (fenv_t *envp)
   return 0;
 }
 strong_alias (__fegetenv, __old_fegetenv)
-symbol_version (__old_fegetenv, fegetenv, GLIBC_2.1);
-default_symbol_version (__fegetenv, fegetenv, GLIBC_2.2);
+symbol_version (BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2.1);
+default_symbol_version (BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2.2);
Index: sysdeps/i386/fpu/fesetenv.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/fesetenv.c,v
retrieving revision 1.7
diff -u -p -r1.7 fesetenv.c
--- fesetenv.c	2000/02/26 01:09:38	1.7
+++ fesetenv.c	2000/06/26 21:39:33
@@ -19,8 +19,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fenv.h>
-
 #include <assert.h>
+#include <bp-sym.h>
 
 
 int
@@ -78,5 +78,5 @@ __fesetenv (const fenv_t *envp)
   return 0;
 }
 strong_alias (__fesetenv, __old_fesetenv)
-symbol_version (__old_fesetenv, fesetenv, GLIBC_2.1);
-default_symbol_version (__fesetenv, fesetenv, GLIBC_2.2);
+symbol_version (BP_SYM (__old_fesetenv), BP_SYM (fesetenv), GLIBC_2.1);
+default_symbol_version (BP_SYM (__fesetenv), BP_SYM (fesetenv), GLIBC_2.2);
Index: sysdeps/i386/fpu/feupdateenv.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/feupdateenv.c,v
retrieving revision 1.3
diff -u -p -r1.3 feupdateenv.c
--- feupdateenv.c	2000/02/26 01:09:38	1.3
+++ feupdateenv.c	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fenv.h>
+#include <bp-sym.h>
 
 int
 __feupdateenv (const fenv_t *envp)
@@ -41,5 +42,5 @@ __feupdateenv (const fenv_t *envp)
   return 0;
 }
 strong_alias (__feupdateenv, __old_feupdateenv)
-symbol_version (__old_feupdateenv, feupdateenv, GLIBC_2.1);
-default_symbol_version (__feupdateenv, feupdateenv, GLIBC_2.2);
+symbol_version (BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2.1);
+default_symbol_version (BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2.2);
Index: sysdeps/i386/fpu/fgetexcptflg.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/fgetexcptflg.c,v
retrieving revision 1.3
diff -u -p -r1.3 fgetexcptflg.c
--- fgetexcptflg.c	2000/02/26 01:09:38	1.3
+++ fgetexcptflg.c	2000/06/26 21:39:33
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fenv.h>
+#include <bp-sym.h>
 
 int
 __fegetexceptflag (fexcept_t *flagp, int excepts)
@@ -34,5 +35,5 @@ __fegetexceptflag (fexcept_t *flagp, int
   return 0;
 }
 strong_alias (__fegetexceptflag, __old_fegetexceptflag)
-symbol_version (__old_fegetexceptflag, fegetexceptflag, GLIBC_2.1);
-default_symbol_version (__fegetexceptflag, fegetexceptflag, GLIBC_2.2);
+symbol_version (BP_SYM (__old_fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2.1);
+default_symbol_version (BP_SYM (__fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2.2);
Index: sysdeps/i386/fpu/fsetexcptflg.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/fsetexcptflg.c,v
retrieving revision 1.4
diff -u -p -r1.4 fsetexcptflg.c
--- fsetexcptflg.c	2000/02/26 01:09:38	1.4
+++ fsetexcptflg.c	2000/06/26 21:39:33
@@ -20,6 +20,7 @@
 
 #include <fenv.h>
 #include <math.h>
+#include <bp-sym.h>
 
 int
 __fesetexceptflag (const fexcept_t *flagp, int excepts)
@@ -42,5 +43,5 @@ __fesetexceptflag (const fexcept_t *flag
   return 0;
 }
 strong_alias (__fesetexceptflag, __old_fesetexceptflag)
-symbol_version (__old_fesetexceptflag, fesetexceptflag, GLIBC_2.1);
-default_symbol_version (__fesetexceptflag, fesetexceptflag, GLIBC_2.2);
+symbol_version (BP_SYM (__old_fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2.1);
+default_symbol_version (BP_SYM (__fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2.2);
Index: sysdeps/i386/i486/strcat.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i486/strcat.S,v
retrieving revision 1.7
diff -u -p -r1.7 strcat.S
--- strcat.S	2000/06/09 06:14:39	1.7
+++ strcat.S	2000/06/26 21:39:33
@@ -22,6 +22,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+4	/* space for 1 saved reg */
@@ -30,13 +31,15 @@
 #define SRC	DEST+PTR_SIZE
 
 	.text
-ENTRY (strcat)
+ENTRY (BP_SYM (strcat))
 	ENTER
 
 	pushl %edi		/* Save callee-safe register.  */
 
 	movl DEST(%esp), %edx
 	movl SRC(%esp), %ecx
+	CHECK_BOUNDS_LOW (%edx, DEST(%esp))
+	CHECK_BOUNDS_LOW (%ecx, SRC(%esp))
 
 	testb $0xff, (%ecx)	/* Is source string empty? */
 	jz L(8)			/* yes => return */
@@ -256,9 +259,11 @@ L(9):	movb %al, (%ecx,%edx)	/* store fir
 
 	movb %ah, 3(%ecx,%edx)	/* store fourth byte of last word */
 
-L(8):	movl DEST(%esp), %eax	/* start address of destination is result */
+L(8):	/* GKM FIXME: check high bounds */
+	movl DEST(%esp), %eax	/* start address of destination is result */
+	RETURN_BOUNDED_POINTER (DEST(%esp))
 	popl %edi		/* restore saved register */
 
 	LEAVE
 	RET_PTR
-END (strcat)
+END (BP_SYM (strcat))
Index: sysdeps/i386/i486/strlen.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i486/strlen.S,v
retrieving revision 1.5
diff -u -p -r1.5 strlen.S
--- strlen.S	2000/06/09 06:14:39	1.5
+++ strlen.S	2000/06/26 21:39:33
@@ -21,16 +21,18 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE		/* no space for saved regs */
 #define STR	PARMS
 
 	.text
-ENTRY (strlen)
+ENTRY (BP_SYM (strlen))
 	ENTER
 
 	movl STR(%esp), %ecx
+	CHECK_BOUNDS_LOW (%ecx, STR(%esp))
 	movl %ecx, %eax		/* duplicate it */
 
 	andl $3, %ecx		/* mask alignment bits */
@@ -128,8 +130,9 @@ L(3):	testb %cl, %cl		/* is first byte N
 	jz L(2)			/* yes => return pointer */
 	incl %eax		/* increment pointer */
 
-L(2):	subl STR(%esp), %eax	/* compute difference to string start */
+L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl STR(%esp), %eax	/* compute difference to string start */
 
 	LEAVE
 	ret
-END (strlen)
+END (BP_SYM (strlen))
Index: sysdeps/i386/i586/add_n.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/add_n.S,v
retrieving revision 1.8
diff -u -p -r1.8 add_n.S
--- add_n.S	2000/06/26 18:20:42	1.8
+++ add_n.S	2000/06/26 21:39:33
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16		/* space for 4 saved regs */
@@ -29,7 +30,7 @@
 #define SIZE	S2+PTR_SIZE
 
 	.text
-ENTRY(__mpn_add_n)
+ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl	%edi
@@ -41,7 +42,13 @@ ENTRY(__mpn_add_n)
 	movl	S1(%esp),%esi
 	movl	S2(%esp),%ebx
 	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 (%ebx, S2(%esp), %ecx)
+	shrl	$2, %ecx
+#endif
 	movl	(%ebx),%ebp
 
 	decl	%ecx
@@ -127,4 +134,4 @@ L(end2):
 
 	LEAVE
 	ret
-END(__mpn_add_n)
+END (BP_SYM (__mpn_add_n))
Index: sysdeps/i386/i586/addmul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/addmul_1.S,v
retrieving revision 1.8
diff -u -p -r1.8 addmul_1.S
--- addmul_1.S	2000/06/26 18:20:42	1.8
+++ addmul_1.S	2000/06/26 21:39:33
@@ -46,7 +46,13 @@ ENTRY(__mpn_addmul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %size	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
+	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %size)
+	shrl	$2, %size
+#endif
 	leal	(%res_ptr,%size,4), %res_ptr
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
Index: sysdeps/i386/i586/bzero.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/bzero.S,v
retrieving revision 1.2
diff -u -p -r1.2 bzero.S
--- bzero.S	1997/09/16 00:40:06	1.2
+++ bzero.S	2000/06/26 21:39:33
@@ -1,3 +1,3 @@
 #define memset __bzero
 #include <sysdeps/i386/i586/memset.S>
-weak_alias (__bzero, bzero)
+weak_alias (BP_SYM (__bzero), BP_SYM (bzero))
Index: sysdeps/i386/i586/lshift.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/lshift.S,v
retrieving revision 1.8
diff -u -p -r1.8 lshift.S
--- lshift.S	2000/06/26 18:20:42	1.8
+++ lshift.S	2000/06/26 21:39:34
@@ -19,6 +19,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16		/* space for 4 saved regs */
@@ -28,7 +29,7 @@
 #define CNT	SIZE+4
 
 	.text
-ENTRY(__mpn_lshift)
+ENTRY (BP_SYM (__mpn_lshift))
 	ENTER
 
 	pushl	%edi
@@ -40,6 +41,12 @@ ENTRY(__mpn_lshift)
 	movl	S(%esp),%esi
 	movl	SIZE(%esp),%ebx
 	movl	CNT(%esp),%ecx
+#if __BOUNDED_POINTERS__
+	shll	$2, %ebx		/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%edi, RES(%esp), %ebx)
+	CHECK_BOUNDS_BOTH_WIDE (%esi, S(%esp), %ebx)
+	shrl	$2, %ebx
+#endif
 
 /* We can use faster code for shift-by-1 under certain conditions.  */
 	cmp	$1,%ecx
@@ -222,4 +229,4 @@ L(L1):	movl	%edx,(%edi)		/* store last l
 
 	LEAVE
 	ret
-END(__mpn_lshift)
+END (BP_SYM (__mpn_lshift))
Index: sysdeps/i386/i586/memcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/memcpy.S,v
retrieving revision 1.3
diff -u -p -r1.3 memcpy.S
--- memcpy.S	2000/06/26 00:37:46	1.3
+++ memcpy.S	2000/06/26 21:39:34
@@ -20,6 +20,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 /* BEWARE: `#ifdef memcpy' means that memcpy is redefined as `mempcpy',
@@ -34,7 +35,7 @@
 #define LEN	SRC+PTR_SIZE
 
         .text
-ENTRY (memcpy)
+ENTRY (BP_SYM (memcpy))
 	ENTER
 
 	pushl	%edi
@@ -43,6 +44,8 @@ ENTRY (memcpy)
 	movl	DEST(%esp), %edi
 	movl	SRC(%esp), %esi
 	movl	LEN(%esp), %ecx
+	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
+	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
 	movl	%edi, %eax
 
 	/* We need this in any case.  */
@@ -112,4 +115,4 @@ L(1):	rep; movsb
 
 	LEAVE
 	RET_PTR
-END (memcpy)
+END (BP_SYM (memcpy))
Index: sysdeps/i386/i586/mempcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/mempcpy.S,v
retrieving revision 1.1
diff -u -p -r1.1 mempcpy.S
--- mempcpy.S	1997/11/11 23:38:36	1.1
+++ mempcpy.S	2000/06/26 21:39:34
@@ -1,4 +1,4 @@
 #define memcpy __mempcpy
 #include <sysdeps/i386/i586/memcpy.S>
 
-weak_alias (__mempcpy, mempcpy)
+weak_alias (BP_SYM (__mempcpy), BP_SYM (mempcpy))
Index: sysdeps/i386/i586/memset.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/memset.S,v
retrieving revision 1.6
diff -u -p -r1.6 memset.S
--- memset.S	2000/06/09 06:14:39	1.6
+++ memset.S	2000/06/26 21:39:34
@@ -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' */
@@ -37,18 +38,18 @@
 #endif
 
         .text
-ENTRY (memset)
+ENTRY (BP_SYM (memset))
 	ENTER
 
 	pushl	%edi
 
 	movl	DEST(%esp), %edi
 	movl	LEN(%esp), %edx
+	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %edx)
 #if BZERO_P
 	xorl	%eax, %eax	/* we fill with 0 */
 #else
 	movb	CHR(%esp), %al
-
 	movb	%al, %ah
 	movl	%eax, %ecx
 	shll	$16, %eax
@@ -101,7 +102,8 @@ L(2):	shrl	$2, %ecx	/* convert byte coun
 
 #if !BZERO_P
 	/* Load result (only if used as memset).  */
-	movl	DEST(%esp), %eax
+	movl DEST(%esp), %eax	/* start address of destination is result */
+	RETURN_BOUNDED_POINTER (DEST(%esp))
 #endif
 	popl	%edi
 
@@ -111,4 +113,4 @@ L(2):	shrl	$2, %ecx	/* convert byte coun
 #else
 	RET_PTR
 #endif
-END (memset)
+END (BP_SYM (memset))
Index: sysdeps/i386/i586/rshift.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/rshift.S,v
retrieving revision 1.8
diff -u -p -r1.8 rshift.S
--- rshift.S	2000/06/26 18:20:42	1.8
+++ rshift.S	2000/06/26 21:39:34
@@ -19,6 +19,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16		/* space for 4 saved regs */
@@ -28,7 +29,7 @@
 #define CNT	SIZE+4
 
 	.text
-ENTRY(__mpn_rshift)
+ENTRY (BP_SYM (__mpn_rshift))
 	ENTER
 
 	pushl	%edi
@@ -40,6 +41,12 @@ ENTRY(__mpn_rshift)
 	movl	S(%esp),%esi
 	movl	SIZE(%esp),%ebx
 	movl	CNT(%esp),%ecx
+#if __BOUNDED_POINTERS__
+	shll	$2, %ebx		/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%edi, RES(%esp), %ebx)
+	CHECK_BOUNDS_BOTH_WIDE (%esi, S(%esp), %ebx)
+	shrl	$2, %ebx
+#endif
 
 /* We can use faster code for shift-by-1 under certain conditions.  */
 	cmp	$1,%ecx
@@ -222,4 +229,4 @@ L(L1):	movl	%edx,(%edi)		/* store last l
 
 	LEAVE
 	ret
-END(__mpn_rshift)
+END (BP_SYM (__mpn_rshift))
Index: sysdeps/i386/i586/strchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/strchr.S,v
retrieving revision 1.9
diff -u -p -r1.9 strchr.S
--- strchr.S	2000/06/09 06:14:39	1.9
+++ strchr.S	2000/06/26 21:39:34
@@ -21,6 +21,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 /* This version is especially optimized for the i586 (and following?)
@@ -42,7 +43,7 @@
 #define CHR	STR+PTR_SIZE
 
 	.text
-ENTRY (strchr)
+ENTRY (BP_SYM (strchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers.  */
@@ -53,6 +54,7 @@ ENTRY (strchr)
 
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
+	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	movl %eax, %edi		/* duplicate string pointer for later */
 	xorl %ecx, %ecx		/* clear %ecx */
@@ -279,7 +281,9 @@ L(5):	subl $4, %eax		/* adjust pointer *
 
 	incl %eax		/* increment pointer */
 
-L(2):	popl %ebp		/* restore saved registers */
+L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	RETURN_BOUNDED_POINTER (STR(%esp))
+	popl %ebp		/* restore saved registers */
 	popl %ebx
 
 	popl %esi
@@ -320,9 +324,9 @@ L(4):	subl $4, %eax		/* adjust pointer *
 	/* The test four the fourth byte is necessary!  */
 	cmpb %dl, %ch		/* fourth byte == C? */
 	je L(2)			/* yes => return pointer */
-
-L(3):	xorl %eax, %eax		/* set return value = NULL */
 
+L(3):	xorl %eax, %eax
+	RETURN_NULL_BOUNDED_POINTER
 	popl %ebp		/* restore saved registers */
 	popl %ebx
 
@@ -331,7 +335,7 @@ L(3):	xorl %eax, %eax		/* set return val
 
 	LEAVE
 	RET_PTR
-END (strchr)
+END (BP_SYM (strchr))
 
 #undef index
-weak_alias (strchr, index)
+weak_alias (BP_SYM (strchr), BP_SYM (index))
Index: sysdeps/i386/i586/strcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/strcpy.S,v
retrieving revision 1.2
diff -u -p -r1.2 strcpy.S
--- strcpy.S	2000/06/09 06:14:39	1.2
+++ strcpy.S	2000/06/26 21:39:34
@@ -20,6 +20,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+12	/* space for 3 saved regs */
@@ -34,7 +35,7 @@
 #define magic 0xfefefeff
 
 	.text
-ENTRY(STRCPY)
+ENTRY (BP_SYM (STRCPY))
 	ENTER
 
 	pushl	%edi
@@ -43,6 +44,8 @@ ENTRY(STRCPY)
 
 	movl	DEST(%esp), %edi
 	movl	SRC(%esp), %esi
+	CHECK_BOUNDS_LOW (%edi, DEST(%esp))
+	CHECK_BOUNDS_LOW (%esi, SRC(%esp))
 
 	xorl	%eax, %eax
 	leal	-1(%esi), %ecx
@@ -142,15 +145,17 @@ L(4):	movb	%dl, (%edi)
 L(end):	movb	%ah, (%edi)
 
 L(end2):
+	/* GKM FIXME: check high bounds  */
 #ifdef USE_AS_STPCPY
 	movl	%edi, %eax
 #else
 	movl	DEST(%esp), %eax
 #endif
+	RETURN_BOUNDED_POINTER (DEST(%esp))
 	popl	%ebx
 	popl	%esi
 	popl	%edi
 
 	LEAVE
 	RET_PTR
-END(STRCPY)
+END (BP_SYM (STRCPY))
Index: sysdeps/i386/i586/strlen.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/strlen.S,v
retrieving revision 1.9
diff -u -p -r1.9 strlen.S
--- strlen.S	2000/06/09 06:14:39	1.9
+++ strlen.S	2000/06/26 21:39:34
@@ -21,6 +21,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 /* This version is especially optimized for the i586 (and following?)
@@ -40,10 +41,11 @@
 #define STR	PARMS
 
 	.text
-ENTRY(strlen)
+ENTRY (BP_SYM (strlen))
 	ENTER
 
 	movl STR(%esp), %eax
+	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 	movl $3, %edx		/* load mask (= 3) */
 
 	andl %eax, %edx		/* separate last two bits of address */
@@ -177,9 +179,10 @@ L(3):	subl $4, %eax		/* correct too earl
 
 	incl %eax		/* increment pointer */
 
-L(2):	subl STR(%esp), %eax	/* now compute the length as difference
+L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl STR(%esp), %eax	/* now compute the length as difference
 				   between start and terminating NUL
 				   character */
 	LEAVE
 	ret
-END (strlen)
+END (BP_SYM (strlen))
Index: sysdeps/i386/i586/sub_n.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/sub_n.S,v
retrieving revision 1.8
diff -u -p -r1.8 sub_n.S
--- sub_n.S	2000/06/26 18:20:42	1.8
+++ sub_n.S	2000/06/26 21:39:34
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16		/* space for 4 saved regs */
@@ -29,7 +30,7 @@
 #define SIZE	S2+PTR_SIZE
 
 	.text
-ENTRY(__mpn_sub_n)
+ENTRY (BP_SYM (__mpn_sub_n))
 	ENTER
 
 	pushl	%edi
@@ -41,7 +42,13 @@ ENTRY(__mpn_sub_n)
 	movl	S1(%esp),%esi
 	movl	S2(%esp),%ebx
 	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 (%ebx, S2(%esp), %ecx)
+	shrl	$2, %ecx
+#endif
 	movl	(%ebx),%ebp
 
 	decl	%ecx
@@ -127,4 +134,4 @@ L(end2):
 
 	LEAVE
 	ret
-END(__mpn_sub_n)
+END (BP_SYM (__mpn_sub_n))
Index: sysdeps/i386/i686/add_n.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/add_n.S,v
retrieving revision 1.2
diff -u -p -r1.2 add_n.S
--- add_n.S	2000/06/09 06:14:39	1.2
+++ add_n.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/bzero.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/bzero.S,v
retrieving revision 1.1
diff -u -p -r1.1 bzero.S
--- bzero.S	1999/01/07 17:57:34	1.1
+++ bzero.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/memcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/memcpy.S,v
retrieving revision 1.2
diff -u -p -r1.2 memcpy.S
--- memcpy.S	2000/06/09 06:14:39	1.2
+++ memcpy.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/mempcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/mempcpy.S,v
retrieving revision 1.3
diff -u -p -r1.3 mempcpy.S
--- mempcpy.S	2000/06/09 06:14:39	1.3
+++ mempcpy.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/memset.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/memset.S,v
retrieving revision 1.3
diff -u -p -r1.3 memset.S
--- memset.S	2000/06/09 06:14:39	1.3
+++ memset.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/strcmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/strcmp.S,v
retrieving revision 1.2
diff -u -p -r1.2 strcmp.S
--- strcmp.S	2000/06/09 06:14:39	1.2
+++ strcmp.S	2000/06/26 21:39:34
@@ -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))
Index: sysdeps/i386/i686/strtok.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/strtok.S,v
retrieving revision 1.3
diff -u -p -r1.3 strtok.S
--- strtok.S	1998/12/31 18:11:12	1.3
+++ strtok.S	2000/06/26 21:39:34
@@ -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,8 +57,15 @@ 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.  */
 	call 0b
@@ -226,4 +235,4 @@ L(return):
 L(returnNULL):
 	xorl %eax, %eax
 	jmp L(return)
-END (FUNCTION)
+END (BP_SYM (FUNCTION))
Index: sysdeps/i386/i686/strtok_r.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i686/strtok_r.S,v
retrieving revision 1.1
diff -u -p -r1.1 strtok_r.S
--- strtok_r.S	1998/04/02 17:41:45	1.1
+++ strtok_r.S	2000/06/26 21:39:34
@@ -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))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]