Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157000788
D23685.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D23685.diff
View Options
Index: sys/fs/procfs/procfs_ioctl.c
===================================================================
--- sys/fs/procfs/procfs_ioctl.c
+++ sys/fs/procfs/procfs_ioctl.c
@@ -65,7 +65,7 @@
#ifdef COMPAT_FREEBSD32
struct procfs_status32 *ps32;
#endif
- int error, flags, sig;
+ int error, flags;
#ifdef COMPAT_FREEBSD6
int ival;
#endif
@@ -85,7 +85,7 @@
data = &ival;
#endif
case PIOCBIS:
- p->p_stops |= *(unsigned int *)data;
+ error = EOPNOTSUPP;
break;
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
case _IOC(IOC_IN, 'p', 2, 0):
@@ -96,7 +96,7 @@
data = &ival;
#endif
case PIOCBIC:
- p->p_stops &= ~*(unsigned int *)data;
+ error = EOPNOTSUPP;
break;
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
case _IOC(IOC_IN, 'p', 3, 0):
@@ -124,43 +124,27 @@
*(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 */
+ error = EOPNOTSUPP;
+ break;
case PIOCSTATUS:
ps = (struct procfs_status *)data;
- ps->state = (p->p_step == 0);
+ ps->state = 1;
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;
+ ps->events = 0;
+ ps->why = 0;
+ ps->val = 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 */
+ error = EOPNOTSUPP;
+ break;
case PIOCSTATUS32:
ps32 = (struct procfs_status32 *)data;
- ps32->state = (p->p_step == 0);
+ ps32->state = 1;
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;
+ ps32->events = 0;
+ ps32->why = 0;
+ ps32->val = 0;
break;
#endif
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
@@ -172,29 +156,7 @@
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
+ error = EOPNOTSUPP;
break;
default:
error = (ENOTTY);
@@ -212,9 +174,6 @@
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: sys/kern/kern_exec.c
===================================================================
--- sys/kern/kern_exec.c
+++ sys/kern/kern_exec.c
@@ -908,12 +908,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: sys/kern/kern_exit.c
===================================================================
--- sys/kern/kern_exit.c
+++ sys/kern/kern_exit.c
@@ -280,15 +280,6 @@
p->p_xexit = rval;
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
@@ -303,7 +294,6 @@
* decided to wait again after we told them 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: sys/kern/kern_fork.c
===================================================================
--- sys/kern/kern_fork.c
+++ sys/kern/kern_fork.c
@@ -585,7 +585,6 @@
* procfs ioctl flags from its parent.
*/
if (p1->p_pfsflags & PF_FORK) {
- p2->p_stops = p1->p_stops;
p2->p_pfsflags = p1->p_pfsflags;
}
@@ -1109,7 +1108,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: sys/kern/kern_prot.c
===================================================================
--- sys/kern/kern_prot.c
+++ sys/kern/kern_prot.c
@@ -2191,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: sys/kern/kern_sig.c
===================================================================
--- sys/kern/kern_sig.c
+++ sys/kern/kern_sig.c
@@ -2248,14 +2248,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;
/*
@@ -2852,7 +2844,7 @@
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);
+ traced = (p->p_flag & P_TRACED);
sigpending = td->td_sigqueue.sq_signals;
SIGSETOR(sigpending, p->p_sigqueue.sq_signals);
@@ -2896,12 +2888,6 @@
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.
@@ -3106,11 +3092,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) {
/*
@@ -3655,7 +3636,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: sys/kern/subr_syscall.c
===================================================================
--- sys/kern/subr_syscall.c
+++ 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)
@@ -227,7 +226,6 @@
* 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: sys/kern/sys_process.c
===================================================================
--- sys/kern/sys_process.c
+++ sys/kern/sys_process.c
@@ -1524,26 +1524,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: sys/sys/proc.h
===================================================================
--- sys/sys/proc.h
+++ sys/sys/proc.h
@@ -641,9 +641,9 @@
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_int p_unused0;
+ u_int p_unused1;
+ char p_unused2;
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. */
@@ -860,24 +860,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)
#define PROC_TRYLOCK(p) mtx_trylock(&(p)->p_mtx)
@@ -1114,7 +1096,6 @@
void setsugid(struct proc *p);
int should_yield(void);
int sigonstack(size_t sp);
-void stopevent(struct proc *, u_int, u_int);
struct thread *tdfind(lwpid_t, pid_t);
void threadinit(void);
void tidhash_add(struct thread *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 9:29 PM (10 h, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33269656
Default Alt Text
D23685.diff (9 KB)
Attached To
Mode
D23685: Remove long broken procfs-based process tracing.
Attached
Detach File
Event Timeline
Log In to Comment