Re: + execve-must-clear-current-clear_child_tid.patch added to -mmtree

From: Oleg Nesterov
Date: Fri Jul 31 2009 - 18:40:36 EST


> From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
>
> diff -puN fs/compat.c~execve-must-clear-current-clear_child_tid fs/compat.c
> --- a/fs/compat.c~execve-must-clear-current-clear_child_tid
> +++ a/fs/compat.c
> @@ -1550,6 +1550,7 @@ int compat_do_execve(char * filename,
> mutex_unlock(&current->cred_guard_mutex);
> acct_update_integrals(current);
> free_bprm(bprm);
> + current->clear_child_tid = NULL;
> if (displaced)
> put_files_struct(displaced);
> return retval;
> diff -puN fs/exec.c~execve-must-clear-current-clear_child_tid fs/exec.c
> --- a/fs/exec.c~execve-must-clear-current-clear_child_tid
> +++ a/fs/exec.c
> @@ -1343,6 +1343,7 @@ int do_execve(char * filename,
> mutex_unlock(&current->cred_guard_mutex);
> acct_update_integrals(current);
> free_bprm(bprm);
> + current->clear_child_tid = NULL;
> if (displaced)
> put_files_struct(displaced);
> return retval;

Perhaps it is better to change mm_release() ? It has to play with
->clear_child_tid anyway.

Oleg.

--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -568,18 +568,18 @@ void mm_release(struct task_struct *tsk,
* the value intact in a core dump, and to save the unnecessary
* trouble otherwise. Userland only wants this done for a sys_exit.
*/
- if (tsk->clear_child_tid
- && !(tsk->flags & PF_SIGNALED)
- && atomic_read(&mm->mm_users) > 1) {
- u32 __user * tidptr = tsk->clear_child_tid;
+ if (tsk->clear_child_tid) {
+ if (!(tsk->flags & PF_SIGNALED) &&
+ atomic_read(&mm->mm_users) > 1) {
+ /*
+ * We don't check the error code - if userspace has
+ * not set up a proper pointer then tough luck.
+ */
+ put_user(0, tsk->clear_child_tid);
+ sys_futex(tsk->clear_child_tid, FUTEX_WAKE,
+ 1, NULL, NULL, 0);
+ }
tsk->clear_child_tid = NULL;
-
- /*
- * We don't check the error code - if userspace has
- * not set up a proper pointer then tough luck.
- */
- put_user(0, tidptr);
- sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
}
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/