Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165674
b: refs/heads/master
c: 0b7570e
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Sep 24, 2009
1 parent 239e7f0 commit 5c5e357
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 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: a2322e1d272938d192d8c24cdacf57c0c7a2683f
refs/heads/master: 0b7570e77f7c3abd43107dabc47ea89daf9a1cba
25 changes: 21 additions & 4 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ struct wait_opts {
int __user *wo_stat;
struct rusage __user *wo_rusage;

wait_queue_t child_wait;
int notask_error;
};

Expand Down Expand Up @@ -1570,20 +1571,35 @@ static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk)
return 0;
}

static int child_wait_callback(wait_queue_t *wait, unsigned mode,
int sync, void *key)
{
struct wait_opts *wo = container_of(wait, struct wait_opts,
child_wait);
struct task_struct *p = key;

if (!eligible_child(wo, p))
return 0;

return default_wake_function(wait, mode, sync, key);
}

void __wake_up_parent(struct task_struct *p, struct task_struct *parent)
{
wake_up_interruptible_sync(&parent->signal->wait_chldexit);
__wake_up_sync_key(&parent->signal->wait_chldexit,
TASK_INTERRUPTIBLE, 1, p);
}

static long do_wait(struct wait_opts *wo)
{
DECLARE_WAITQUEUE(wait, current);
struct task_struct *tsk;
int retval;

trace_sched_process_wait(wo->wo_pid);

add_wait_queue(&current->signal->wait_chldexit,&wait);
init_waitqueue_func_entry(&wo->child_wait, child_wait_callback);
wo->child_wait.private = current;
add_wait_queue(&current->signal->wait_chldexit, &wo->child_wait);
repeat:
/*
* If there is nothing that can match our critiera just get out.
Expand Down Expand Up @@ -1624,7 +1640,8 @@ static long do_wait(struct wait_opts *wo)
}
end:
__set_current_state(TASK_RUNNING);
remove_wait_queue(&current->signal->wait_chldexit,&wait);
remove_wait_queue(&current->signal->wait_chldexit, &wo->child_wait);

if (wo->wo_info) {
struct siginfo __user *infop = wo->wo_info;

Expand Down
2 changes: 1 addition & 1 deletion trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
/* Wake up the parent if it is waiting so that it can recheck
* wait permission to the new task SID. */
read_lock(&tasklist_lock);
wake_up_interruptible(&current->real_parent->signal->wait_chldexit);
__wake_up_parent(current, current->real_parent);
read_unlock(&tasklist_lock);
}

Expand Down

0 comments on commit 5c5e357

Please sign in to comment.