Index: bin/ps/ps.1 =================================================================== RCS file: /cvsroot/src/bin/ps/ps.1,v retrieving revision 1.107 diff -u -r1.107 ps.1 --- bin/ps/ps.1 3 Jul 2017 21:33:23 -0000 1.107 +++ bin/ps/ps.1 26 Aug 2017 13:58:00 -0000 @@ -308,7 +308,6 @@ .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: doc/TODO.ptrace =================================================================== RCS file: /cvsroot/src/doc/TODO.ptrace,v retrieving revision 1.28 diff -u -r1.28 TODO.ptrace --- doc/TODO.ptrace 8 Apr 2017 01:08:36 -0000 1.28 +++ doc/TODO.ptrace 26 Aug 2017 13:58:01 -0000 @@ -8,11 +8,6 @@ - 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: sbin/mount_procfs/mount_procfs.8 =================================================================== RCS file: /cvsroot/src/sbin/mount_procfs/mount_procfs.8,v retrieving revision 1.35 diff -u -r1.35 mount_procfs.8 --- sbin/mount_procfs/mount_procfs.8 3 Jul 2017 21:33:41 -0000 1.35 +++ sbin/mount_procfs/mount_procfs.8 26 Aug 2017 13:58:09 -0000 @@ -90,38 +90,6 @@ 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 @@ 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: share/man/man9/kauth.9 =================================================================== RCS file: /cvsroot/src/share/man/man9/kauth.9,v retrieving revision 1.108 diff -u -r1.108 kauth.9 --- share/man/man9/kauth.9 3 Jul 2017 21:28:48 -0000 1.108 +++ share/man/man9/kauth.9 26 Aug 2017 13:58:09 -0000 @@ -553,7 +553,6 @@ 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: sys/compat/linux/arch/arm/linux_ptrace.c =================================================================== RCS file: /cvsroot/src/sys/compat/linux/arch/arm/linux_ptrace.c,v retrieving revision 1.19 diff -u -r1.19 linux_ptrace.c --- sys/compat/linux/arch/arm/linux_ptrace.c 13 Oct 2015 08:24:35 -0000 1.19 +++ sys/compat/linux/arch/arm/linux_ptrace.c 26 Aug 2017 13:58:10 -0000 @@ -157,8 +157,7 @@ * 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: sys/compat/linux/arch/i386/linux_ptrace.c =================================================================== RCS file: /cvsroot/src/sys/compat/linux/arch/i386/linux_ptrace.c,v retrieving revision 1.31 diff -u -r1.31 linux_ptrace.c --- sys/compat/linux/arch/i386/linux_ptrace.c 13 Oct 2015 08:24:35 -0000 1.31 +++ sys/compat/linux/arch/i386/linux_ptrace.c 26 Aug 2017 13:58:10 -0000 @@ -197,13 +197,10 @@ 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: sys/compat/linux/arch/powerpc/linux_ptrace.c =================================================================== RCS file: /cvsroot/src/sys/compat/linux/arch/powerpc/linux_ptrace.c,v retrieving revision 1.29 diff -u -r1.29 linux_ptrace.c --- sys/compat/linux/arch/powerpc/linux_ptrace.c 13 Oct 2015 08:24:35 -0000 1.29 +++ sys/compat/linux/arch/powerpc/linux_ptrace.c 26 Aug 2017 13:58:10 -0000 @@ -174,13 +174,10 @@ 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: sys/kern/kern_exit.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_exit.c,v retrieving revision 1.268 diff -u -r1.268 kern_exit.c --- sys/kern/kern_exit.c 9 Jan 2017 00:31:30 -0000 1.268 +++ sys/kern/kern_exit.c 26 Aug 2017 13:58:10 -0000 @@ -469,7 +469,7 @@ 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 @@ /* 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 @@ */ 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: sys/kern/kern_proc.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_proc.c,v retrieving revision 1.206 diff -u -r1.206 kern_proc.c --- sys/kern/kern_proc.c 30 Mar 2017 20:17:11 -0000 1.206 +++ sys/kern/kern_proc.c 26 Aug 2017 13:58:10 -0000 @@ -1560,7 +1560,6 @@ static const u_int sysctl_slflagmap[] = { PSL_TRACED, P_TRACED, - PSL_FSTRACE, P_FSTRACE, PSL_CHTRACED, P_CHTRACED, PSL_SYSCALL, P_SYSCALL, 0 Index: sys/kern/kern_sig.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_sig.c,v retrieving revision 1.336 diff -u -r1.336 kern_sig.c --- sys/kern/kern_sig.c 21 Apr 2017 15:10:35 -0000 1.336 +++ sys/kern/kern_sig.c 26 Aug 2017 13:58:10 -0000 @@ -1733,8 +1733,7 @@ /* 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: sys/kern/sys_ptrace_common.c =================================================================== RCS file: /cvsroot/src/sys/kern/sys_ptrace_common.c,v retrieving revision 1.22 diff -u -r1.22 sys_ptrace_common.c --- sys/kern/sys_ptrace_common.c 3 May 2017 15:53:31 -0000 1.22 +++ sys/kern/sys_ptrace_common.c 26 Aug 2017 13:58:10 -0000 @@ -472,17 +472,7 @@ } /* - * (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 @@ } /* - * (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 @@ 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: sys/miscfs/procfs/files.procfs =================================================================== RCS file: /cvsroot/src/sys/miscfs/procfs/files.procfs,v retrieving revision 1.11 diff -u -r1.11 files.procfs --- sys/miscfs/procfs/files.procfs 30 Mar 2017 20:16:29 -0000 1.11 +++ sys/miscfs/procfs/files.procfs 26 Aug 2017 13:58:10 -0000 @@ -5,7 +5,6 @@ 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: sys/miscfs/procfs/procfs.h =================================================================== RCS file: /cvsroot/src/sys/miscfs/procfs/procfs.h,v retrieving revision 1.71 diff -u -r1.71 procfs.h --- sys/miscfs/procfs/procfs.h 30 Mar 2017 20:16:29 -0000 1.71 +++ sys/miscfs/procfs/procfs.h 26 Aug 2017 13:58:10 -0000 @@ -88,7 +88,6 @@ 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 @@ }; #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 @@ 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: sys/miscfs/procfs/procfs_subr.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/procfs/procfs_subr.c,v retrieving revision 1.108 diff -u -r1.108 procfs_subr.c --- sys/miscfs/procfs/procfs_subr.c 1 Apr 2017 19:35:57 -0000 1.108 +++ sys/miscfs/procfs/procfs_subr.c 26 Aug 2017 13:58:10 -0000 @@ -200,10 +200,6 @@ 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: sys/miscfs/procfs/procfs_vfsops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/procfs/procfs_vfsops.c,v retrieving revision 1.97 diff -u -r1.97 procfs_vfsops.c --- sys/miscfs/procfs/procfs_vfsops.c 30 Mar 2017 20:16:29 -0000 1.97 +++ sys/miscfs/procfs/procfs_vfsops.c 26 Aug 2017 13:58:10 -0000 @@ -379,7 +379,6 @@ 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 @@ { 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: sys/miscfs/procfs/procfs_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/procfs/procfs_vnops.c,v retrieving revision 1.197 diff -u -r1.197 procfs_vnops.c --- sys/miscfs/procfs/procfs_vnops.c 26 May 2017 14:21:01 -0000 1.197 +++ sys/miscfs/procfs/procfs_vnops.c 26 Aug 2017 13:58:10 -0000 @@ -164,7 +164,6 @@ { 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 @@ 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 @@ break; #endif - case PFSctl: case PFSstatus: case PFSstat: case PFSnote: Index: sys/modules/procfs/Makefile =================================================================== RCS file: /cvsroot/src/sys/modules/procfs/Makefile,v retrieving revision 1.3 diff -u -r1.3 Makefile --- sys/modules/procfs/Makefile 30 Mar 2017 20:16:42 -0000 1.3 +++ sys/modules/procfs/Makefile 26 Aug 2017 13:58:10 -0000 @@ -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: sys/sys/kauth.h =================================================================== RCS file: /cvsroot/src/sys/sys/kauth.h,v retrieving revision 1.74 diff -u -r1.74 kauth.h --- sys/sys/kauth.h 14 Jun 2017 17:48:41 -0000 1.74 +++ sys/sys/kauth.h 26 Aug 2017 13:58:10 -0000 @@ -225,7 +225,6 @@ 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: sys/sys/proc.h =================================================================== RCS file: /cvsroot/src/sys/sys/proc.h,v retrieving revision 1.341 diff -u -r1.341 proc.h --- sys/sys/proc.h 1 Jul 2017 16:36:46 -0000 1.341 +++ sys/sys/proc.h 26 Aug 2017 13:58:10 -0000 @@ -411,7 +411,6 @@ 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 @@ * 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: sys/sys/sysctl.h =================================================================== RCS file: /cvsroot/src/sys/sys/sysctl.h,v retrieving revision 1.223 diff -u -r1.223 sysctl.h --- sys/sys/sysctl.h 25 Mar 2017 05:55:36 -0000 1.223 +++ sys/sys/sysctl.h 26 Aug 2017 13:58:10 -0000 @@ -623,7 +623,6 @@ #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