public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, eric.dumazet@gmail.com,
	drepper@redhat.com, jens@mcbone.net, mingo@elte.hu,
	peterz@infradead.org, sonnyrao@us.ibm.com, stable@kernel.org,
	tglx@linutronix.de, torvalds@linux-foundation.org
Subject: Re: + execve-must-clear-current-clear_child_tid.patch added to -mm tree
Date: Sat, 1 Aug 2009 00:29:59 +0200	[thread overview]
Message-ID: <20090731222959.GA8195@redhat.com> (raw)
In-Reply-To: <200907312142.n6VLgKfx021454@imap1.linux-foundation.org>

> From: Eric Dumazet <eric.dumazet@gmail.com>
>
> 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);
 	}
 }
 


       reply	other threads:[~2009-07-31 22:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200907312142.n6VLgKfx021454@imap1.linux-foundation.org>
2009-07-31 22:29 ` Oleg Nesterov [this message]
2009-08-01  0:38   ` + execve-must-clear-current-clear_child_tid.patch added to -mm tree Linus Torvalds
2009-08-01  0:51     ` Andrew Morton
2009-08-01  1:54       ` [PATCH v2] execve: must clear current->clear_child_tid Oleg Nesterov
2009-08-01  6:12         ` Eric Dumazet
2009-08-01  6:44           ` Oleg Nesterov
2009-08-01  7:52             ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090731222959.GA8195@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jens@mcbone.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sonnyrao@us.ibm.com \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox