svn commit: r289660 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Tue Oct 20 20:22:59 UTC 2015
Author: kib
Date: Tue Oct 20 20:22:57 2015
New Revision: 289660
URL: https://svnweb.freebsd.org/changeset/base/289660
Log:
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
Modified:
head/sys/kern/sys_process.c
Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c Tue Oct 20 20:15:25 2015 (r289659)
+++ head/sys/kern/sys_process.c Tue Oct 20 20:22:57 2015 (r289660)
@@ -744,7 +744,18 @@ kern_ptrace(struct thread *td, int req,
*/
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:
More information about the svn-src-all
mailing list