svn commit: r359530 - in head: . lib/libsysdecode sys/amd64/amd64 sys/amd64/ia32 sys/arm/arm sys/arm64/arm64 sys/compat/ia32 sys/conf sys/fs/procfs sys/i386/i386 sys/kern sys/mips/mips sys/modules/...

John Baldwin jhb at FreeBSD.org
Wed Apr 1 19:22:26 UTC 2020


Author: jhb
Date: Wed Apr  1 19:22:09 2020
New Revision: 359530
URL: https://svnweb.freebsd.org/changeset/base/359530

Log:
  Retire procfs-based process debugging.
  
  Modern debuggers and process tracers use ptrace() rather than procfs
  for debugging.  ptrace() has a supserset of functionality available
  via procfs and new debugging features are only added to ptrace().
  While the two debugging services share some fields in struct proc,
  they each use dedicated fields and separate code.  This results in
  extra complexity to support a feature that hasn't been enabled in the
  default install for several years.
  
  PR:		244939 (exp-run)
  Reviewed by:	kib, mjg (earlier version)
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D23837

Deleted:
  head/sys/fs/procfs/procfs_ioctl.c
  head/sys/sys/pioctl.h
Modified:
  head/ObsoleteFiles.inc
  head/lib/libsysdecode/Makefile
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/ia32/ia32_reg.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/ia32/ia32_syscall.c
  head/sys/arm/arm/syscall.c
  head/sys/arm64/arm64/trap.c
  head/sys/compat/ia32/ia32_sysvec.c
  head/sys/conf/files
  head/sys/fs/procfs/procfs.c
  head/sys/fs/procfs/procfs.h
  head/sys/i386/i386/trap.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_prot.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_thread.c
  head/sys/kern/subr_syscall.c
  head/sys/kern/subr_trap.c
  head/sys/kern/sys_process.c
  head/sys/mips/mips/trap.c
  head/sys/modules/procfs/Makefile
  head/sys/powerpc/powerpc/trap.c
  head/sys/riscv/riscv/trap.c
  head/sys/sys/param.h
  head/sys/sys/proc.h

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/ObsoleteFiles.inc	Wed Apr  1 19:22:09 2020	(r359530)
@@ -36,6 +36,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200401: Remove procfs-based process debugging
+OLD_FILES+=usr/include/sys/pioctl.h
+
 # 20200330: GDB_LIBEXEC option retired (always true)
 OLD_FILES+=usr/bin/gdb
 OLD_FILES+=usr/bin/gdbserver

Modified: head/lib/libsysdecode/Makefile
==============================================================================
--- head/lib/libsysdecode/Makefile	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/lib/libsysdecode/Makefile	Wed Apr  1 19:22:09 2020	(r359530)
@@ -119,11 +119,6 @@ CFLAGS+=-DPF
 # Workaround duplicate declarations in <netinet/ip_compat.h>
 CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 
