Remove the filesystem tracing feature
This is a legacy interface from 4.4BSD, and it was introduced to overcome shortcomings of ptrace(2) at that time, which are no longer relevant (performance). Today /proc/#/ctl offers a narrow subset of ptrace(2) commands and is not applicable for modern applications use beyond simplistic tracing scenarios. This removal will simplify kernel internals. Users will still be able to use all the other /proc files. This change won't affect other procfs files neither Linux compat features within mount_procfs(8). /proc/#/ctl isn't available on Linux. Remove: - /proc/#/ctl from mount_procfs(8) - P_FSTRACE note from the documentation of ps(1) - /proc/#/ctl and filesystem tracing documentation from mount_procfs(8) - KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9) - source code file miscfs/procfs/procfs_ctl.c - PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h - KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h - PSL_FSTRACE (0x00010000) from sys/sys/proc.h - P_FSTRACE (0x00010000) from sys/sys/sysctl.h Reduce code complexity after removal of this functionality. Update TODO.ptrace accordingly: remove two entries about /proc tracing. Do not keep legacy notes as comments in the headers about removed PSL_FSTRACE / P_FSTRACE, as this interface had little number of users (close or equal to zero). Proposed on tech-kern@. All filesystem tracing utility users are encouraged to switch to ptrace(2). Sponsored by <The NetBSD Foundation>
This commit is contained in:
parent
0096e71993
commit
a69b333e73
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ps.1,v 1.107 2017/07/03 21:33:23 wiz Exp $
|
||||
.\" $NetBSD: ps.1,v 1.108 2017/08/28 00:46:06 kamil Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -308,7 +308,6 @@ the include file
|
||||
.It Dv "P_EXEC" Ta No "0x00004000 process called" Xr execve 2
|
||||
.It Dv "P_OWEUPC" Ta No "0x00008000 owe process an addupc() call at next ast"
|
||||
.\" the routine addupc is not documented in the man pages
|
||||
.It Dv "P_FSTRACE" Ta No "0x00010000 tracing via file system"
|
||||
.It Dv "P_NOCLDWAIT" Ta No "0x00020000 no zombies when children die"
|
||||
.It Dv "P_32" Ta No "0x00040000 32-bit process (used on 64-bit kernels)"
|
||||
.It Dv "P_BIGLOCK" Ta No "0x00080000 process needs kernel ``big lock'' to run"
|
||||
|
@ -1,4 +1,4 @@
|
||||
$NetBSD: TODO.ptrace,v 1.28 2017/04/08 01:08:36 kamil Exp $
|
||||
$NetBSD: TODO.ptrace,v 1.29 2017/08/28 00:46:07 kamil Exp $
|
||||
|
||||
Items we (currently) plan to finish in the ptrace(2) field:
|
||||
|
||||
@ -8,11 +8,6 @@ Items we (currently) plan to finish in the ptrace(2) field:
|
||||
- reiterate over FreeBSD tests and add missing ones if applicable
|
||||
- add PT_DUMPCORE tests in the ATF framework
|
||||
- add ATF tests for PT_WRITE_I and PIOD_WRITE_I - test mprotect restrictions
|
||||
- add tests for the procfs interface covering all functions available on the
|
||||
same level as ptrace(2)
|
||||
- remove 4.4BSD tracing with /proc, restrict /proc to Linux compat, to be
|
||||
superseded with kevent tracing, the original purpose of /proc debugging is
|
||||
long gone (performance issues with PT_WRITE_* and PT_READ_*)
|
||||
- research kevent support for tracing a process over a file descriptor,
|
||||
this means alternative to wait(2)-based events with passing events over the
|
||||
kqueue API - signal handlers are global per application and they clash with
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: mount_procfs.8,v 1.35 2017/07/03 21:33:41 wiz Exp $
|
||||
.\" $NetBSD: mount_procfs.8,v 1.36 2017/08/28 00:46:07 kamil Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1992, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -90,38 +90,6 @@ This file is readonly and returns null-terminated strings
|
||||
corresponding to the process' command line arguments.
|
||||
For a system or zombie process, this file contains only a string
|
||||
with the name of the process.
|
||||
.It Pa ctl
|
||||
a writeonly file which supports a variety of control operations.
|
||||
Control commands are written as strings to the
|
||||
.Pa ctl
|
||||
file.
|
||||
The control commands are:
|
||||
.Bl -tag -width detach -compact
|
||||
.It attach
|
||||
stops the target process and arranges for the sending
|
||||
process to become the debug control process.
|
||||
.It detach
|
||||
continue execution of the target process and
|
||||
remove it from control by the debug process.
|
||||
.It run
|
||||
continue running the target process until
|
||||
a signal is delivered, a breakpoint is hit, or the
|
||||
target process exits.
|
||||
.It step
|
||||
single step the target process, with no signal delivery.
|
||||
.It wait
|
||||
wait for the target process to stop.
|
||||
The target process must be stopped before
|
||||
any of the run, step, or signal commands are allowed.
|
||||
.El
|
||||
.Pp
|
||||
The string can also be the name of a signal, lower case
|
||||
and without the
|
||||
.Dv SIG
|
||||
prefix,
|
||||
in which case that signal is delivered to the process
|
||||
(see
|
||||
.Xr sigaction 2 ) .
|
||||
.It Pa cwd
|
||||
A symbolic link that points to the current working directory of the
|
||||
process.
|
||||
@ -226,29 +194,10 @@ is the effective group id)
|
||||
all comma separated.
|
||||
.El
|
||||
.El
|
||||
.Pp
|
||||
In a normal debugging environment,
|
||||
where the target is fork/exec'd by the debugger,
|
||||
the debugger should fork and the child should stop
|
||||
itself (with a self-inflicted
|
||||
.Dv SIGSTOP
|
||||
for example).
|
||||
The parent should issue a
|
||||
.Dv wait
|
||||
and then an
|
||||
.Dv attach
|
||||
command via the appropriate
|
||||
.Pa ctl
|
||||
file.
|
||||
The child process will receive a
|
||||
.Dv SIGTRAP
|
||||
immediately after the call to exec (see
|
||||
.Xr execve 2 ) .
|
||||
.Sh FILES
|
||||
.Bl -tag -width /proc/curproc -compact
|
||||
.It Pa /proc/#
|
||||
.It Pa /proc/#/cmdline
|
||||
.It Pa /proc/#/ctl
|
||||
.It Pa /proc/#/cwd
|
||||
.It Pa /proc/#/exe
|
||||
.It Pa /proc/#/file
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: kauth.9,v 1.108 2017/07/03 21:28:48 wiz Exp $
|
||||
.\" $NetBSD: kauth.9,v 1.109 2017/08/28 00:46:07 kamil Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
.\" All rights reserved.
|
||||
@ -553,7 +553,6 @@ is the
|
||||
for the target element in the target process, and
|
||||
.Ar arg2
|
||||
is the access type, which can be either
|
||||
.Dv KAUTH_REQ_PROCESS_PROCFS_CTL ,
|
||||
.Dv KAUTH_REQ_PROCESS_PROCFS_READ ,
|
||||
.Dv KAUTH_REQ_PROCESS_PROCFS_RW ,
|
||||
or
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ptrace.c,v 1.19 2015/10/13 08:24:35 pgoyette Exp $ */
|
||||
/* $NetBSD: linux_ptrace.c,v 1.20 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.19 2015/10/13 08:24:35 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.20 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
@ -157,8 +157,7 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
|
||||
* 3. It is not being traced by _you_, or
|
||||
* 4. It is not currently stopped.
|
||||
*/
|
||||
if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
|
||||
t->p_stat != SSTOP || !t->p_waited) {
|
||||
if (t->p_pptr != p || t->p_stat != SSTOP || !t->p_waited) {
|
||||
mutex_exit(t->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
error = EBUSY;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ptrace.c,v 1.31 2015/10/13 08:24:35 pgoyette Exp $ */
|
||||
/* $NetBSD: linux_ptrace.c,v 1.32 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.31 2015/10/13 08:24:35 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.32 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
@ -197,13 +197,10 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* 2. It is being traced by procfs (which has different signal
|
||||
* delivery semantics),
|
||||
* 3. It is not being traced by _you_, or
|
||||
* 4. It is not currently stopped.
|
||||
* 2. It is not being traced by _you_, or
|
||||
* 3. It is not currently stopped.
|
||||
*/
|
||||
if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
|
||||
t->p_stat != SSTOP || !t->p_waited) {
|
||||
if (t->p_pptr != p || t->p_stat != SSTOP || !t->p_waited) {
|
||||
mutex_exit(t->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
error = EBUSY;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_ptrace.c,v 1.29 2015/10/13 08:24:35 pgoyette Exp $ */
|
||||
/* $NetBSD: linux_ptrace.c,v 1.30 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.29 2015/10/13 08:24:35 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.30 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
@ -174,13 +174,10 @@ linux_sys_ptrace_arch(struct lwp *l, const struct linux_sys_ptrace_args *uap,
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* 2. It is being traced by procfs (which has different signal
|
||||
* delivery semantics),
|
||||
* 3. It is not being traced by _you_, or
|
||||
* 4. It is not currently stopped.
|
||||
* 2. It is not being traced by _you_, or
|
||||
* 3. It is not currently stopped.
|
||||
*/
|
||||
if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p ||
|
||||
t->p_stat != SSTOP || !t->p_waited) {
|
||||
if (t->p_pptr != p || t->p_stat != SSTOP || !t->p_waited) {
|
||||
mutex_exit(t->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
error = EBUSY;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_exit.c,v 1.268 2017/01/09 00:31:30 kamil Exp $ */
|
||||
/* $NetBSD: kern_exit.c,v 1.269 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.268 2017/01/09 00:31:30 kamil Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.269 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_dtrace.h"
|
||||
@ -469,7 +469,7 @@ exit1(struct lwp *l, int exitcode, int signo)
|
||||
if (__predict_false(child->p_slflag & PSL_TRACED)) {
|
||||
mutex_enter(p->p_lock);
|
||||
child->p_slflag &=
|
||||
~(PSL_TRACED|PSL_FSTRACE|PSL_SYSCALL);
|
||||
~(PSL_TRACED|PSL_SYSCALL);
|
||||
mutex_exit(p->p_lock);
|
||||
if (child->p_opptr != child->p_pptr) {
|
||||
struct proc *t = child->p_opptr;
|
||||
@ -526,8 +526,7 @@ exit1(struct lwp *l, int exitcode, int signo)
|
||||
/* Reload parent pointer, since p may have been reparented above */
|
||||
new_parent = p->p_pptr;
|
||||
|
||||
if (__predict_false((p->p_slflag & PSL_FSTRACE) == 0 &&
|
||||
p->p_exitsig != 0)) {
|
||||
if (__predict_false(p->p_exitsig != 0)) {
|
||||
exit_psignal(p, new_parent, &ksi);
|
||||
kpsignal(new_parent, &ksi, NULL);
|
||||
}
|
||||
@ -1159,7 +1158,7 @@ proc_free(struct proc *p, struct wrusage *wru)
|
||||
*/
|
||||
if ((p->p_slflag & PSL_TRACED) != 0 && p->p_opptr != parent) {
|
||||
mutex_enter(p->p_lock);
|
||||
p->p_slflag &= ~(PSL_TRACED|PSL_FSTRACE|PSL_SYSCALL);
|
||||
p->p_slflag &= ~(PSL_TRACED|PSL_SYSCALL);
|
||||
mutex_exit(p->p_lock);
|
||||
parent = (p->p_opptr == NULL) ? initproc : p->p_opptr;
|
||||
proc_reparent(p, parent);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_proc.c,v 1.206 2017/03/30 20:17:11 christos Exp $ */
|
||||
/* $NetBSD: kern_proc.c,v 1.207 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -62,7 +62,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206 2017/03/30 20:17:11 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.207 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_kstack.h"
|
||||
@ -1560,7 +1560,6 @@ static const u_int sysctl_sflagmap[] = {
|
||||
|
||||
static const u_int sysctl_slflagmap[] = {
|
||||
PSL_TRACED, P_TRACED,
|
||||
PSL_FSTRACE, P_FSTRACE,
|
||||
PSL_CHTRACED, P_CHTRACED,
|
||||
PSL_SYSCALL, P_SYSCALL,
|
||||
0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_sig.c,v 1.336 2017/04/21 15:10:35 christos Exp $ */
|
||||
/* $NetBSD: kern_sig.c,v 1.337 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.336 2017/04/21 15:10:35 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.337 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include "opt_ptrace.h"
|
||||
#include "opt_dtrace.h"
|
||||
@ -1733,8 +1733,7 @@ issignal(struct lwp *l)
|
||||
/* Emulation-specific handling of signal trace */
|
||||
if (p->p_emul->e_tracesig == NULL ||
|
||||
(*p->p_emul->e_tracesig)(p, signo) == 0)
|
||||
sigswitch(!(p->p_slflag & PSL_FSTRACE), 0,
|
||||
signo);
|
||||
sigswitch(1, 0, signo);
|
||||
|
||||
/* Check for a signal from the debugger. */
|
||||
if ((signo = sigchecktrace()) == 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sys_ptrace_common.c,v 1.22 2017/05/03 15:53:31 kamil Exp $ */
|
||||
/* $NetBSD: sys_ptrace_common.c,v 1.23 2017/08/28 00:46:07 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.22 2017/05/03 15:53:31 kamil Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.23 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ptrace.h"
|
||||
@ -472,17 +472,7 @@ do_ptrace(struct ptrace_methods *ptm, struct lwp *l, int req, pid_t pid,
|
||||
}
|
||||
|
||||
/*
|
||||
* (2) it's being traced by procfs (which has
|
||||
* different signal delivery semantics),
|
||||
*/
|
||||
if (ISSET(t->p_slflag, PSL_FSTRACE)) {
|
||||
DPRINTF(("file system traced\n"));
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (3) it's not being traced by _you_, or
|
||||
* (2) it's not being traced by _you_, or
|
||||
*/
|
||||
if (t->p_pptr != p) {
|
||||
DPRINTF(("parent %d != %d\n", t->p_pptr->p_pid,
|
||||
@ -492,7 +482,7 @@ do_ptrace(struct ptrace_methods *ptm, struct lwp *l, int req, pid_t pid,
|
||||
}
|
||||
|
||||
/*
|
||||
* (4) it's not currently stopped.
|
||||
* (3) it's not currently stopped.
|
||||
*/
|
||||
if (t->p_stat != SSTOP || !t->p_waited /* XXXSMP */) {
|
||||
DPRINTF(("stat %d flag %d\n", t->p_stat,
|
||||
@ -817,7 +807,7 @@ do_ptrace(struct ptrace_methods *ptm, struct lwp *l, int req, pid_t pid,
|
||||
break;
|
||||
#endif
|
||||
if (req == PT_DETACH) {
|
||||
CLR(t->p_slflag, PSL_TRACED|PSL_FSTRACE|PSL_SYSCALL);
|
||||
CLR(t->p_slflag, PSL_TRACED|PSL_SYSCALL);
|
||||
|
||||
/* give process back to original parent or init */
|
||||
if (t->p_opptr != t->p_pptr) {
|
||||
|
@ -1,11 +1,10 @@
|
||||
# $NetBSD: files.procfs,v 1.11 2017/03/30 20:16:29 christos Exp $
|
||||
# $NetBSD: files.procfs,v 1.12 2017/08/28 00:46:07 kamil Exp $
|
||||
|
||||
deffs PROCFS: PTRACE_HOOKS
|
||||
|
||||
define procfs: vfs
|
||||
file miscfs/procfs/procfs_auxv.c procfs
|
||||
file miscfs/procfs/procfs_cmdline.c procfs
|
||||
file miscfs/procfs/procfs_ctl.c procfs
|
||||
file miscfs/procfs/procfs_fd.c procfs
|
||||
file miscfs/procfs/procfs_fpregs.c procfs
|
||||
file miscfs/procfs/procfs_linux.c procfs
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs.h,v 1.71 2017/03/30 20:16:29 christos Exp $ */
|
||||
/* $NetBSD: procfs.h,v 1.72 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -88,7 +88,6 @@ typedef enum {
|
||||
PFSmem, /* the process's memory image */
|
||||
PFSregs, /* the process's register set */
|
||||
PFSfpregs, /* the process's FP register set */
|
||||
PFSctl, /* process control */
|
||||
PFSstat, /* process status (if -o linux) */
|
||||
PFSstatus, /* process status */
|
||||
PFSnote, /* process notifier */
|
||||
@ -136,7 +135,6 @@ struct pfsnode {
|
||||
};
|
||||
|
||||
#define PROCFS_NOTELEN 64 /* max length of a note (/proc/$pid/note) */
|
||||
#define PROCFS_CTLLEN 8 /* max length of a ctl msg (/proc/$pid/ctl */
|
||||
#define PROCFS_MAXNAMLEN 255
|
||||
|
||||
#endif /* _KERNEL */
|
||||
@ -203,8 +201,6 @@ int procfs_dofpregs(struct lwp *, struct lwp *, struct pfsnode *,
|
||||
struct uio *);
|
||||
int procfs_domem(struct lwp *, struct lwp *, struct pfsnode *,
|
||||
struct uio *);
|
||||
int procfs_doctl(struct lwp *, struct lwp *, struct pfsnode *,
|
||||
struct uio *);
|
||||
int procfs_do_pid_stat(struct lwp *, struct lwp *, struct pfsnode *,
|
||||
struct uio *);
|
||||
int procfs_dostatus(struct lwp *, struct lwp *, struct pfsnode *,
|
||||
|
@ -1,412 +0,0 @@
|
||||
/* $NetBSD: procfs_ctl.c,v 1.48 2016/04/04 20:47:57 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)procfs_ctl.c 8.4 (Berkeley) 6/15/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Jan-Simon Pendry
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)procfs_ctl.c 8.4 (Berkeley) 6/15/94
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_ctl.c,v 1.48 2016/04/04 20:47:57 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
|
||||
#define PROCFS_CTL_ATTACH 1
|
||||
#define PROCFS_CTL_DETACH 2
|
||||
#define PROCFS_CTL_STEP 3
|
||||
#define PROCFS_CTL_RUN 4
|
||||
#define PROCFS_CTL_WAIT 5
|
||||
|
||||
static const vfs_namemap_t ctlnames[] = {
|
||||
/* special /proc commands */
|
||||
{ "attach", PROCFS_CTL_ATTACH },
|
||||
{ "detach", PROCFS_CTL_DETACH },
|
||||
{ "step", PROCFS_CTL_STEP },
|
||||
{ "run", PROCFS_CTL_RUN },
|
||||
{ "wait", PROCFS_CTL_WAIT },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
static const vfs_namemap_t signames[] = {
|
||||
/* regular signal names */
|
||||
{ "hup", SIGHUP }, { "int", SIGINT },
|
||||
{ "quit", SIGQUIT }, { "ill", SIGILL },
|
||||
{ "trap", SIGTRAP }, { "abrt", SIGABRT },
|
||||
{ "iot", SIGIOT }, { "emt", SIGEMT },
|
||||
{ "fpe", SIGFPE }, { "kill", SIGKILL },
|
||||
{ "bus", SIGBUS }, { "segv", SIGSEGV },
|
||||
{ "sys", SIGSYS }, { "pipe", SIGPIPE },
|
||||
{ "alrm", SIGALRM }, { "term", SIGTERM },
|
||||
{ "urg", SIGURG }, { "stop", SIGSTOP },
|
||||
{ "tstp", SIGTSTP }, { "cont", SIGCONT },
|
||||
{ "chld", SIGCHLD }, { "ttin", SIGTTIN },
|
||||
{ "ttou", SIGTTOU }, { "io", SIGIO },
|
||||
{ "xcpu", SIGXCPU }, { "xfsz", SIGXFSZ },
|
||||
{ "vtalrm", SIGVTALRM }, { "prof", SIGPROF },
|
||||
{ "winch", SIGWINCH }, { "info", SIGINFO },
|
||||
{ "usr1", SIGUSR1 }, { "usr2", SIGUSR2 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
static int procfs_control(struct lwp *, struct lwp *, int, int,
|
||||
struct pfsnode *);
|
||||
|
||||
int
|
||||
procfs_control(struct lwp *curl, struct lwp *l, int op, int sig, struct pfsnode *pfs)
|
||||
{
|
||||
struct proc *curp = curl->l_proc;
|
||||
struct proc *p = l->l_proc;
|
||||
int error = 0;
|
||||
|
||||
mutex_enter(proc_lock);
|
||||
mutex_enter(p->p_lock);
|
||||
|
||||
switch (op) {
|
||||
/*
|
||||
* Attach - attaches the target process for debugging
|
||||
* by the calling process.
|
||||
*/
|
||||
case PROCFS_CTL_ATTACH:
|
||||
/*
|
||||
* You can't attach to a process if:
|
||||
* (1) it's the process that's doing the attaching,
|
||||
*/
|
||||
if (p->p_pid == curp->p_pid) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (2) it's already being traced, or
|
||||
*/
|
||||
if (ISSET(p->p_slflag, PSL_TRACED)) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (3) the security model prevents it.
|
||||
*/
|
||||
if ((error = kauth_authorize_process(curl->l_cred,
|
||||
KAUTH_PROCESS_PROCFS, p, pfs,
|
||||
KAUTH_ARG(KAUTH_REQ_PROCESS_PROCFS_CTL), NULL)) != 0)
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
* Target process must be stopped, owned by (curp) and
|
||||
* be set up for tracing (PSL_TRACED flag set).
|
||||
* Allow DETACH to take place at any time for sanity.
|
||||
* Allow WAIT any time, of course.
|
||||
*
|
||||
* Note that the semantics of DETACH are different here
|
||||
* from ptrace(2).
|
||||
*/
|
||||
case PROCFS_CTL_DETACH:
|
||||
case PROCFS_CTL_WAIT:
|
||||
/*
|
||||
* You can't do what you want to the process if:
|
||||
* (1) It's not being traced at all,
|
||||
*/
|
||||
if (!ISSET(p->p_slflag, PSL_TRACED)) {
|
||||
error = EPERM;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (2) it's being traced by ptrace(2) (which has
|
||||
* different signal delivery semantics), or
|
||||
*/
|
||||
if (!ISSET(p->p_slflag, PSL_FSTRACE)) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (3) it's not being traced by _you_.
|
||||
*/
|
||||
if (p->p_pptr != curp)
|
||||
error = EBUSY;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* You can't do what you want to the process if:
|
||||
* (1) It's not being traced at all,
|
||||
*/
|
||||
if (!ISSET(p->p_slflag, PSL_TRACED)) {
|
||||
error = EPERM;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (2) it's being traced by ptrace(2) (which has
|
||||
* different signal delivery semantics),
|
||||
*/
|
||||
if (!ISSET(p->p_slflag, PSL_FSTRACE)) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (3) it's not being traced by _you_, or
|
||||
*/
|
||||
if (p->p_pptr != curp) {
|
||||
error = EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (4) it's not currently stopped.
|
||||
*/
|
||||
if (p->p_stat != SSTOP || !p->p_waited /* XXXSMP */)
|
||||
error = EBUSY;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
mutex_exit(p->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Do single-step fixup if needed. */
|
||||
FIX_SSTEP(p);
|
||||
|
||||
switch (op) {
|
||||
case PROCFS_CTL_ATTACH:
|
||||
/*
|
||||
* Go ahead and set the trace flag.
|
||||
* Save the old parent (it's reset in
|
||||
* _DETACH, and also in kern_exit.c:wait4()
|
||||
* Reparent the process so that the tracing
|
||||
* proc gets to see all the action.
|
||||
* Stop the target.
|
||||
*/
|
||||
SET(p->p_slflag, PSL_TRACED|PSL_FSTRACE);
|
||||
p->p_opptr = p->p_pptr;
|
||||
if (p->p_pptr != curp) {
|
||||
if (p->p_pptr->p_lock < p->p_lock) {
|
||||
if (!mutex_tryenter(p->p_pptr->p_lock)) {
|
||||
mutex_exit(p->p_lock);
|
||||
mutex_enter(p->p_pptr->p_lock);
|
||||
}
|
||||
} else if (p->p_pptr->p_lock > p->p_lock) {
|
||||
mutex_enter(p->p_pptr->p_lock);
|
||||
}
|
||||
p->p_pptr->p_slflag |= PSL_CHTRACED;
|
||||
proc_reparent(p, curp);
|
||||
if (p->p_pptr->p_lock != p->p_lock)
|
||||
mutex_exit(p->p_pptr->p_lock);
|
||||
}
|
||||
sig = SIGSTOP;
|
||||
goto sendsig;
|
||||
|
||||
#ifdef PT_STEP
|
||||
case PROCFS_CTL_STEP:
|
||||
/*
|
||||
* Step. Let the target process execute a single instruction.
|
||||
*/
|
||||
#endif
|
||||
case PROCFS_CTL_RUN:
|
||||
case PROCFS_CTL_DETACH:
|
||||
#ifdef PT_STEP
|
||||
/* XXXAD locking? */
|
||||
error = process_sstep(l, op == PROCFS_CTL_STEP);
|
||||
if (error)
|
||||
break;
|
||||
#endif
|
||||
|
||||
if (op == PROCFS_CTL_DETACH) {
|
||||
/* give process back to original parent */
|
||||
if (p->p_opptr != p->p_pptr) {
|
||||
struct proc *pp = p->p_opptr;
|
||||
proc_reparent(p, pp ? pp : initproc);
|
||||
}
|
||||
|
||||
/* not being traced any more */
|
||||
p->p_opptr = NULL;
|
||||
CLR(p->p_slflag, PSL_TRACED|PSL_FSTRACE);
|
||||
p->p_waited = 0; /* XXXSMP */
|
||||
}
|
||||
|
||||
sendsig:
|
||||
/* Finally, deliver the requested signal (or none). */
|
||||
lwp_lock(l);
|
||||
if (l->l_stat == LSSTOP) {
|
||||
p->p_xsig = sig;
|
||||
/* setrunnable() will release the lock. */
|
||||
setrunnable(l);
|
||||
} else {
|
||||
lwp_unlock(l);
|
||||
if (sig != 0) {
|
||||
mutex_exit(p->p_lock);
|
||||
psignal(p, sig);
|
||||
mutex_enter(p->p_lock);
|
||||
}
|
||||
}
|
||||
mutex_exit(p->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
return (error);
|
||||
|
||||
case PROCFS_CTL_WAIT:
|
||||
mutex_exit(p->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
|
||||
/*
|
||||
* Wait for the target process to stop.
|
||||
* XXXSMP WTF is this?
|
||||
*/
|
||||
while (l->l_stat != LSSTOP && P_ZOMBIE(p)) {
|
||||
error = tsleep(l, PWAIT|PCATCH, "procfsx", hz);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
|
||||
return (error);
|
||||
|
||||
default:
|
||||
panic("procfs_ctl");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
mutex_exit(p->p_lock);
|
||||
mutex_exit(proc_lock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_doctl(
|
||||
struct lwp *curl,
|
||||
struct lwp *l,
|
||||
struct pfsnode *pfs,
|
||||
struct uio *uio
|
||||
)
|
||||
{
|
||||
struct proc *p = l->l_proc;
|
||||
char msg[PROCFS_CTLLEN+1];
|
||||
const vfs_namemap_t *nm;
|
||||
int error;
|
||||
int xlen;
|
||||
|
||||
if (uio->uio_rw != UIO_WRITE)
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
xlen = PROCFS_CTLLEN;
|
||||
error = vfs_getuserstr(uio, msg, &xlen);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* Map signal names into signal generation
|
||||
* or debug control. Unknown commands and/or signals
|
||||
* return EOPNOTSUPP.
|
||||
*
|
||||
* Sending a signal while the process is being debugged
|
||||
* also has the side effect of letting the target continue
|
||||
* to run. There is no way to single-step a signal delivery.
|
||||
*/
|
||||
error = EOPNOTSUPP;
|
||||
|
||||
nm = vfs_findname(ctlnames, msg, xlen);
|
||||
if (nm) {
|
||||
error = procfs_control(curl, l, nm->nm_val, 0, pfs);
|
||||
} else {
|
||||
nm = vfs_findname(signames, msg, xlen);
|
||||
if (nm) {
|
||||
if (ISSET(p->p_slflag, PSL_TRACED) &&
|
||||
p->p_pptr == p)
|
||||
error = procfs_control(curl, l, PROCFS_CTL_RUN,
|
||||
nm->nm_val, pfs);
|
||||
else {
|
||||
psignal(p, nm->nm_val);
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs_subr.c,v 1.108 2017/04/01 19:35:57 riastradh Exp $ */
|
||||
/* $NetBSD: procfs_subr.c,v 1.109 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -102,7 +102,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.108 2017/04/01 19:35:57 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.109 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -200,10 +200,6 @@ procfs_rw(void *v)
|
||||
error = procfs_dofpregs(curl, l, pfs, uio);
|
||||
break;
|
||||
|
||||
case PFSctl:
|
||||
error = procfs_doctl(curl, l, pfs, uio);
|
||||
break;
|
||||
|
||||
case PFSstatus:
|
||||
error = procfs_dostatus(curl, l, pfs, uio);
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs_vfsops.c,v 1.97 2017/03/30 20:16:29 christos Exp $ */
|
||||
/* $NetBSD: procfs_vfsops.c,v 1.98 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -76,7 +76,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.97 2017/03/30 20:16:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.98 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -379,7 +379,6 @@ procfs_loadvnode(struct mount *mp, struct vnode *vp,
|
||||
vp->v_type = VREG;
|
||||
break;
|
||||
|
||||
case PFSctl: /* /proc/N/ctl = --w------ */
|
||||
case PFSnote: /* /proc/N/note = --w------ */
|
||||
case PFSnotepg: /* /proc/N/notepg = --w------ */
|
||||
pfs->pfs_mode = S_IWUSR;
|
||||
@ -491,21 +490,15 @@ procfs_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
|
||||
{
|
||||
struct proc *p;
|
||||
struct pfsnode *pfs;
|
||||
enum kauth_process_req req;
|
||||
int result;
|
||||
|
||||
result = KAUTH_RESULT_DEFER;
|
||||
p = arg0;
|
||||
pfs = arg1;
|
||||
req = (enum kauth_process_req)(unsigned long)arg2;
|
||||
|
||||
if (action != KAUTH_PROCESS_PROCFS)
|
||||
return result;
|
||||
|
||||
/* Privileged; let secmodel handle that. */
|
||||
if (req == KAUTH_REQ_PROCESS_PROCFS_CTL)
|
||||
return result;
|
||||
|
||||
switch (pfs->pfs_type) {
|
||||
case PFSregs:
|
||||
case PFSfpregs:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs_vnops.c,v 1.197 2017/05/26 14:21:01 riastradh Exp $ */
|
||||
/* $NetBSD: procfs_vnops.c,v 1.198 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -105,7 +105,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.197 2017/05/26 14:21:01 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.198 2017/08/28 00:46:07 kamil Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -164,7 +164,6 @@ static const struct proc_target {
|
||||
{ DT_REG, N("mem"), PFSmem, NULL },
|
||||
{ DT_REG, N("regs"), PFSregs, procfs_validregs },
|
||||
{ DT_REG, N("fpregs"), PFSfpregs, procfs_validfpregs },
|
||||
{ DT_REG, N("ctl"), PFSctl, NULL },
|
||||
{ DT_REG, N("stat"), PFSstat, procfs_validfile_linux },
|
||||
{ DT_REG, N("status"), PFSstatus, NULL },
|
||||
{ DT_REG, N("note"), PFSnote, NULL },
|
||||
@ -732,7 +731,6 @@ procfs_getattr(void *v)
|
||||
if (procp->p_flag & PK_SUGID)
|
||||
vap->va_mode &= ~(S_IRUSR|S_IWUSR);
|
||||
/* FALLTHROUGH */
|
||||
case PFSctl:
|
||||
case PFSstatus:
|
||||
case PFSstat:
|
||||
case PFSnote:
|
||||
@ -878,7 +876,6 @@ procfs_getattr(void *v)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PFSctl:
|
||||
case PFSstatus:
|
||||
case PFSstat:
|
||||
case PFSnote:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.3 2017/03/30 20:16:42 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.4 2017/08/28 00:46:07 kamil Exp $
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
.endif
|
||||
|
||||
KMOD= procfs
|
||||
SRCS= procfs_ctl.c procfs_note.c procfs_status.c procfs_subr.c \
|
||||
SRCS= procfs_note.c procfs_status.c procfs_subr.c \
|
||||
procfs_vfsops.c procfs_vnops.c procfs_cmdline.c procfs_linux.c \
|
||||
procfs_machdep.c procfs_map.c procfs_regs.c procfs_fpregs.c \
|
||||
procfs_mem.c procfs_fd.c procfs_auxv.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kauth.h,v 1.74 2017/06/14 17:48:41 maxv Exp $ */
|
||||
/* $NetBSD: kauth.h,v 1.75 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
@ -225,7 +225,6 @@ enum kauth_process_req {
|
||||
KAUTH_REQ_PROCESS_CORENAME_GET,
|
||||
KAUTH_REQ_PROCESS_CORENAME_SET,
|
||||
KAUTH_REQ_PROCESS_KTRACE_PERSISTENT,
|
||||
KAUTH_REQ_PROCESS_PROCFS_CTL,
|
||||
KAUTH_REQ_PROCESS_PROCFS_READ,
|
||||
KAUTH_REQ_PROCESS_PROCFS_RW,
|
||||
KAUTH_REQ_PROCESS_PROCFS_WRITE,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: proc.h,v 1.341 2017/07/01 16:36:46 khorben Exp $ */
|
||||
/* $NetBSD: proc.h,v 1.342 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -411,7 +411,6 @@ struct proc {
|
||||
0x00000010 /* traced process wants LWP exit events */
|
||||
|
||||
#define PSL_TRACED 0x00000800 /* Debugged process being traced */
|
||||
#define PSL_FSTRACE 0x00010000 /* Debugger process being traced by procfs */
|
||||
#define PSL_CHTRACED 0x00400000 /* Child has been traced & reparented */
|
||||
#define PSL_SYSCALL 0x04000000 /* process has PT_SYSCALL enabled */
|
||||
#define PSL_SYSCALLEMU 0x08000000 /* cancel in-progress syscall */
|
||||
@ -436,7 +435,7 @@ struct proc {
|
||||
* Macro to compute the exit signal to be delivered.
|
||||
*/
|
||||
#define P_EXITSIG(p) \
|
||||
(((p)->p_slflag & (PSL_TRACED|PSL_FSTRACE)) ? SIGCHLD : p->p_exitsig)
|
||||
(((p)->p_slflag & PSL_TRACED) ? SIGCHLD : p->p_exitsig)
|
||||
/*
|
||||
* Compute a wait(2) 16 bit exit status code
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sysctl.h,v 1.223 2017/03/25 05:55:36 pgoyette Exp $ */
|
||||
/* $NetBSD: sysctl.h,v 1.224 2017/08/28 00:46:07 kamil Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -623,7 +623,6 @@ struct kinfo_proc2 {
|
||||
#define P_WEXIT 0x00002000
|
||||
#define P_EXEC 0x00004000
|
||||
#define P_OWEUPC 0x00008000
|
||||
#define P_FSTRACE 0x00010000
|
||||
#define P_NOCLDWAIT 0x00020000
|
||||
#define P_32 0x00040000
|
||||
#define P_CLDSIGIGN 0x00080000
|
||||
|
Loading…
Reference in New Issue
Block a user