lkml.org 
[lkml]   [2002]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] ptrace-fix-2.5.33-A1

Linus,

the attached patch (against BK-curr) collects two ptrace related fixes:
first it undoes Ogawa's change (so various uses of ptrace works again),
plus it adds Daniel's suggested fix that allows a parent to PTRACE_ATTACH
to a child it forked. (this also fixes the incorrect BUG_ON() assert
Ogawa's patch was intended to fix in the first place.)

i've tested various ptrace uses and they appear to work just fine.

(Daniel, let us know if you can still see anything questionable in this
area - or if the ptrace list could be managed in a cleaner way.)

please apply,

Ingo

--- linux/kernel/exit.c.orig Thu Sep 5 17:25:47 2002
+++ linux/kernel/exit.c Thu Sep 5 17:27:06 2002
@@ -66,7 +66,8 @@
atomic_dec(&p->user->processes);
security_ops->task_free_security(p);
free_uid(p->user);
- BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
+ BUG_ON(p->ptrace || !list_empty(&p->ptrace_list) ||
+ !list_empty(&p->ptrace_children));
unhash_process(p);

release_thread(p);
@@ -718,8 +719,14 @@
ptrace_unlink(p);
do_notify_parent(p, SIGCHLD);
write_unlock_irq(&tasklist_lock);
- } else
+ } else {
+ if (p->ptrace) {
+ write_lock_irq(&tasklist_lock);
+ ptrace_unlink(p);
+ write_unlock_irq(&tasklist_lock);
+ }
release_task(p);
+ }
goto end_wait4;
default:
continue;
--- linux/kernel/ptrace.c.orig Thu Sep 5 17:28:40 2002
+++ linux/kernel/ptrace.c Thu Sep 5 17:28:47 2002
@@ -29,7 +29,7 @@
if (!list_empty(&child->ptrace_list))
BUG();
if (child->parent == new_parent)
- BUG();
+ return;
list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child);
child->parent = new_parent;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [from the cache]
©2003-2011 Jasper Spaans