This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Community source repository for glibc add-on ports branch, master, updated. glibc-2.12-11-g3680f14


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Community source repository for glibc add-on ports".

The branch, master has been updated
       via  3680f14a7d12a9faa86e09aaea1b3aa20713355e (commit)
      from  131fafa7dac6437fd6bb320bac49b0198825b192 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc-ports.git;a=commitdiff;h=3680f14a7d12a9faa86e09aaea1b3aa20713355e

commit 3680f14a7d12a9faa86e09aaea1b3aa20713355e
Author: Carlos O'Donell <carlos@systemhalted.org>
Date:   Thu Jun 24 12:13:36 2010 -0400

    [hppa] Fix incorrect stack frame usage in vfork.
    
    In a multithreaded environment the call to vfork was
    incorrectly creating a stack frame. Given that the
    child unwinds the stack frame first to call exec, it
    will corrupt any values the parent stored in the stack
    frame. The solution is to avoid creating a stack frame
    unless required to call an error function, in which case
    we are assured no child was created.

diff --git a/ChangeLog.hppa b/ChangeLog.hppa
index faad5e9..2ccc911 100644
--- a/ChangeLog.hppa
+++ b/ChangeLog.hppa
@@ -1,3 +1,9 @@
+2010-06-24  Carlos O'Donell  <carlos@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S: Only create stack 
+	frame around call to SYSCALL_ERROR_HANDLER. Do not restore %rp 
+	from the stack frame on successfull return.
+
 2010-06-23  Carlos O'Donell  <carlos@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext_ret):
diff --git a/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S b/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
index 83a70b7..15efa98 100644
--- a/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
+++ b/sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -50,10 +50,9 @@
 
 	/* r26, r25, r24, r23 are free since vfork has no arguments */
 ENTRY(__vfork)
-	/* Prologue */
-	stwm	%r3, 64(%sp)
-	stw	%sp, -4(%sp)
-	stw	%r19, -32(%sp)
+	/* We must not create a frame. When the child unwinds to call 
+	   exec it will clobber the same frame that the parent
+	   needs to unwind.  */
 
 	/* Save the PIC register. */
 #ifdef PIC
@@ -75,12 +74,20 @@ ENTRY(__vfork)
 	comclr,>>= %r1,%ret0,%r0        /* Note: unsigned compare. */
 	b,n	.Lerror
 
-	/* Return, no need to restore the PIC register. */
-	ldw	-84(%sp), %rp
-	bv	%r0(%rp)
-	ldwm	-64(%sp), %r3
+	/* Return, and DO NOT restore rp. The child may have called
+	   functions that updated the frame's rp. This works because
+	   the kernel ensures rp is preserved across the vfork 
+	   syscall.  */
+	bv,n	%r0(%rp)
 
 .Lerror:
+	/* Now we need a stack to call a function. We are assured
+	   that there is no child now, so it's safe to create
+	   a frame.  */
+	stw	%rp, -20(%sp)
+	stwm	%r3, 64(%sp)
+	stw	%sp, -4(%sp)
+
 	sub	%r0,%ret0,%r3
 	SYSCALL_ERROR_HANDLER
 	/* Restore the PIC register (in delay slot) on error */

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

Summary of changes:
 ChangeLog.hppa                               |    6 ++++++
 sysdeps/unix/sysv/linux/hppa/nptl/pt-vfork.S |   25 ++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
Community source repository for glibc add-on ports


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