public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2.6.29.6 - 2.6.35-rc3] CRED: Release spinlock before commit_creds().
Date: Fri, 18 Jun 2010 16:45:43 +0100	[thread overview]
Message-ID: <21796.1276875943@redhat.com> (raw)
In-Reply-To: <201006180308.o5I38O34094551@www262.sakura.ne.jp>


Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> wrote:

> 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().

Hmmm...  Does this change leave a hole in which the thread can be accessed as
it's not locked away, but still has the old credentials?

I wonder if we should have an internal CLONE_KTHREAD flag to achieve this in
do_fork() rather than daemonize()'ing the thread later.

Also, key_fsuid_changed() and key_fsgid_changed() should be skipped in
commit_creds() if the thread-keyring pointer in the new creds is not the same
as that in the old creds (as will be the case if we're shifting to init_cred),
so they shouldn't really be a problem.

However, I can't see an easy way around proc_id_connector() sleeping - unless
we just don't call it if new == &init_cred in commit_creds().

I suppose it also leaves a hole if we call commit_creds() first, before
getting the write_lock()... :-/

David

      parent reply	other threads:[~2010-06-18 15:45 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
2010-06-18 15:45 ` David Howells [this message]

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=21796.1276875943@redhat.com \
    --to=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