Module Name: src Committed By: kamil Date: Mon Aug 28 00:46:07 UTC 2017
Modified Files: src/bin/ps: ps.1 src/doc: TODO.ptrace src/sbin/mount_procfs: mount_procfs.8 src/share/man/man9: kauth.9 src/sys/compat/linux/arch/arm: linux_ptrace.c src/sys/compat/linux/arch/i386: linux_ptrace.c src/sys/compat/linux/arch/powerpc: linux_ptrace.c src/sys/kern: kern_exit.c kern_proc.c kern_sig.c sys_ptrace_common.c src/sys/miscfs/procfs: files.procfs procfs.h procfs_subr.c procfs_vfsops.c procfs_vnops.c src/sys/modules/procfs: Makefile src/sys/sys: kauth.h proc.h sysctl.h Removed Files: src/sys/miscfs/procfs: procfs_ctl.c Log Message: 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> To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/bin/ps/ps.1 cvs rdiff -u -r1.28 -r1.29 src/doc/TODO.ptrace cvs rdiff -u -r1.35 -r1.36 src/sbin/mount_procfs/mount_procfs.8 cvs rdiff -u -r1.108 -r1.109 src/share/man/man9/kauth.9 cvs rdiff -u -r1.19 -r1.20 src/sys/compat/linux/arch/arm/linux_ptrace.c cvs rdiff -u -r1.31 -r1.32 src/sys/compat/linux/arch/i386/linux_ptrace.c cvs rdiff -u -r1.29 -r1.30 src/sys/compat/linux/arch/powerpc/linux_ptrace.c cvs rdiff -u -r1.268 -r1.269 src/sys/kern/kern_exit.c cvs rdiff -u -r1.206 -r1.207 src/sys/kern/kern_proc.c cvs rdiff -u -r1.336 -r1.337 src/sys/kern/kern_sig.c cvs rdiff -u -r1.22 -r1.23 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.11 -r1.12 src/sys/miscfs/procfs/files.procfs cvs rdiff -u -r1.71 -r1.72 src/sys/miscfs/procfs/procfs.h cvs rdiff -u -r1.48 -r0 src/sys/miscfs/procfs/procfs_ctl.c cvs rdiff -u -r1.108 -r1.109 src/sys/miscfs/procfs/procfs_subr.c cvs rdiff -u -r1.97 -r1.98 src/sys/miscfs/procfs/procfs_vfsops.c cvs rdiff -u -r1.197 -r1.198 src/sys/miscfs/procfs/procfs_vnops.c cvs rdiff -u -r1.3 -r1.4 src/sys/modules/procfs/Makefile cvs rdiff -u -r1.74 -r1.75 src/sys/sys/kauth.h cvs rdiff -u -r1.341 -r1.342 src/sys/sys/proc.h cvs rdiff -u -r1.223 -r1.224 src/sys/sys/sysctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/ps/ps.1 diff -u src/bin/ps/ps.1:1.107 src/bin/ps/ps.1:1.108 --- src/bin/ps/ps.1:1.107 Mon Jul 3 21:33:23 2017 +++ src/bin/ps/ps.1 Mon Aug 28 00:46:06 2017 @@ -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" Index: src/doc/TODO.ptrace diff -u src/doc/TODO.ptrace:1.28 src/doc/TODO.ptrace:1.29 --- src/doc/TODO.ptrace:1.28 Sat Apr 8 01:08:36 2017 +++ src/doc/TODO.ptrace Mon Aug 28 00:46:07 2017 @@ -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 t - 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 Index: src/sbin/mount_procfs/mount_procfs.8 diff -u src/sbin/mount_procfs/mount_procfs.8:1.35 src/sbin/mount_procfs/mount_procfs.8:1.36 --- src/sbin/mount_procfs/mount_procfs.8:1.35 Mon Jul 3 21:33:41 2017 +++ src/sbin/mount_procfs/mount_procfs.8 Mon Aug 28 00:46:07 2017 @@ -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-t 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 Index: src/share/man/man9/kauth.9 diff -u src/share/man/man9/kauth.9:1.108 src/share/man/man9/kauth.9:1.109 --- src/share/man/man9/kauth.9:1.108 Mon Jul 3 21:28:48 2017 +++ src/share/man/man9/kauth.9 Mon Aug 28 00:46:07 2017 @@ -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 <e...@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 Index: src/sys/compat/linux/arch/arm/linux_ptrace.c diff -u src/sys/compat/linux/arch/arm/linux_ptrace.c:1.19 src/sys/compat/linux/arch/arm/linux_ptrace.c:1.20 --- src/sys/compat/linux/arch/arm/linux_ptrace.c:1.19 Tue Oct 13 08:24:35 2015 +++ src/sys/compat/linux/arch/arm/linux_ptrace.c Mon Aug 28 00:46:07 2017 @@ -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, con * 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; Index: src/sys/compat/linux/arch/i386/linux_ptrace.c diff -u src/sys/compat/linux/arch/i386/linux_ptrace.c:1.31 src/sys/compat/linux/arch/i386/linux_ptrace.c:1.32 --- src/sys/compat/linux/arch/i386/linux_ptrace.c:1.31 Tue Oct 13 08:24:35 2015 +++ src/sys/compat/linux/arch/i386/linux_ptrace.c Mon Aug 28 00:46:07 2017 @@ -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, con 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; Index: src/sys/compat/linux/arch/powerpc/linux_ptrace.c diff -u src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.29 src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.30 --- src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.29 Tue Oct 13 08:24:35 2015 +++ src/sys/compat/linux/arch/powerpc/linux_ptrace.c Mon Aug 28 00:46:07 2017 @@ -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, con 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; Index: src/sys/kern/kern_exit.c diff -u src/sys/kern/kern_exit.c:1.268 src/sys/kern/kern_exit.c:1.269 --- src/sys/kern/kern_exit.c:1.268 Mon Jan 9 00:31:30 2017 +++ src/sys/kern/kern_exit.c Mon Aug 28 00:46:07 2017 @@ -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 s 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 s /* 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 */ 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); Index: src/sys/kern/kern_proc.c diff -u src/sys/kern/kern_proc.c:1.206 src/sys/kern/kern_proc.c:1.207 --- src/sys/kern/kern_proc.c:1.206 Thu Mar 30 20:17:11 2017 +++ src/sys/kern/kern_proc.c Mon Aug 28 00:46:07 2017 @@ -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 Index: src/sys/kern/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.336 src/sys/kern/kern_sig.c:1.337 --- src/sys/kern/kern_sig.c:1.336 Fri Apr 21 15:10:35 2017 +++ src/sys/kern/kern_sig.c Mon Aug 28 00:46:07 2017 @@ -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) Index: src/sys/kern/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.22 src/sys/kern/sys_ptrace_common.c:1.23 --- src/sys/kern/sys_ptrace_common.c:1.22 Wed May 3 15:53:31 2017 +++ src/sys/kern/sys_ptrace_common.c Mon Aug 28 00:46:07 2017 @@ -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, st } /* - * (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, st } /* - * (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, st 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) { Index: src/sys/miscfs/procfs/files.procfs diff -u src/sys/miscfs/procfs/files.procfs:1.11 src/sys/miscfs/procfs/files.procfs:1.12 --- src/sys/miscfs/procfs/files.procfs:1.11 Thu Mar 30 20:16:29 2017 +++ src/sys/miscfs/procfs/files.procfs Mon Aug 28 00:46:07 2017 @@ -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 Index: src/sys/miscfs/procfs/procfs.h diff -u src/sys/miscfs/procfs/procfs.h:1.71 src/sys/miscfs/procfs/procfs.h:1.72 --- src/sys/miscfs/procfs/procfs.h:1.71 Thu Mar 30 20:16:29 2017 +++ src/sys/miscfs/procfs/procfs.h Mon Aug 28 00:46:07 2017 @@ -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 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 *, Index: src/sys/miscfs/procfs/procfs_subr.c diff -u src/sys/miscfs/procfs/procfs_subr.c:1.108 src/sys/miscfs/procfs/procfs_subr.c:1.109 --- src/sys/miscfs/procfs/procfs_subr.c:1.108 Sat Apr 1 19:35:57 2017 +++ src/sys/miscfs/procfs/procfs_subr.c Mon Aug 28 00:46:07 2017 @@ -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; Index: src/sys/miscfs/procfs/procfs_vfsops.c diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.97 src/sys/miscfs/procfs/procfs_vfsops.c:1.98 --- src/sys/miscfs/procfs/procfs_vfsops.c:1.97 Thu Mar 30 20:16:29 2017 +++ src/sys/miscfs/procfs/procfs_vfsops.c Mon Aug 28 00:46:07 2017 @@ -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, struc 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, ka { 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: Index: src/sys/miscfs/procfs/procfs_vnops.c diff -u src/sys/miscfs/procfs/procfs_vnops.c:1.197 src/sys/miscfs/procfs/procfs_vnops.c:1.198 --- src/sys/miscfs/procfs/procfs_vnops.c:1.197 Fri May 26 14:21:01 2017 +++ src/sys/miscfs/procfs/procfs_vnops.c Mon Aug 28 00:46:07 2017 @@ -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: Index: src/sys/modules/procfs/Makefile diff -u src/sys/modules/procfs/Makefile:1.3 src/sys/modules/procfs/Makefile:1.4 --- src/sys/modules/procfs/Makefile:1.3 Thu Mar 30 20:16:42 2017 +++ src/sys/modules/procfs/Makefile Mon Aug 28 00:46:07 2017 @@ -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 Index: src/sys/sys/kauth.h diff -u src/sys/sys/kauth.h:1.74 src/sys/sys/kauth.h:1.75 --- src/sys/sys/kauth.h:1.74 Wed Jun 14 17:48:41 2017 +++ src/sys/sys/kauth.h Mon Aug 28 00:46:07 2017 @@ -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 <e...@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, Index: src/sys/sys/proc.h diff -u src/sys/sys/proc.h:1.341 src/sys/sys/proc.h:1.342 --- src/sys/sys/proc.h:1.341 Sat Jul 1 16:36:46 2017 +++ src/sys/sys/proc.h Mon Aug 28 00:46:07 2017 @@ -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 */ Index: src/sys/sys/sysctl.h diff -u src/sys/sys/sysctl.h:1.223 src/sys/sys/sysctl.h:1.224 --- src/sys/sys/sysctl.h:1.223 Sat Mar 25 05:55:36 2017 +++ src/sys/sys/sysctl.h Mon Aug 28 00:46:07 2017 @@ -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