Index: head/ObsoleteFiles.inc =================================================================== --- head/ObsoleteFiles.inc +++ head/ObsoleteFiles.inc @@ -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 Index: head/lib/libsysdecode/Makefile =================================================================== --- head/lib/libsysdecode/Makefile +++ head/lib/libsysdecode/Makefile @@ -119,11 +119,6 @@ # Workaround duplicate declarations in CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls -# Ignore deprecation warning in -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 Index: head/sys/amd64/amd64/trap.c =================================================================== --- head/sys/amd64/amd64/trap.c +++ head/sys/amd64/amd64/trap.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include Index: head/sys/amd64/amd64/vm_machdep.c =================================================================== --- head/sys/amd64/amd64/vm_machdep.c +++ head/sys/amd64/amd64/vm_machdep.c @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -198,15 +197,11 @@ 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 Index: head/sys/amd64/ia32/ia32_reg.c =================================================================== --- head/sys/amd64/ia32/ia32_reg.c +++ head/sys/amd64/ia32/ia32_reg.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include Index: head/sys/amd64/ia32/ia32_signal.c =================================================================== --- head/sys/amd64/ia32/ia32_signal.c +++ head/sys/amd64/ia32/ia32_signal.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include Index: head/sys/amd64/ia32/ia32_syscall.c =================================================================== --- head/sys/amd64/ia32/ia32_syscall.c +++ head/sys/amd64/ia32/ia32_syscall.c @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include Index: head/sys/arm/arm/syscall.c =================================================================== --- head/sys/arm/arm/syscall.c +++ head/sys/arm/arm/syscall.c @@ -92,7 +92,6 @@ #include #include #include -#include #include Index: head/sys/arm64/arm64/trap.c =================================================================== --- head/sys/arm64/arm64/trap.c +++ head/sys/arm64/arm64/trap.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include Index: head/sys/compat/ia32/ia32_sysvec.c =================================================================== --- head/sys/compat/ia32/ia32_sysvec.c +++ head/sys/compat/ia32/ia32_sysvec.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include Index: head/sys/conf/files =================================================================== --- head/sys/conf/files +++ head/sys/conf/files @@ -3517,7 +3517,6 @@ 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 Index: head/sys/fs/procfs/procfs.h =================================================================== --- head/sys/fs/procfs/procfs.h +++ head/sys/fs/procfs/procfs.h @@ -53,8 +53,6 @@ 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); Index: head/sys/fs/procfs/procfs.c =================================================================== --- head/sys/fs/procfs/procfs.c +++ head/sys/fs/procfs/procfs.c @@ -163,7 +163,6 @@ { struct pfs_node *root; struct pfs_node *dir; - struct pfs_node *node; root = pi->pi_root; @@ -182,10 +181,8 @@ 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, Index: head/sys/fs/procfs/procfs_ioctl.c =================================================================== --- head/sys/fs/procfs/procfs_ioctl.c +++ head/sys/fs/procfs/procfs_ioctl.c @@ -1,263 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2001 Dag-Erling Coïdan Smørgrav - * All rights reserved. - * - * 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 - * in this position and unchanged. - * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef COMPAT_FREEBSD32 -struct procfs_status32 { - int state; /* Running, stopped, something else? */ - int flags; /* Any flags */ - unsigned int events; /* Events to stop on */ - int why; /* What event, if any, proc stopped on */ - unsigned int val; /* Any extra data */ -}; - -#define PIOCWAIT32 _IOR('p', 4, struct procfs_status32) -#define PIOCSTATUS32 _IOR('p', 6, struct procfs_status32) -#endif - -/* - * Process ioctls - */ -int -procfs_ioctl(PFS_IOCTL_ARGS) -{ - struct procfs_status *ps; -#ifdef COMPAT_FREEBSD32 - struct procfs_status32 *ps32; -#endif - int error, flags, sig; -#ifdef COMPAT_FREEBSD6 - int ival; -#endif - static struct timeval lasttime; - static struct timeval interval = { .tv_sec = 1, .tv_usec = 0 }; - - KASSERT(p != NULL, - ("%s() called without a process", __func__)); - PROC_LOCK_ASSERT(p, MA_OWNED); - - switch (cmd) { -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 1, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 1): -#endif - case PIOCBIS: -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 2, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 2): -#endif - case PIOCBIC: -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 3, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 3): -#endif - case PIOCSFL: - case PIOCGFL: - case PIOCWAIT: - case PIOCSTATUS: -#ifdef COMPAT_FREEBSD32 - case PIOCWAIT32: - case PIOCSTATUS32: -#endif -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 5, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 5): -#endif - case PIOCCONT: - if (ratecheck(&lasttime, &interval) != 0) - gone_in(13, "procfs-based process debugging"); - break; - } - - error = 0; - switch (cmd) { -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 1, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 1): - ival = IOCPARM_IVAL(data); - data = &ival; -#endif - case PIOCBIS: - p->p_stops |= *(unsigned int *)data; - break; -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 2, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 2): - ival = IOCPARM_IVAL(data); - data = &ival; -#endif - case PIOCBIC: - p->p_stops &= ~*(unsigned int *)data; - break; -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 3, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 3): - ival = IOCPARM_IVAL(data); - data = &ival; -#endif - case PIOCSFL: - flags = *(unsigned int *)data; - if (flags & PF_ISUGID) { - /* - * XXXRW: Is this specific check required here, as - * p_candebug() should implement it, or other checks - * are missing. - */ - error = priv_check(td, PRIV_DEBUG_SUGID); - if (error) - break; - } - p->p_pfsflags = flags; - break; - case PIOCGFL: - *(unsigned int *)data = p->p_pfsflags; - break; - case PIOCWAIT: - while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { - /* sleep until p stops */ - _PHOLD(p); - error = msleep(&p->p_stype, &p->p_mtx, - PWAIT|PCATCH, "pioctl", 0); - _PRELE(p); - if (error != 0) - break; - } - /* fall through to PIOCSTATUS */ - case PIOCSTATUS: - ps = (struct procfs_status *)data; - ps->state = (p->p_step == 0); - ps->flags = 0; /* nope */ - ps->events = p->p_stops; - ps->why = p->p_step ? p->p_stype : 0; - ps->val = p->p_step ? p->p_xsig : 0; - break; -#ifdef COMPAT_FREEBSD32 - case PIOCWAIT32: - while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { - /* sleep until p stops */ - _PHOLD(p); - error = msleep(&p->p_stype, &p->p_mtx, - PWAIT|PCATCH, "pioctl", 0); - _PRELE(p); - if (error != 0) - break; - } - /* fall through to PIOCSTATUS32 */ - case PIOCSTATUS32: - ps32 = (struct procfs_status32 *)data; - ps32->state = (p->p_step == 0); - ps32->flags = 0; /* nope */ - ps32->events = p->p_stops; - ps32->why = p->p_step ? p->p_stype : 0; - ps32->val = p->p_step ? p->p_xsig : 0; - break; -#endif -#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IOC(IOC_IN, 'p', 5, 0): -#endif -#ifdef COMPAT_FREEBSD6 - case _IO('p', 5): - ival = IOCPARM_IVAL(data); - data = &ival; -#endif - case PIOCCONT: - if (p->p_step == 0) - break; - sig = *(unsigned int *)data; - if (sig != 0 && !_SIG_VALID(sig)) { - error = EINVAL; - break; - } -#if 0 - p->p_step = 0; - if (P_SHOULDSTOP(p)) { - p->p_xsig = sig; - p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG); - PROC_SLOCK(p); - thread_unsuspend(p); - PROC_SUNLOCK(p); - } else if (sig) - kern_psignal(p, sig); -#else - if (sig) - kern_psignal(p, sig); - p->p_step = 0; - wakeup(&p->p_step); -#endif - break; - default: - error = (ENOTTY); - } - - return (error); -} - -/* - * Clean up on last close - */ -int -procfs_close(PFS_CLOSE_ARGS) -{ - if (p != NULL && (p->p_pfsflags & PF_LINGER) == 0) { - PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_pfsflags = 0; - p->p_stops = 0; - p->p_step = 0; - wakeup(&p->p_step); - } - return (0); -} Index: head/sys/i386/i386/trap.c =================================================================== --- head/sys/i386/i386/trap.c +++ head/sys/i386/i386/trap.c @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include Index: head/sys/i386/i386/vm_machdep.c =================================================================== --- head/sys/i386/i386/vm_machdep.c +++ head/sys/i386/i386/vm_machdep.c @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include @@ -208,15 +207,11 @@ 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 Index: head/sys/kern/imgact_elf.c =================================================================== --- head/sys/kern/imgact_elf.c +++ head/sys/kern/imgact_elf.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include Index: head/sys/kern/kern_exec.c =================================================================== --- head/sys/kern/kern_exec.c +++ head/sys/kern/kern_exec.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -912,12 +911,6 @@ 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 */ Index: head/sys/kern/kern_exit.c =================================================================== --- head/sys/kern/kern_exit.c +++ head/sys/kern/kern_exit.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -281,15 +280,6 @@ 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 @@ 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 Index: head/sys/kern/kern_fork.c =================================================================== --- head/sys/kern/kern_fork.c +++ head/sys/kern/kern_fork.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -583,15 +582,6 @@ 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 @@ */ 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); Index: head/sys/kern/kern_prot.c =================================================================== --- head/sys/kern/kern_prot.c +++ head/sys/kern/kern_prot.c @@ -65,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -2192,8 +2191,6 @@ PROC_LOCK_ASSERT(p, MA_OWNED); p->p_flag |= P_SUGID; - if (!(p->p_pfsflags & PF_ISUGID)) - p->p_stops = 0; } /*- Index: head/sys/kern/kern_sig.c =================================================================== --- head/sys/kern/kern_sig.c +++ head/sys/kern/kern_sig.c @@ -67,7 +67,6 @@ #include #include #include -#include #include #include #include @@ -2256,14 +2255,6 @@ !((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 @@ 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 @@ 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 @@ 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 @@ 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) { Index: head/sys/kern/kern_thread.c =================================================================== --- head/sys/kern/kern_thread.c +++ head/sys/kern/kern_thread.c @@ -90,11 +90,11 @@ "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 @@ "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 Index: head/sys/kern/subr_syscall.c =================================================================== --- head/sys/kern/subr_syscall.c +++ head/sys/kern/subr_syscall.c @@ -90,7 +90,6 @@ 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 @@ 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); Index: head/sys/kern/subr_trap.c =================================================================== --- head/sys/kern/subr_trap.c +++ head/sys/kern/subr_trap.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include Index: head/sys/kern/sys_process.c =================================================================== --- head/sys/kern/sys_process.c +++ head/sys/kern/sys_process.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -1524,26 +1523,3 @@ } #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); -} Index: head/sys/mips/mips/trap.c =================================================================== --- head/sys/mips/mips/trap.c +++ head/sys/mips/mips/trap.c @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include Index: head/sys/modules/procfs/Makefile =================================================================== --- head/sys/modules/procfs/Makefile +++ head/sys/modules/procfs/Makefile @@ -7,7 +7,6 @@ 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 Index: head/sys/powerpc/powerpc/trap.c =================================================================== --- head/sys/powerpc/powerpc/trap.c +++ head/sys/powerpc/powerpc/trap.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include Index: head/sys/riscv/riscv/trap.c =================================================================== --- head/sys/riscv/riscv/trap.c +++ head/sys/riscv/riscv/trap.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include Index: head/sys/sys/param.h =================================================================== --- head/sys/sys/param.h +++ head/sys/sys/param.h @@ -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, Index: head/sys/sys/pioctl.h =================================================================== --- head/sys/sys/pioctl.h +++ head/sys/sys/pioctl.h @@ -1,85 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright 1997 Sean Eric Fagan - * - * 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 Sean Eric Fagan - * 4. Neither the name of the author may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 ioctl definitions. - * - * $FreeBSD$ - */ - -#ifndef _SYS_PIOCTL_H -# define _SYS_PIOCTL_H - -#ifndef _KERNEL -#warning " is deprecated, ptrace() should be used instead" -#endif - -# include - -struct procfs_status { - int state; /* Running, stopped, something else? */ - int flags; /* Any flags */ - unsigned long events; /* Events to stop on */ - int why; /* What event, if any, proc stopped on */ - unsigned long val; /* Any extra data */ -}; - -# define PIOCBIS _IOWINT('p', 1) /* Set event flag */ -# define PIOCBIC _IOWINT('p', 2) /* Clear event flag */ -# define PIOCSFL _IOWINT('p', 3) /* Set flags */ - /* wait for proc to stop */ -# define PIOCWAIT _IOR('p', 4, struct procfs_status) -# define PIOCCONT _IOWINT('p', 5) /* Continue a process */ - /* Get proc status */ -# define PIOCSTATUS _IOR('p', 6, struct procfs_status) -# define PIOCGFL _IOR('p', 7, unsigned int) /* Get flags */ - -# define S_EXEC 0x00000001 /* stop-on-exec */ -# define S_SIG 0x00000002 /* stop-on-signal */ -# define S_SCE 0x00000004 /* stop on syscall entry */ -# define S_SCX 0x00000008 /* stop on syscall exit */ -# define S_CORE 0x00000010 /* stop on coredump */ -# define S_EXIT 0x00000020 /* stop on exit */ -# define S_ALLSTOPS 0x003f /* stop on all events */ - -/* - * If PF_LINGER is set in procp->p_pfsflags, then the last close - * of a /proc//mem file will not clear out the stops and continue - * the process. - */ - -# define PF_LINGER 0x01 /* Keep stops around after last close */ -# define PF_ISUGID 0x02 /* Ignore UID/GID changes */ -# define PF_FORK 0x04 /* Retain settings on fork() */ -#endif Index: head/sys/sys/proc.h =================================================================== --- head/sys/sys/proc.h +++ head/sys/sys/proc.h @@ -644,10 +644,6 @@ 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 @@ #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)