Commit f2e3a5d6 authored by Ingo Molnar's avatar Ingo Molnar

[PATCH] ptrace-fix-2.5.34-A2, BK-curr

I distilled the attached fix-patch from Daniel's bigger patch - it
includes all fixes for all currently known ptrace related breakages,
which include things like bad behavior (crash) if the tracer process
dies unexpectedly.
parent 44b2d32a
......@@ -465,7 +465,8 @@ static inline void forget_original_parent(struct task_struct * father)
*/
list_for_each(_p, &father->children) {
p = list_entry(_p,struct task_struct,sibling);
reparent_thread(p, reaper, child_reaper);
if (father == p->real_parent)
reparent_thread(p, reaper, child_reaper);
}
list_for_each(_p, &father->ptrace_children) {
p = list_entry(_p,struct task_struct,ptrace_list);
......@@ -485,9 +486,16 @@ static inline void zap_thread(task_t *p, task_t *father, int traced)
p->ptrace = ptrace_flag;
__ptrace_link(p, trace_task);
} else {
/* Otherwise, if we were tracing this thread, untrace it. */
/*
* Otherwise, if we were tracing this thread, untrace it.
* If we were only tracing the thread (i.e. not its real
* parent), stop here.
*/
ptrace_unlink (p);
if (p->parent != father) {
BUG_ON(p->parent != p->real_parent);
return;
}
list_del_init(&p->sibling);
p->parent = p->real_parent;
list_add_tail(&p->sibling, &p->parent->children);
......
......@@ -790,6 +790,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
if (clone_flags & CLONE_CLEARTID)
p->user_tid = user_tid;
/*
* Syscall tracing should be turned off in the child regardless
* of CLONE_PTRACE.
*/
clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
/* Our parent execution domain becomes current domain
These must match for thread signalling to apply */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment