Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern the tracer, not the tracee determine if we are goin...
details: https://anonhg.NetBSD.org/src/rev/01ccb272118a
branches: trunk
changeset: 457432:01ccb272118a
user: christos <christos%NetBSD.org@localhost>
date: Mon Jun 24 20:29:41 2019 +0000
description:
the tracer, not the tracee determine if we are going to convert the ptrace
data from 64 to 32.
diffstat:
sys/kern/sys_ptrace_common.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diffs (63 lines):
diff -r 967f92a6da11 -r 01ccb272118a sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Mon Jun 24 18:48:08 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c Mon Jun 24 20:29:41 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.55 2019/06/11 23:18:55 kamil Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.56 2019/06/24 20:29:41 christos 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.55 2019/06/11 23:18:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.56 2019/06/24 20:29:41 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -1483,9 +1483,13 @@
regwfunc_t w;
#ifdef COMPAT_NETBSD32
- const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
+ const bool pk32 = (curl->l_proc->p_flag & PK_32) != 0;
if (__predict_false(pk32)) {
+ if ((l->l_proc->p_flag & PK_32) == 0) {
+ // 32 bit tracer can't trace 64 bit process
+ return EINVAL;
+ }
s = sizeof(process_reg32);
r = (regrfunc_t)process_read_regs32;
w = (regwfunc_t)process_write_regs32;
@@ -1524,9 +1528,13 @@
regwfunc_t w;
#ifdef COMPAT_NETBSD32
- const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
+ const bool pk32 = (curl->l_proc->p_flag & PK_32) != 0;
if (__predict_false(pk32)) {
+ if ((l->l_proc->p_flag & PK_32) == 0) {
+ // 32 bit tracer can't trace 64 bit process
+ return EINVAL;
+ }
s = sizeof(process_fpreg32);
r = (regrfunc_t)process_read_fpregs32;
w = (regwfunc_t)process_write_fpregs32;
@@ -1565,9 +1573,13 @@
regwfunc_t w;
#ifdef COMPAT_NETBSD32
- const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
+ const bool pk32 = (curl->l_proc->p_flag & PK_32) != 0;
if (__predict_false(pk32)) {
+ if ((l->l_proc->p_flag & PK_32) == 0) {
+ // 32 bit tracer can't trace 64 bit process
+ return EINVAL;
+ }
s = sizeof(process_dbreg32);
r = (regrfunc_t)process_read_dbregs32;
w = (regwfunc_t)process_write_dbregs32;
Home |
Main Index |
Thread Index |
Old Index