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 kami...
details: https://anonhg.NetBSD.org/src/rev/6b47736a0457
branches: netbsd-9
changeset: 963111:6b47736a0457
user: martin <martin%NetBSD.org@localhost>
date: Tue Oct 15 18:38:39 2019 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #313):
sys/kern/sys_ptrace_common.c: revision 1.60
Restore the old behavior in PT_GET_PROCESS_STATE
For !child and !lwp events return zeroed struct ptrace_state.
There is code that depends on it (GDB).
Fixes PR toolchain/54590 by martin@
diffstat:
sys/kern/sys_ptrace_common.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diffs (59 lines):
diff -r c07b34533a0d -r 6b47736a0457 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Tue Oct 15 18:34:34 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c Tue Oct 15 18:38:39 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.58.2.2 2019/10/15 18:32:13 martin Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 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.2 2019/10/15 18:32:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -688,6 +688,7 @@
static int
ptrace_get_process_state(struct proc *t, void *addr, size_t data)
{
+ struct _ksiginfo *si;
struct ptrace_state ps;
if (data != sizeof(ps)) {
@@ -698,20 +699,20 @@
if (t->p_sigctx.ps_info._signo != SIGTRAP ||
(t->p_sigctx.ps_info._code != TRAP_CHLD &&
t->p_sigctx.ps_info._code != TRAP_LWP)) {
- return EINVAL;
- }
-
- ps.pe_report_event =
- t->p_sigctx.ps_info._reason._ptrace_state._pe_report_event;
+ memset(&ps, 0, sizeof(ps));
+ } else {
+ si = &t->p_sigctx.ps_info;
+ ps.pe_report_event = si->_reason._ptrace_state._pe_report_event;
- CTASSERT(sizeof(ps.pe_other_pid) ==
- sizeof(t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid));
- CTASSERT(sizeof(ps.pe_lwp) ==
- sizeof(t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid));
- CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp));
+ CTASSERT(sizeof(ps.pe_other_pid) ==
+ sizeof(si->_reason._ptrace_state._option._pe_other_pid));
+ CTASSERT(sizeof(ps.pe_lwp) ==
+ sizeof(si->_reason._ptrace_state._option._pe_other_pid));
+ CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp));
- ps.pe_other_pid =
- t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid;
+ ps.pe_other_pid =
+ si->_reason._ptrace_state._option._pe_other_pid;
+ }
DPRINTF(("%s: lwp=%d event=%#x pid=%d lwp=%d\n", __func__,
t->p_sigctx.ps_lwp, ps.pe_report_event,
Home |
Main Index |
Thread Index |
Old Index