Page MenuHomeFreeBSD

D58334.id182221.diff
No OneTemporary

D58334.id182221.diff

diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -923,7 +923,7 @@
}
static int
-proc_can_ptrace(struct thread *td, struct proc *p)
+proc_can_ptrace1(struct thread *td, struct proc *p)
{
int error;
@@ -931,11 +931,22 @@
if ((p->p_flag & P_WEXIT) != 0)
return (ESRCH);
-
if ((error = p_cansee(td, p)) != 0)
return (error);
if ((error = p_candebug(td, p)) != 0)
return (error);
+ return (0);
+}
+
+static int
+proc_can_ptrace(struct thread *td, struct proc *p)
+{
+ int error;
+
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+
+ if ((error = proc_can_ptrace1(td, p)) != 0)
+ return (error);
/* not being traced... */
if ((p->p_flag & P_TRACED) == 0)
@@ -1041,14 +1052,8 @@
}
AUDIT_ARG_PROCESS(p);
- if ((p->p_flag & P_WEXIT) != 0) {
- error = ESRCH;
- goto fail;
- }
- if ((error = p_cansee(td, p)) != 0)
- goto fail;
-
- if ((error = p_candebug(td, p)) != 0)
+ error = proc_can_ptrace1(td, p);
+ if (error != 0)
goto fail;
/*

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 1, 12:40 PM (4 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35259048
Default Alt Text
D58334.id182221.diff (1 KB)

Event Timeline