diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ptrace.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 745fc2dd00c5..e6098434b533 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -37,15 +37,23 @@ void __ptrace_link(struct task_struct *child, struct task_struct *new_parent) | |||
37 | child->parent = new_parent; | 37 | child->parent = new_parent; |
38 | } | 38 | } |
39 | 39 | ||
40 | /* | 40 | /** |
41 | * Turn a tracing stop into a normal stop now, since with no tracer there | 41 | * __ptrace_unlink - unlink ptracee and restore its execution state |
42 | * would be no way to wake it up with SIGCONT or SIGKILL. If there was a | 42 | * @child: ptracee to be unlinked |
43 | * signal sent that would resume the child, but didn't because it was in | 43 | * |
44 | * TASK_TRACED, resume it now. | 44 | * Remove @child from the ptrace list, move it back to the original parent. |
45 | * Requires that irqs be disabled. | 45 | * |
46 | * CONTEXT: | ||
47 | * write_lock_irq(tasklist_lock) | ||
46 | */ | 48 | */ |
47 | static void ptrace_untrace(struct task_struct *child) | 49 | void __ptrace_unlink(struct task_struct *child) |
48 | { | 50 | { |
51 | BUG_ON(!child->ptrace); | ||
52 | |||
53 | child->ptrace = 0; | ||
54 | child->parent = child->real_parent; | ||
55 | list_del_init(&child->ptrace_entry); | ||
56 | |||
49 | spin_lock(&child->sighand->siglock); | 57 | spin_lock(&child->sighand->siglock); |
50 | if (task_is_traced(child)) { | 58 | if (task_is_traced(child)) { |
51 | /* | 59 | /* |
@@ -70,24 +78,6 @@ static void ptrace_untrace(struct task_struct *child) | |||
70 | } | 78 | } |
71 | 79 | ||
72 | /* | 80 | /* |
73 | * unptrace a task: move it back to its original parent and | ||
74 | * remove it from the ptrace list. | ||
75 | * | ||
76 | * Must be called with the tasklist lock write-held. | ||
77 | */ | ||
78 | void __ptrace_unlink(struct task_struct *child) | ||
79 | { | ||
80 | BUG_ON(!child->ptrace); | ||
81 | |||
82 | child->ptrace = 0; | ||
83 | child->parent = child->real_parent; | ||
84 | list_del_init(&child->ptrace_entry); | ||
85 | |||
86 | if (task_is_traced(child)) | ||
87 | ptrace_untrace(child); | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * Check that we have indeed attached to the thing.. | 81 | * Check that we have indeed attached to the thing.. |
92 | */ | 82 | */ |
93 | int ptrace_check_attach(struct task_struct *child, int kill) | 83 | int ptrace_check_attach(struct task_struct *child, int kill) |