svn commit: r304931 - head/lib/libc/amd64/sys
Konstantin Belousov
kib at FreeBSD.org
Sun Aug 28 00:26:07 UTC 2016
Author: kib
Date: Sun Aug 28 00:26:06 2016
New Revision: 304931
URL: https://svnweb.freebsd.org/changeset/base/304931
Log:
Follow ABI when calling __error from the ptrace(2) wrapper.
In particular, preserve syscall arguments on stack, since callee is
not required to preserve arg-passing registers. Align stack.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/lib/libc/amd64/sys/ptrace.S
Modified: head/lib/libc/amd64/sys/ptrace.S
==============================================================================
--- head/lib/libc/amd64/sys/ptrace.S Sun Aug 28 00:21:24 2016 (r304930)
+++ head/lib/libc/amd64/sys/ptrace.S Sun Aug 28 00:26:06 2016 (r304931)
@@ -42,11 +42,21 @@ __FBSDID("$FreeBSD$");
.type CNAME(__error), at function
ENTRY(ptrace)
+ pushq %rdi /* align stack */
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
#ifdef PIC
callq PIC_PLT(CNAME(__error))
#else
callq CNAME(__error)
#endif
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ popq %rdi
movl $0,(%rax)
mov $SYS_ptrace,%eax
KERNCALL
More information about the svn-src-head
mailing list