Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix regression introduced to ptrace_regs() in rev 1...
details: https://anonhg.NetBSD.org/src/rev/b6ea964167cf
branches: trunk
changeset: 1004951:b6ea964167cf
user: rin <rin%NetBSD.org@localhost>
date: Fri Nov 22 05:01:44 2019 +0000
description:
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 90c1c9e8d70a -r b6ea964167cf sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Fri Nov 22 01:52:20 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c Fri Nov 22 05:01:44 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.72 2019/11/17 02:22:14 rin Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.73 2019/11/22 05:01:44 rin 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.72 2019/11/17 02:22:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.73 2019/11/22 05:01:44 rin 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