Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Remove pfind() and pgfind(), fix locking in various brok...
details: https://anonhg.NetBSD.org/src/rev/da7a3b7e3946
branches: trunk
changeset: 755972:da7a3b7e3946
user: rmind <rmind%NetBSD.org@localhost>
date: Thu Jul 01 02:38:26 2010 +0000
description:
Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().
COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.
Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).
Fixes PR/43176.
diffstat:
sys/arch/alpha/alpha/db_trace.c | 6 +-
sys/arch/amd64/amd64/db_trace.c | 6 +-
sys/arch/arm/arm/db_trace.c | 6 +-
sys/arch/hppa/hppa/db_trace.c | 6 +-
sys/arch/m68k/m68k/db_trace.c | 6 +-
sys/arch/mips/mips/db_trace.c | 6 +-
sys/arch/powerpc/powerpc/db_trace.c | 6 +-
sys/arch/sparc/sparc/db_trace.c | 6 +-
sys/arch/sparc64/sparc64/db_trace.c | 6 +-
sys/arch/vax/vax/db_machdep.c | 8 +-
sys/compat/darwin/darwin_sysctl.c | 14 +-
sys/compat/irix/irix_prctl.c | 44 +++-
sys/compat/irix/irix_syssgi.c | 20 +-
sys/compat/linux/arch/arm/linux_ptrace.c | 149 +++++++--------
sys/compat/linux/arch/i386/linux_ptrace.c | 233 ++++++++++++------------
sys/compat/linux/arch/powerpc/linux_ptrace.c | 244 +++++++++++++-------------
sys/compat/linux/common/linux_file.c | 12 +-
sys/compat/linux/common/linux_futex.c | 9 +-
sys/compat/linux/common/linux_sched.c | 38 ++-
sys/compat/linux/common/linux_signal.c | 6 +-
sys/compat/mach/mach_task.c | 42 ++-
sys/compat/sa/compat_sa.c | 9 +-
sys/compat/svr4/svr4_misc.c | 14 +-
sys/compat/svr4_32/svr4_32_misc.c | 25 +-
sys/dev/wscons/wsdisplay_compat_usl.c | 6 +-
sys/external/bsd/drm/dist/bsd-core/drm_irq.c | 7 +-
sys/kern/init_sysctl.c | 8 +-
sys/kern/kern_descrip.c | 33 ++-
sys/kern/kern_event.c | 6 +-
sys/kern/kern_exit.c | 8 +-
sys/kern/kern_ktrace.c | 8 +-
sys/kern/kern_lwp.c | 31 ++-
sys/kern/kern_proc.c | 98 +++++-----
sys/kern/kern_prot.c | 8 +-
sys/kern/kern_resource.c | 123 +++++++------
sys/kern/kern_sig.c | 6 +-
sys/kern/sys_process.c | 7 +-
sys/kern/sys_pset.c | 6 +-
sys/kern/sys_sched.c | 8 +-
sys/kern/sys_sig.c | 7 +-
sys/kern/tty.c | 22 +-
sys/miscfs/procfs/procfs_subr.c | 6 +-
sys/miscfs/procfs/procfs_vnops.c | 6 +-
sys/sys/proc.h | 18 +-
44 files changed, 715 insertions(+), 628 deletions(-)
diffs (truncated from 2889 to 300 lines):
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/alpha/alpha/db_trace.c
--- a/sys/arch/alpha/alpha/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/alpha/alpha/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.26 2009/11/21 05:35:40 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.27 2010/07/01 02:38:26 rmind Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.26 2009/11/21 05:35:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.27 2010/07/01 02:38:26 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -220,7 +220,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/amd64/amd64/db_trace.c
--- a/sys/arch/amd64/amd64/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/amd64/amd64/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.17 2009/11/21 03:11:01 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.18 2010/07/01 02:38:27 rmind Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.17 2009/11/21 03:11:01 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.18 2010/07/01 02:38:27 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -345,7 +345,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/arm/arm/db_trace.c
--- a/sys/arch/arm/arm/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/arm/arm/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.21 2009/11/21 20:32:17 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.22 2010/07/01 02:38:27 rmind Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -31,7 +31,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.21 2009/11/21 20:32:17 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.22 2010/07/01 02:38:27 rmind Exp $");
#include <sys/proc.h>
#include <arm/armreg.h>
@@ -115,7 +115,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/hppa/hppa/db_trace.c
--- a/sys/arch/hppa/hppa/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/hppa/hppa/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.8 2010/03/11 07:15:25 skrll Exp $ */
+/* $NetBSD: db_trace.c,v 1.9 2010/07/01 02:38:27 rmind Exp $ */
/* $OpenBSD: db_interface.c,v 1.16 2001/03/22 23:31:45 mickey Exp $ */
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.8 2010/03/11 07:15:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.9 2010/07/01 02:38:27 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -84,7 +84,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/m68k/m68k/db_trace.c
--- a/sys/arch/m68k/m68k/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/m68k/m68k/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.55 2009/11/23 00:11:44 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.56 2010/07/01 02:38:27 rmind Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55 2009/11/23 00:11:44 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.56 2010/07/01 02:38:27 rmind Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -436,7 +436,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/mips/mips/db_trace.c
--- a/sys/arch/mips/mips/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/mips/mips/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.38 2009/12/14 00:46:06 matt Exp $ */
+/* $NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.38 2009/12/14 00:46:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $");
#include "opt_ddb.h"
@@ -160,7 +160,7 @@
/* "trace/t" */
(*pr)("pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/powerpc/powerpc/db_trace.c
--- a/sys/arch/powerpc/powerpc/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/powerpc/powerpc/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.51 2010/02/25 23:31:48 matt Exp $ */
+/* $NetBSD: db_trace.c,v 1.52 2010/07/01 02:38:27 rmind Exp $ */
/* $OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.51 2010/02/25 23:31:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.52 2010/07/01 02:38:27 rmind Exp $");
#include "opt_ppcarch.h"
@@ -149,7 +149,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/sparc/sparc/db_trace.c
--- a/sys/arch/sparc/sparc/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/sparc/sparc/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.32 2009/11/21 04:16:51 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.33 2010/07/01 02:38:27 rmind Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.32 2009/11/21 04:16:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.33 2010/07/01 02:38:27 rmind Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -85,7 +85,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/sparc64/sparc64/db_trace.c
--- a/sys/arch/sparc64/sparc64/db_trace.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/sparc64/sparc64/db_trace.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.43 2009/11/21 04:16:52 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.44 2010/07/01 02:38:27 rmind Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.43 2009/11/21 04:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.44 2010/07/01 02:38:27 rmind Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -91,7 +91,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
- p = p_find(addr, PFIND_LOCKED);
+ p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/arch/vax/vax/db_machdep.c
--- a/sys/arch/vax/vax/db_machdep.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/arch/vax/vax/db_machdep.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.55 2010/06/09 02:48:52 mrg Exp $ */
+/* $NetBSD: db_machdep.c,v 1.56 2010/07/01 02:38:28 rmind Exp $ */
/*
* :set tabs=4
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.55 2010/06/09 02:48:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.56 2010/07/01 02:38:28 rmind Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -440,7 +440,7 @@
*/
if (have_addr) {
if (trace_proc) {
- p = p_find((int)addr, PFIND_LOCKED);
+ p = proc_find_raw((int)addr);
/* Try to be helpful by looking at it as if it were decimal */
if (p == NULL) {
u_int tpid = 0;
@@ -455,7 +455,7 @@
tpid = tpid * 10 + digit;
foo = foo << 4;
}
- p = p_find(tpid, PFIND_LOCKED);
+ p = proc_find_raw(tpid);
if (p == NULL) {
(*pr)(" No such process.\n");
return;
diff -r d5639b0ba8d5 -r da7a3b7e3946 sys/compat/darwin/darwin_sysctl.c
--- a/sys/compat/darwin/darwin_sysctl.c Thu Jul 01 00:42:51 2010 +0000
+++ b/sys/compat/darwin/darwin_sysctl.c Thu Jul 01 02:38:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: darwin_sysctl.c,v 1.62 2009/01/11 02:45:47 christos Exp $ */
+/* $NetBSD: darwin_sysctl.c,v 1.63 2010/07/01 02:38:28 rmind Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.62 2009/01/11 02:45:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.63 2010/07/01 02:38:28 rmind Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -897,13 +897,21 @@
char *arg;
char *tmp;
Home |
Main Index |
Thread Index |
Old Index