Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/kern Pull up following revision(s) (requested by kami...
details: https://anonhg.NetBSD.org/src/rev/6be62540d645
branches: netbsd-8
changeset: 452701:6be62540d645
user: martin <martin%NetBSD.org@localhost>
date: Mon Jul 22 18:02:09 2019 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #1302):
sys/kern/sys_ptrace_common.c: revision 1.58
Enhance locking of ptrace_update_lwp
Replace lwp_delref() + mutex_enter() with: mutex_enter() + lwp_delref2().=
This avoids extra taking and exiting from a mutex.
Add missing mutex_exit() for LW_SYSTEM.
Do not switch lwp for PT_SET_SIGINFO. This operation is not needed and
avoids panic for >2 LWPs as p_lock is attempted to be entered again in a
critical section.
diffstat:
sys/kern/sys_ptrace_common.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diffs (48 lines):
diff -r 87a44bdcf8f8 -r 6be62540d645 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Mon Jul 22 17:53:35 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c Mon Jul 22 18:02:09 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.22.2.4 2018/11/29 14:58:25 martin Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.22.2.5 2019/07/22 18:02:09 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.22.2.4 2018/11/29 14:58:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.5 2019/07/22 18:02:09 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -527,9 +527,9 @@
if (lid == 0 || lid == (*lt)->l_lid || t->p_nlwps == 1)
return 0;
- lwp_delref(*lt);
+ mutex_enter(t->p_lock);
+ lwp_delref2(*lt);
- mutex_enter(t->p_lock);
*lt = lwp_find(t, lid);
if (*lt == NULL) {
mutex_exit(t->p_lock);
@@ -537,6 +537,7 @@
}
if ((*lt)->l_flag & LW_SYSTEM) {
+ mutex_exit(t->p_lock);
*lt = NULL;
return EINVAL;
}
@@ -574,9 +575,6 @@
if (psi.psi_siginfo.si_signo < 0 || psi.psi_siginfo.si_signo >= NSIG)
return EINVAL;
- if ((error = ptrace_update_lwp(t, lt, psi.psi_lwpid)) != 0)
- return error;
-
t->p_sigctx.ps_faked = true;
t->p_sigctx.ps_info = psi.psi_siginfo._info;
t->p_sigctx.ps_lwp = psi.psi_lwpid;
Home |
Main Index |
Thread Index |
Old Index