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),@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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to