summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2010-02-03 12:59:44 +0000
committerrrs <rrs@FreeBSD.org>2010-02-03 12:59:44 +0000
commitd0128a84c50db94e8efb99d95578f78e56a2f281 (patch)
treec1b471be585a198d2eb307672fba8a6d9851bc1b /lib
parentae135106517ff27079b2d0900337d161db755dc4 (diff)
downloadFreeBSD-src-d0128a84c50db94e8efb99d95578f78e56a2f281.zip
FreeBSD-src-d0128a84c50db94e8efb99d95578f78e56a2f281.tar.gz
This fixes a bug found and fixed by JC. Basically
no save was being done of the ra and gp pointers before we call the __error function. Obtained from: JC (c.jayachandran@gmail.com)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/mips/sys/ptrace.S14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libc/mips/sys/ptrace.S b/lib/libc/mips/sys/ptrace.S
index 86bc1e5..53ca78d 100644
--- a/lib/libc/mips/sys/ptrace.S
+++ b/lib/libc/mips/sys/ptrace.S
@@ -42,14 +42,26 @@ __FBSDID("$FreeBSD$");
#endif /* LIBC_SCCS and not lint */
LEAF(ptrace)
+ .frame sp,40,ra
+ .mask 0x80000000, -8
#ifdef __ABICALLS__
.set noreorder
.cpload t9
.set reorder
#endif
+ subu sp, sp, 40
+ sw ra, 32(sp)
+#ifdef __ABICALLS__
+ .cprestore 16
+#endif
la t9, _C_LABEL(__error) # locate address of errno
- jalr t9
+ jalr t9
+#ifdef __ABICALLS__
+ lw gp, 16(sp)
+#endif
sw zero, 0(v0)
+ lw ra, 32(sp)
+ addu sp, sp, 40
li v0, SYS_ptrace
syscall
bne a3, zero, 1f
OpenPOWER on IntegriCloud