mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-19 08:13:57 +00:00
Reviewed by: jhb, pho
Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D3908
This commit is contained in:
parent
16a5c008cc
commit
77b9bec37b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289660
|
@ -744,7 +744,18 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
|
|||
*/
|
||||
switch (req) {
|
||||
case PT_TRACE_ME:
|
||||
/* Always legal. */
|
||||
/*
|
||||
* Always legal, when there is a parent process which
|
||||
* could trace us. Otherwise, reject.
|
||||
*/
|
||||
if ((p->p_flag & P_TRACED) != 0) {
|
||||
error = EBUSY;
|
||||
goto fail;
|
||||
}
|
||||
if (p->p_pptr == initproc) {
|
||||
error = EPERM;
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
case PT_ATTACH:
|
||||
|
|
Loading…
Reference in a new issue