Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add two KASSERTS in the ptrace(2) kernel code
details: https://anonhg.NetBSD.org/src/rev/d174727a67b4
branches: trunk
changeset: 464360:d174727a67b4
user: kamil <kamil%NetBSD.org@localhost>
date: Thu Oct 03 23:11:11 2019 +0000
description:
Add two KASSERTS in the ptrace(2) kernel code
Verify that we will never return empty ptrace_state for CHILD/LWP event.
diffstat:
sys/kern/sys_ptrace_common.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 5ef264e57880 -r d174727a67b4 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Thu Oct 03 22:48:44 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c Thu Oct 03 23:11:11 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.62 2019/10/03 22:48:44 kamil Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.63 2019/10/03 23:11:11 kamil 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.62 2019/10/03 22:48:44 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.63 2019/10/03 23:11:11 kamil Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -702,6 +702,10 @@
memset(&ps, 0, sizeof(ps));
} else {
si = &t->p_sigctx.ps_info;
+
+ KASSERT(si->_reason._ptrace_state._pe_report_event > 0);
+ KASSERT(si->_reason._ptrace_state._option._pe_other_pid > 0);
+
ps.pe_report_event = si->_reason._ptrace_state._pe_report_event;
CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp));
Home |
Main Index |
Thread Index |
Old Index