CVS commit: src/lib/libc/arch/x86_64/sys

2020-10-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Oct 19 11:29:26 UTC 2020

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigtramp2.S

Log Message:
Restore RSP from mcontext

Fixes unwinding of multiple frames without base pointer.

Patch by: Nikhil Benesch via PR lib/55719


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/x86_64/sys/__sigtramp2.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/sys/__sigtramp2.S
diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.8 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.9
--- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.8	Mon Oct 12 17:55:54 2020
+++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S	Mon Oct 19 11:29:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.8 2020/10/12 17:55:54 kamil Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.9 2020/10/19 11:29:26 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -58,7 +58,7 @@
 	.cfi_offset rsi, UC_GREGS_RSI
 	.cfi_offset rdi, UC_GREGS_RDI
 	.cfi_offset rbp, UC_GREGS_RBP
-	/* The unwinder will use the CFA to restore RSP. */
+	.cfi_offset rsp, UC_GREGS_RSP
 	.cfi_offset r8,  UC_GREGS_R8
 	.cfi_offset r9,  UC_GREGS_R9
 	.cfi_offset r10, UC_GREGS_R10



CVS commit: src/lib/libc/arch/x86_64/sys

2019-12-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  2 01:38:54 UTC 2019

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigtramp2.S

Log Message:
Add cfi annotations so that gdb can unwind the stack through signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/sys/__sigtramp2.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/sys/__sigtramp2.S
diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.7
--- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6	Thu May 22 11:01:57 2014
+++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S	Sun Dec  1 20:38:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.6 2014/05/22 15:01:57 uebayasi Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.7 2019/12/02 01:38:54 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,10 +42,13 @@
  * the signal; the kernel calls the signal handler directly.
  */
 NENTRY(__sigtramp_siginfo_2)
+	.cfi_startproc
+	.cfi_def_cfa rsp, 8
 	movq	%r15,%rdi
 	movq	$SYS_setcontext, %rax
 	syscall
 	movq	$-1,%rdi /* if we return here, something is wrong */
 	movq	$SYS_exit, %rax
 	syscall
+	.cfi_endproc
 END(__sigtramp_siginfo_2)



CVS commit: src/lib/libc/arch/x86_64/sys

2014-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 24 15:33:18 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/sys: ptrace.S

Log Message:
Fix ptrace %rcx corruption when pthread_errno() is used. Small example:
#include sys/types.h
#include stdio.h
#include sys/ptrace.h
int main(void) { ptrace(18, getpid(), NULL, 0xabcd); }
The -lpthread cases pases 0 instead of 0xabcd


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/x86_64/sys/ptrace.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/sys/ptrace.S
diff -u src/lib/libc/arch/x86_64/sys/ptrace.S:1.5 src/lib/libc/arch/x86_64/sys/ptrace.S:1.6
--- src/lib/libc/arch/x86_64/sys/ptrace.S:1.5	Thu May 22 11:01:57 2014
+++ src/lib/libc/arch/x86_64/sys/ptrace.S	Mon Nov 24 10:33:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.S,v 1.5 2014/05/22 15:01:57 uebayasi Exp $	*/
+/*	$NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: ptrace.S,v 1.5 2014/05/22 15:01:57 uebayasi Exp $)
+	RCSID($NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
@@ -44,12 +44,21 @@
 	.globl	_C_LABEL(__errno)
 
 ENTRY(ptrace)
+	/*
+	 * The following code calls __errno() to set it to 0 before
+	 * calling ptrace(2). The libc version of __errno() does not use
+	 * any registers, but the libpthread version clobbers %rcx
+	 * before we get a chance to store it in %r10. So we save it
+	 * in %r10 and restore it.
+	 */
+	movq	%rcx, %r10
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__errno))
 #else
 	call	_C_LABEL(__errno)
 #endif /* __PIC__ */
 	movl	$0,(%rax)
+	movq	%r10, %rcx
 	SYSTRAP(ptrace)
 	jc	err
 	ret



CVS commit: src/lib/libc/arch/x86_64/sys

2014-05-14 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed May 14 06:38:10 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigaction14_sigtramp.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c
diff -u src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10 src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.11
--- src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10	Mon Apr 28 20:22:58 2008
+++ src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c	Wed May 14 06:38:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $	*/
+/*	$NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $);
+__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -41,7 +41,7 @@ __RCSID($NetBSD: __sigaction14_sigtramp
 
 #include extern.h
 
- __weak_alias(__sigaction14, __libc_sigaction14)
+__weak_alias(__sigaction14, __libc_sigaction14)
 
 int
 __libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)



CVS commit: src/lib/libc/arch/x86_64/sys

2011-11-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 18 20:17:46 UTC 2011

Modified Files:
src/lib/libc/arch/x86_64/sys: cerror.S

Log Message:
Explicitly mark __cerror as hidden


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/sys/cerror.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/x86_64/sys/cerror.S
diff -u src/lib/libc/arch/x86_64/sys/cerror.S:1.3 src/lib/libc/arch/x86_64/sys/cerror.S:1.4
--- src/lib/libc/arch/x86_64/sys/cerror.S:1.3	Thu Aug  7 16:42:37 2003
+++ src/lib/libc/arch/x86_64/sys/cerror.S	Fri Nov 18 20:17:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $	*/
+/*	$NetBSD: cerror.S,v 1.4 2011/11/18 20:17:46 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,12 +36,13 @@
 
 #include machine/asm.h
 #if defined(SYSLIBC_SCCS)  !defined(lint)
-	RCSID($NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $)
+	RCSID($NetBSD: cerror.S,v 1.4 2011/11/18 20:17:46 joerg Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 #include SYS.h
 
 	.globl	_C_LABEL(__errno)
+	.hidden	CERROR
 
 _ENTRY(CERROR)
 	pushq	%r12