-# Ignore deprecation warning in <sys/pioctl.h>
-CFLAGS.clang.ioctl.c+= -Wno-\#warnings
-CFLAGS.gcc.ioctl.c+= -Wno-cpp
-
-CFLAGS.clang+=	${CFLAGS.clang.${.IMPSRC}}
 CFLAGS.gcc+=	${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=	tables.h

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/amd64/amd64/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
-#include <sys/pioctl.h>
 #include <sys/ptrace.h>
 #include <sys/kdb.h>
 #include <sys/kernel.h>

Modified: head/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- head/sys/amd64/amd64/vm_machdep.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/amd64/amd64/vm_machdep.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/mutex.h>
-#include <sys/pioctl.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
 #include <sys/procctl.h>
@@ -198,15 +197,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t
 	td2->td_frame->tf_rdx = 1;
 
 	/*
-	 * If the parent process has the trap bit set (i.e. a debugger had
-	 * single stepped the process to the system call), we need to clear
-	 * the trap flag from the new frame unless the debugger had set PF_FORK
-	 * on the parent.  Otherwise, the child will receive a (likely
-	 * unexpected) SIGTRAP when it executes the first instruction after
-	 * returning  to userland.
+	 * If the parent process has the trap bit set (i.e. a debugger
+	 * had single stepped the process to the system call), we need
+	 * to clear the trap flag from the new frame.
 	 */
-	if ((p1->p_pfsflags & PF_FORK) == 0)
-		td2->td_frame->tf_rflags &= ~PSL_T;
+	td2->td_frame->tf_rflags &= ~PSL_T;
 
 	/*
 	 * Set registers for trampoline to user mode.  Leave space for the

Modified: head/sys/amd64/ia32/ia32_reg.c
==============================================================================
--- head/sys/amd64/ia32/ia32_reg.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/amd64/ia32/ia32_reg.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/mman.h>
 #include <sys/namei.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/procfs.h>
 #include <sys/resourcevar.h>

Modified: head/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- head/sys/amd64/ia32/ia32_signal.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/amd64/ia32/ia32_signal.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/mman.h>
 #include <sys/namei.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/procfs.h>
 #include <sys/resourcevar.h>

Modified: head/sys/amd64/ia32/ia32_syscall.c
==============================================================================
--- head/sys/amd64/ia32/ia32_syscall.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/amd64/ia32/ia32_syscall.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
-#include <sys/pioctl.h>
 #include <sys/kernel.h>
 #include <sys/ktr.h>
 #include <sys/lock.h>

Modified: head/sys/arm/arm/syscall.c
==============================================================================
--- head/sys/arm/arm/syscall.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/arm/arm/syscall.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -92,7 +92,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysent.h>
 #include <sys/signalvar.h>
 #include <sys/ptrace.h>
-#include <sys/pioctl.h>
 
 #include <machine/frame.h>
 

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/arm64/arm64/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/ktr.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/ptrace.h>
 #include <sys/syscall.h>

Modified: head/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- head/sys/compat/ia32/ia32_sysvec.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/compat/ia32/ia32_sysvec.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/mman.h>
 #include <sys/namei.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/procfs.h>
 #include <sys/resourcevar.h>

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/conf/files	Wed Apr  1 19:22:09 2020	(r359530)
@@ -3517,7 +3517,6 @@ fs/nullfs/null_vnops.c		optional nullfs
 fs/procfs/procfs.c		optional procfs
 fs/procfs/procfs_dbregs.c	optional procfs
 fs/procfs/procfs_fpregs.c	optional procfs
-fs/procfs/procfs_ioctl.c	optional procfs
 fs/procfs/procfs_map.c		optional procfs
 fs/procfs/procfs_mem.c		optional procfs
 fs/procfs/procfs_note.c		optional procfs

Modified: head/sys/fs/procfs/procfs.c
==============================================================================
--- head/sys/fs/procfs/procfs.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/fs/procfs/procfs.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -163,7 +163,6 @@ procfs_init(PFS_INIT_ARGS)
 {
 	struct pfs_node *root;
 	struct pfs_node *dir;
-	struct pfs_node *node;
 
 	root = pi->pi_root;
 
@@ -182,10 +181,8 @@ procfs_init(PFS_INIT_ARGS)
 	    procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
 	pfs_create_file(dir, "map", procfs_doprocmap,
 	    NULL, procfs_notsystem, NULL, PFS_RD);
-	node = pfs_create_file(dir, "mem", procfs_doprocmem,
+	pfs_create_file(dir, "mem", procfs_doprocmem,
 	    procfs_attr_rw, procfs_candebug, NULL, PFS_RDWR | PFS_RAW);
-	node->pn_ioctl = procfs_ioctl;
-	node->pn_close = procfs_close;
 	pfs_create_file(dir, "note", procfs_doprocnote,
 	    procfs_attr_w, procfs_candebug, NULL, PFS_WR);
 	pfs_create_file(dir, "notepg", procfs_doprocnote,

Modified: head/sys/fs/procfs/procfs.h
==============================================================================
--- head/sys/fs/procfs/procfs.h	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/fs/procfs/procfs.h	Wed Apr  1 19:22:09 2020	(r359530)
@@ -53,8 +53,6 @@ int	 procfs_doprocregs(PFS_FILL_ARGS);
 int	 procfs_doprocrlimit(PFS_FILL_ARGS);
 int	 procfs_doprocstatus(PFS_FILL_ARGS);
 int	 procfs_doproctype(PFS_FILL_ARGS);
-int	 procfs_ioctl(PFS_IOCTL_ARGS);
-int	 procfs_close(PFS_CLOSE_ARGS);
 
 /* Attributes */
 int	 procfs_attr_w(PFS_ATTR_ARGS);

Modified: head/sys/i386/i386/trap.c
==============================================================================
--- head/sys/i386/i386/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/i386/i386/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
-#include <sys/pioctl.h>
 #include <sys/ptrace.h>
 #include <sys/kdb.h>
 #include <sys/kernel.h>

Modified: head/sys/i386/i386/vm_machdep.c
==============================================================================
--- head/sys/i386/i386/vm_machdep.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/i386/i386/vm_machdep.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/mutex.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/sysent.h>
 #include <sys/sf_buf.h>
@@ -208,15 +207,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t
 	td2->td_frame->tf_edx = 1;
 
 	/*
-	 * If the parent process has the trap bit set (i.e. a debugger had
-	 * single stepped the process to the system call), we need to clear
-	 * the trap flag from the new frame unless the debugger had set PF_FORK
-	 * on the parent.  Otherwise, the child will receive a (likely
-	 * unexpected) SIGTRAP when it executes the first instruction after
-	 * returning  to userland.
+	 * If the parent process has the trap bit set (i.e. a debugger
+	 * had single stepped the process to the system call), we need
+	 * to clear the trap flag from the new frame.
 	 */
-	if ((p1->p_pfsflags & PF_FORK) == 0)
-		td2->td_frame->tf_eflags &= ~PSL_T;
+	td2->td_frame->tf_eflags &= ~PSL_T;
 
 	/*
 	 * Set registers for trampoline to user mode.  Leave space for the

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/imgact_elf.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mount.h>
 #include <sys/mman.h>
 #include <sys/namei.h>
-#include <sys/pioctl.h>
 #include <sys/proc.h>
 #include <sys/procfs.h>
 #include <sys/ptrace.h>

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_exec.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mount.h>
 #include <sys/mutex.h>
 #include <sys/namei.h>
-#include <sys/pioctl.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
 #include <sys/ptrace.h>
@@ -912,12 +911,6 @@ exec_fail_dealloc:
 				td->td_dbgflags |= TDB_EXEC;
 			PROC_UNLOCK(p);
 		}
-
-		/*
-		 * Stop the process here if its stop event mask has
-		 * the S_EXEC bit set.
-		 */
-		STOPEVENT(p, S_EXEC, 0);
 	} else {
 exec_fail:
 		/* we're done here, clear P_INEXEC */

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_exit.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/procdesc.h>
-#include <sys/pioctl.h>
 #include <sys/jail.h>
 #include <sys/tty.h>
 #include <sys/wait.h>
@@ -281,15 +280,6 @@ exit1(struct thread *td, int rval, int signo)
 	p->p_xsig = signo;
 
 	/*
-	 * Wakeup anyone in procfs' PIOCWAIT.  They should have a hold
-	 * on our vmspace, so we should block below until they have
-	 * released their reference to us.  Note that if they have
-	 * requested S_EXIT stops we will block here until they ack
-	 * via PIOCCONT.
-	 */
-	_STOPEVENT(p, S_EXIT, 0);
-
-	/*
 	 * Ignore any pending request to stop due to a stop signal.
 	 * Once P_WEXIT is set, future requests will be ignored as
 	 * well.
@@ -297,13 +287,8 @@ exit1(struct thread *td, int rval, int signo)
 	p->p_flag &= ~P_STOPPED_SIG;
 	KASSERT(!P_SHOULDSTOP(p), ("exiting process is stopped"));
 
-	/*
-	 * Note that we are exiting and do another wakeup of anyone in
-	 * PIOCWAIT in case they aren't listening for S_EXIT stops or
-	 * decided to wait again after we told them we are exiting.
-	 */
+	/* Note that we are exiting. */
 	p->p_flag |= P_WEXIT;
-	wakeup(&p->p_stype);
 
 	/*
 	 * Wait for any processes that have a hold on our vmspace to

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_fork.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/priv.h>
 #include <sys/proc.h>
 #include <sys/procdesc.h>
-#include <sys/pioctl.h>
 #include <sys/ptrace.h>
 #include <sys/racct.h>
 #include <sys/resourcevar.h>
@@ -583,15 +582,6 @@ do_fork(struct thread *td, struct fork_req *fr, struct
 	callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0);
 
 	/*
-	 * If PF_FORK is set, the child process inherits the
-	 * procfs ioctl flags from its parent.
-	 */
-	if (p1->p_pfsflags & PF_FORK) {
-		p2->p_stops = p1->p_stops;
-		p2->p_pfsflags = p1->p_pfsflags;
-	}
-
-	/*
 	 * This begins the section where we must prevent the parent
 	 * from being swapped.
 	 */
@@ -1111,7 +1101,6 @@ fork_return(struct thread *td, struct trapframe *frame
 		 */
 		PROC_LOCK(p);
 		td->td_dbgflags |= TDB_SCX;
-		_STOPEVENT(p, S_SCX, td->td_sa.code);
 		if ((p->p_ptevents & PTRACE_SCX) != 0 ||
 		    (td->td_dbgflags & TDB_BORN) != 0)
 			ptracestop(td, SIGTRAP, NULL);

Modified: head/sys/kern/kern_prot.c
==============================================================================
--- head/sys/kern/kern_prot.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_prot.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/jail.h>
-#include <sys/pioctl.h>
 #include <sys/racct.h>
 #include <sys/rctl.h>
 #include <sys/resourcevar.h>
@@ -2192,8 +2191,6 @@ setsugid(struct proc *p)
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	p->p_flag |= P_SUGID;
-	if (!(p->p_pfsflags & PF_ISUGID))
-		p->p_stops = 0;
 }
 
 /*-

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_sig.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/procdesc.h>
 #include <sys/ptrace.h>
 #include <sys/posix4.h>
-#include <sys/pioctl.h>
 #include <sys/racct.h>
 #include <sys/resourcevar.h>
 #include <sys/sdt.h>
@@ -2256,14 +2255,6 @@ tdsendsignal(struct proc *p, struct thread *td, int si
 	    !((prop & SIGPROP_CONT) && (p->p_flag & P_STOPPED_SIG)))
 		return (ret);
 
-	/* SIGKILL: Remove procfs STOPEVENTs. */
-	if (sig == SIGKILL) {
-		/* from procfs_ioctl.c: PIOCBIC */
-		p->p_stops = 0;
-		/* from procfs_ioctl.c: PIOCCONT */
-		p->p_step = 0;
-		wakeup(&p->p_step);
-	}
 	wakeup_swapper = 0;
 
 	/*
@@ -2853,15 +2844,13 @@ issignal(struct thread *td)
 	struct sigqueue *queue;
 	sigset_t sigpending;
 	ksiginfo_t ksi;
-	int prop, sig, traced;
+	int prop, sig;
 
 	p = td->td_proc;
 	ps = p->p_sigacts;
 	mtx_assert(&ps->ps_mtx, MA_OWNED);
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	for (;;) {
-		traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG);
-
 		sigpending = td->td_sigqueue.sq_signals;
 		SIGSETOR(sigpending, p->p_sigqueue.sq_signals);
 		SIGSETNAND(sigpending, td->td_sigmask);
@@ -2904,17 +2893,12 @@ issignal(struct thread *td)
 			sig = sig_ffs(&sigpending);
 		}
 
-		if (p->p_stops & S_SIG) {
-			mtx_unlock(&ps->ps_mtx);
-			stopevent(p, S_SIG, sig);
-			mtx_lock(&ps->ps_mtx);
-		}
-
 		/*
 		 * We should see pending but ignored signals
 		 * only if P_TRACED was on when they were posted.
 		 */
-		if (SIGISMEMBER(ps->ps_sigignore, sig) && (traced == 0)) {
+		if (SIGISMEMBER(ps->ps_sigignore, sig) &&
+		    (p->p_flag & P_TRACED) == 0) {
 			sigqueue_delete(&td->td_sigqueue, sig);
 			sigqueue_delete(&p->p_sigqueue, sig);
 			continue;
@@ -3114,11 +3098,6 @@ postsig(int sig)
 		ktrpsig(sig, action, td->td_pflags & TDP_OLDMASK ?
 		    &td->td_oldsigmask : &td->td_sigmask, ksi.ksi_code);
 #endif
-	if ((p->p_stops & S_SIG) != 0) {
-		mtx_unlock(&ps->ps_mtx);
-		stopevent(p, S_SIG, sig);
-		mtx_lock(&ps->ps_mtx);
-	}
 
 	if (action == SIG_DFL) {
 		/*
@@ -3665,7 +3644,6 @@ coredump(struct thread *td)
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td);
-	_STOPEVENT(p, S_CORE, 0);
 
 	if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0) ||
 	    (p->p_flag2 & P2_NOTRACE) != 0) {

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/kern_thread.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -90,11 +90,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0xb0,
     "struct proc KBI p_flag");
 _Static_assert(offsetof(struct proc, p_pid) == 0xbc,
     "struct proc KBI p_pid");
-_Static_assert(offsetof(struct proc, p_filemon) == 0x3c8,
+_Static_assert(offsetof(struct proc, p_filemon) == 0x3c0,
     "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x3e0,
+_Static_assert(offsetof(struct proc, p_comm) == 0x3d8,
     "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c0,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b8,
     "struct proc KBI p_emuldata");
 #endif
 #ifdef __i386__
@@ -110,11 +110,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0x68,
     "struct proc KBI p_flag");
 _Static_assert(offsetof(struct proc, p_pid) == 0x74,
     "struct proc KBI p_pid");
-_Static_assert(offsetof(struct proc, p_filemon) == 0x278,
+_Static_assert(offsetof(struct proc, p_filemon) == 0x26c,
     "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x28c,
+_Static_assert(offsetof(struct proc, p_comm) == 0x280,
     "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x318,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x30c,
     "struct proc KBI p_emuldata");
 #endif
 

Modified: head/sys/kern/subr_syscall.c
==============================================================================
--- head/sys/kern/subr_syscall.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/subr_syscall.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -90,7 +90,6 @@ syscallenter(struct thread *td)
 		goto retval;
 	}
 
-	STOPEVENT(p, S_SCE, sa->narg);
 	if (__predict_false((p->p_flag & P_TRACED) != 0)) {
 		PROC_LOCK(p);
 		if (p->p_ptevents & PTRACE_SCE)
@@ -223,12 +222,6 @@ syscallret(struct thread *td)
 		td->td_dbgflags |= TDB_SCX;
 		PROC_UNLOCK(p);
 	}
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa->code);
 	if (__predict_false(traced ||
 	    (td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0)) {
 		PROC_LOCK(p);

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/subr_trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/pmckern.h>
 #include <sys/proc.h>
 #include <sys/ktr.h>
-#include <sys/pioctl.h>
 #include <sys/ptrace.h>
 #include <sys/racct.h>
 #include <sys/resourcevar.h>

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/kern/sys_process.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/syscallsubr.h>
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
-#include <sys/pioctl.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
 #include <sys/vnode.h>
@@ -1524,26 +1523,3 @@ fail:
 }
 #undef PROC_READ
 #undef PROC_WRITE
-
-/*
- * Stop a process because of a debugging event;
- * stay stopped until p->p_step is cleared
- * (cleared by PIOCCONT in procfs).
- */
-void
-stopevent(struct proc *p, unsigned int event, unsigned int val)
-{
-
-	PROC_LOCK_ASSERT(p, MA_OWNED);
-	p->p_step = 1;
-	CTR3(KTR_PTRACE, "stopevent: pid %d event %u val %u", p->p_pid, event,
-	    val);
-	do {
-		if (event != S_EXIT)
-			p->p_xsig = val;
-		p->p_xthread = NULL;
-		p->p_stype = event;	/* Which event caused the stop? */
-		wakeup(&p->p_stype);	/* Wake up any PIOCWAIT'ing procs */
-		msleep(&p->p_step, &p->p_mtx, PWAIT, "stopevent", 0);
-	} while (p->p_step);
-}

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/mips/mips/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/vnode.h>
-#include <sys/pioctl.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
 #include <sys/bus.h>

Modified: head/sys/modules/procfs/Makefile
==============================================================================
--- head/sys/modules/procfs/Makefile	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/modules/procfs/Makefile	Wed Apr  1 19:22:09 2020	(r359530)
@@ -7,7 +7,6 @@ SRCS=
 SRCS+=		vnode_if.h
 SRCS+=		procfs_dbregs.c
 SRCS+=		procfs_fpregs.c
-SRCS+=		procfs_ioctl.c
 SRCS+=		procfs_map.c
 SRCS+=		procfs_mem.c
 SRCS+=		procfs_note.c

Modified: head/sys/powerpc/powerpc/trap.c
==============================================================================
--- head/sys/powerpc/powerpc/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/powerpc/powerpc/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/ktr.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#include <sys/pioctl.h>
 #include <sys/ptrace.h>
 #include <sys/reboot.h>
 #include <sys/syscall.h>

Modified: head/sys/riscv/riscv/trap.c
==============================================================================
--- head/sys/riscv/riscv/trap.c	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/riscv/riscv/trap.c	Wed Apr  1 19:22:09 2020	(r359530)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/ktr.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
-#include <sys/pioctl.h>
 #include <sys/bus.h>
 #include <sys/proc.h>
 #include <sys/ptrace.h>

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/sys/param.h	Wed Apr  1 19:22:09 2020	(r359530)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300087	/* Master, propagated to newvers */
+#define __FreeBSD_version 1300088	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Wed Apr  1 19:09:47 2020	(r359529)
+++ head/sys/sys/proc.h	Wed Apr  1 19:22:09 2020	(r359530)
@@ -644,10 +644,6 @@ struct proc {
 	struct sigiolst	p_sigiolst;	/* (c) List of sigio sources. */
 	int		p_sigparent;	/* (c) Signal to parent on exit. */
 	int		p_sig;		/* (n) For core dump/debugger XXX. */
-	u_int		p_stops;	/* (c) Stop event bitmask. */
-	u_int		p_stype;	/* (c) Stop event type. */
-	char		p_step;		/* (c) Process is stopped. */
-	u_char		p_pfsflags;	/* (c) Procfs flags. */
 	u_int		p_ptevents;	/* (c + e) ptrace() event mask. */
 	struct nlminfo	*p_nlminfo;	/* (?) Only used by/for lockd. */
 	struct kaioinfo	*p_aioinfo;	/* (y) ASYNC I/O info. */
@@ -863,23 +859,6 @@ extern pid_t pid_max;
 
 #define	SESS_LEADER(p)	((p)->p_session->s_leader == (p))
 
-
-#define	STOPEVENT(p, e, v) do {						\
-	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,			\
- 	    "checking stopevent %d", (e));				\
-	if ((p)->p_stops & (e))	{					\
-		PROC_LOCK(p);						\
-		stopevent((p), (e), (v));				\
-		PROC_UNLOCK(p);						\
-	}								\
-} while (0)
-#define	_STOPEVENT(p, e, v) do {					\
-	PROC_LOCK_ASSERT(p, MA_OWNED);					\
-	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.lock_object, \
- 	    "checking stopevent %d", (e));				\
-	if ((p)->p_stops & (e))						\
-		stopevent((p), (e), (v));				\
-} while (0)
 
 /* Lock and unlock a process. */
 #define	PROC_LOCK(p)	mtx_lock(&(p)->p_mtx)


More information about the svn-src-all mailing list