[PATCH 02] ptrace_check_attach: check child->parent

Oleg Nesterov oleg at redhat.com
Thu Aug 13 17:12:17 UTC 2009


ptrace_check_attach() forgets to check we are the tracer, check ->parent.
We can do this without tasklist_lock.

---

--- PU/kernel/ptrace.c~02_CHECK_ATTACH	2009-08-13 15:34:29.000000000 +0200
+++ PU/kernel/ptrace.c	2009-08-13 17:04:49.000000000 +0200
@@ -576,6 +576,9 @@ int ptrace_check_attach(struct task_stru
 	struct utrace_examiner exam;
 	int ret;
 
+	if (child->parent != current)
+		return -ESRCH;
+
 	engine = utrace_attach_task(child, UTRACE_ATTACH_MATCH_OPS,
 				    &ptrace_utrace_ops, NULL);
 	if (IS_ERR(engine))




More information about the utrace-devel mailing list