public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-kernel@vger.kernel.org, dhowells@redhat.com,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2.6.29.6 - 2.6.35-rc3] CRED: Release spinlock before commit_creds().
Date: Thu, 17 Jun 2010 22:40:22 -0500	[thread overview]
Message-ID: <20100618034022.GA3500@hallyn.com> (raw)
In-Reply-To: <201006180308.o5I38O34094551@www262.sakura.ne.jp>

Quoting Tetsuo Handa (penguin-kernel@I-love.SAKURA.ne.jp):
> reparent_to_kthreadd() is calling commit_creds() with tasklist_lock held. But
> commit_creds() calls key_fsuid_changed()/key_fsgid_changed()/proc_id_connector()
> which may sleep. Release tasklist_lock before calling commit_creds().
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

The reparenting is done in current context, so current_cred can't go
away, and init_cred can't go away.  And I can't think of anything
nefarious anyone could do to the task on account of the previous
credentials (as a result of the reparenting) before commit_creds()
completes.  So it looks good to me, but David might know of a reason
why it isn't...  Anyway:

Acked-by: Serge E. Hallyn <serge@hallyn.com>

> ---
>  kernel/exit.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- security-testing-2.6.orig/kernel/exit.c
> +++ security-testing-2.6/kernel/exit.c
> @@ -348,8 +348,8 @@ static void reparent_to_kthreadd(void)
>  	       sizeof(current->signal->rlim));
>  
>  	atomic_inc(&init_cred.usage);
> -	commit_creds(&init_cred);
>  	write_unlock_irq(&tasklist_lock);
> +	commit_creds(&init_cred);
>  }
>  
>  void __set_special_pids(struct pid *pid)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-06-18  3:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18  3:08 [PATCH 2.6.29.6 - 2.6.35-rc3] CRED: Release spinlock before commit_creds() Tetsuo Handa
2010-06-18  3:40 ` Serge E. Hallyn [this message]
2010-06-18 15:45 ` David Howells

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=20100618034022.GA3500@hallyn.com \
    --to=serge@hallyn.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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