This is the mail archive of the libc-hacker@sources.redhat.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]
Other format: [Raw text]

[PATCH] Fix tst-getpid{1,2} on ppc64


Hi!

Seems ppc64 is not restoring r2 and so crashes when _exit is called
with bogus toc register.  I haven't tested this patch yet, but
will do RSN, certainly if tst-getpid1.c is modified to call _exit (1)
resp. _exit (0) instead of return {1,0}, it succeeds (well, I have one day
old glibc, so fails with wrong signal value, but the child doesn't crash).

2004-12-15  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone): Save
	and restore r2 around call to fn.

--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S.jj	2004-12-15 12:21:04.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S	2004-12-15 12:26:22.049075256 +0100
@@ -104,12 +104,14 @@ L(nomoregetpid):
 L(oldpid):
 #endif
 
+	std	r2,40(r1)
 	/* Call procedure.  */
 	ld	r0,0(r29)
 	ld	r2,8(r29)
 	mtctr	r0
 	mr	r3,r31
 	bctrl
+	ld	r2,40(r1)
 	/* Call _exit with result from procedure.  */
 #ifdef SHARED
 	b	JUMPTARGET(__GI__exit)

	Jakub


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