Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by rin ...



details:   https://anonhg.NetBSD.org/src/rev/3d0fcc0c6a9e
branches:  netbsd-9
changeset: 461361:3d0fcc0c6a9e
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 24 08:16:52 2019 +0000

description:
Pull up following revision(s) (requested by rin in ticket #465):

        sys/kern/sys_ptrace_common.c: revision 1.73

Fix regression introduced to ptrace_regs() in rev 1.27:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/sys_ptrace_common.c#rev1.27

Size of registers should be determined from tracer, NOT tracee.

Now, 64-bit tracer can manipulate registers of 32-bit tracee again.
gdb for amd64 works for i386 binaries to some extent.

XXX
pullup to netbsd-9 and -8.

diffstat:

 sys/kern/sys_ptrace_common.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (59 lines):

diff -r 26383b27e5ac -r 3d0fcc0c6a9e sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Sun Nov 24 08:13:07 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c      Sun Nov 24 08:16:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.58.2.11 2019/11/19 13:22:01 martin Exp $       */
+/*     $NetBSD: sys_ptrace_common.c,v 1.58.2.12 2019/11/24 08:16:52 martin Exp $       */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.11 2019/11/19 13:22:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.12 2019/11/24 08:16:52 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -831,9 +831,12 @@
     void *addr, size_t data)
 {
        int error;
-       struct proc *t = (*lt)->l_proc;
+       struct proc *p, *t;
        struct vmspace *vm;
 
+       p = l->l_proc;          /* tracer */
+       t = (*lt)->l_proc;      /* traced */
+
        if ((error = ptrace_update_lwp(t, lt, data)) != 0)
                return error;
 
@@ -849,7 +852,7 @@
        case_PT_SETREGS
                if (!process_validregs(*lt))
                        return EINVAL;
-               size = PROC_REGSZ(t);
+               size = PROC_REGSZ(p);
                func = ptm->ptm_doregs;
                break;
 #endif
@@ -858,7 +861,7 @@
        case_PT_SETFPREGS
                if (!process_validfpregs(*lt))
                        return EINVAL;
-               size = PROC_FPREGSZ(t);
+               size = PROC_FPREGSZ(p);
                func = ptm->ptm_dofpregs;
                break;
 #endif
@@ -867,7 +870,7 @@
        case_PT_SETDBREGS
                if (!process_validdbregs(*lt))
                        return EINVAL;
-               size = PROC_DBREGSZ(t);
+               size = PROC_DBREGSZ(p);
                func = ptm->ptm_dodbregs;
                break;
 #endif



Home | Main Index | Thread Index | Old Index