Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Correct the rule to iterate over LWPs with PT_LWPNE...
details: https://anonhg.NetBSD.org/src/rev/1aa9c361449b
branches: trunk
changeset: 968121:1aa9c361449b
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Jan 03 00:37:29 2020 +0000
description:
Correct the rule to iterate over LWPs with PT_LWPNEXT and PT_LWPINFO
Correctly exclude dead/dying/zombie and system threads.
Fixes kern/54802 (gdb -p kills the kernel) by <martin>
diffstat:
sys/kern/sys_ptrace_common.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (39 lines):
diff -r ee221167b41a -r 1aa9c361449b sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Thu Jan 02 23:51:48 2020 +0000
+++ b/sys/kern/sys_ptrace_common.c Fri Jan 03 00:37:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.76 2019/12/26 08:52:38 kamil Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.77 2020/01/03 00:37:29 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.76 2019/12/26 08:52:38 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.77 2020/01/03 00:37:29 kamil Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -757,7 +757,8 @@
*lt = LIST_NEXT(*lt, l_sibling);
}
- while (*lt != NULL && !lwp_alive(*lt))
+ while (*lt != NULL && (!lwp_alive(*lt) ||
+ ((*lt)->l_flag & LW_SYSTEM) != 0))
*lt = LIST_NEXT(*lt, l_sibling);
pl.pl_lwpid = 0;
@@ -822,8 +823,8 @@
*lt = LIST_NEXT(*lt, l_sibling);
}
- while (*lt != NULL && !lwp_alive(*lt) &&
- ((*lt)->l_flag & LW_SYSTEM) != 0)
+ while (*lt != NULL && (!lwp_alive(*lt) ||
+ ((*lt)->l_flag & LW_SYSTEM) != 0))
*lt = LIST_NEXT(*lt, l_sibling);
if (*lt == NULL) {
Home |
Main Index |
Thread Index |
Old Index