Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164395459
D58334.id182221.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58334.id182221.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D58334: kern_ptrace(): reduce code duplication
Attached
Detach File
Event Timeline
Log In to Comment