Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/hppa/sys Save and restore %r19 the "linkage ta...



details:   https://anonhg.NetBSD.org/src/rev/5dbdcc6f3e96
branches:  trunk
changeset: 366663:5dbdcc6f3e96
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Jun 06 06:32:44 2022 +0000

description:
Save and restore %r19 the "linkage table pointer register" across the call
to __cerror so if the ptrace syscall fails we can call __cerror again with
the correct %r19 value.

Do this even though the call of __cerror doesn't go via the PLT because
__cerror calls __errno which does.

Analysis and fix from Tom Lane in

port-hppa/56864: hppa: ptrace(2) dumps core when returning an error

I changed the location of where %r19 is stored on the stack to follow the
ABI.

diffstat:

 lib/libc/arch/hppa/sys/ptrace.S |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 4af5c7ac6539 -r 5dbdcc6f3e96 lib/libc/arch/hppa/sys/ptrace.S
--- a/lib/libc/arch/hppa/sys/ptrace.S   Mon Jun 06 02:16:37 2022 +0000
+++ b/lib/libc/arch/hppa/sys/ptrace.S   Mon Jun 06 06:32:44 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.S,v 1.7 2020/05/09 08:25:33 skrll Exp $ */
+/*     $NetBSD: ptrace.S,v 1.8 2022/06/06 06:32:44 skrll Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,10 +42,12 @@
        stw     %arg1, HPPA_FRAME_ARG(1)(%sp)
        stw     %arg2, HPPA_FRAME_ARG(2)(%sp)
        stw     %arg3, HPPA_FRAME_ARG(3)(%sp)
+       stw     %r19, HPPA_FRAME_EDP(%sp)
        ldo     HPPA_FRAME_SIZE(%sp),%sp
        bl      __cerror, %rp
         copy   %r0, %t1
        ldo     -HPPA_FRAME_SIZE(%sp), %sp
+       ldw     HPPA_FRAME_EDP(%sp), %r19
        ldw     HPPA_FRAME_ARG(0)(%sp), %arg0
        ldw     HPPA_FRAME_ARG(1)(%sp), %arg1
        ldw     HPPA_FRAME_ARG(2)(%sp), %arg2



Home | Main Index | Thread Index | Old Index