about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-09 19:35:21 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-09 19:35:21 +0000
commit148e12ed122d75506937cdc8ab2654f8449f2061 (patch)
tree74e26dbc976cabefc08145aeac3d3a373ea54470 /sysdeps
parent71edcafa976a9716a3a848a93c29763e4a3c3002 (diff)
downloadglibc-148e12ed122d75506937cdc8ab2654f8449f2061.tar.gz
glibc-148e12ed122d75506937cdc8ab2654f8449f2061.tar.xz
glibc-148e12ed122d75506937cdc8ab2654f8449f2061.zip
* sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext): Avoid
	clobbering memory at or above uc_stack.ss_sp + uc_stack.ss_size.
	* stdlib/Makefile: Add rules to build and run tst-makecontext2.
	* stdlib/tst-makecontext2.c: New test.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S10
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 89be1176f7..ad2340555a 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -41,13 +41,15 @@ ENTRY(__makecontext)
 	movl	12(%esp), %ecx
 	movl	%ecx, oEBX(%eax)
 
-	/* Make room on the new stack for the parameters.  */
+	/* Make room on the new stack for the parameters.
+	   Room for the arguments, return address (== L(exitcode)) and
+	   oLINK pointer is needed.  One of the pointer sizes is subtracted
+	   after aligning the stack.  */
 	negl	%ecx
-	leal	-8(%edx,%ecx,4), %edx
+	leal	-4(%edx,%ecx,4), %edx
 	negl	%ecx
 
 	/* Align the stack.  */
-	addl	$16, %edx
 	andl	$0xfffffff0, %edx
 	subl	$4, %edx