Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26604
b: refs/heads/master
c: f358166
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed May 11, 2006
1 parent fa1e6ef commit 4ad085b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0e44dc383787b472a7f13564c6bd8a44cc07d408
refs/heads/master: f358166a9405e4f1d8e50d8f415c26d95505b6de
20 changes: 19 additions & 1 deletion trunk/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,26 @@ int ptrace_attach(struct task_struct *task)
if (task->tgid == current->tgid)
goto out;

write_lock_irq(&tasklist_lock);
repeat:
/*
* Nasty, nasty.
*
* We want to hold both the task-lock and the
* tasklist_lock for writing at the same time.
* But that's against the rules (tasklist_lock
* is taken for reading by interrupts on other
* cpu's that may have task_lock).
*/
task_lock(task);
local_irq_disable();
if (!write_trylock(&tasklist_lock)) {
local_irq_enable();
task_unlock(task);
do {
cpu_relax();
} while (!write_can_lock(&tasklist_lock));
goto repeat;
}

/* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED)
Expand Down

0 comments on commit 4ad085b

Please sign in to comment.