From: Chris Wright <chrisw@osdl.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Chris Wright <chrisw@osdl.org>, Andrew Morton <akpm@osdl.org>,
Stephen Smalley <sds@epoch.ncsc.mil>,
James Morris <jmorris@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Split bprm_apply_creds into two functions
Date: Thu, 16 Dec 2004 10:19:49 -0800 [thread overview]
Message-ID: <20041216101949.P2357@build.pdx.osdl.net> (raw)
In-Reply-To: <20041216181613.GB3260@IBM-BWN8ZTBWA01.austin.ibm.com>; from serue@us.ibm.com on Thu, Dec 16, 2004 at 12:16:13PM -0600
* Serge E. Hallyn (serue@us.ibm.com) wrote:
> Quoting Chris Wright (chrisw@osdl.org):
> > * Serge E. Hallyn (serue@us.ibm.com) wrote:
> > > The security_bprm_apply_creds() function is called from
> > > fs/exec.c:compute_creds() under task_lock(current). SELinux must
> > > perform some work which is unsafe in that context, and therefore
> > > explicitly drops the task_lock, does the work, and re-acquires the
> > > task_lock. This is unsafe if other security modules are stacked after
> > > SELinux, as their bprm_apply_creds assumes that the 'unsafe' variable is
> > > still meaningful, that is, that the task_lock has not been dropped.
> >
> > I don't like this approach. The whole point is to ensure safety, and
> > avoid races that have been found in the past. This gives a new interface
> > that could be easily used under the wrong conditions, and breaking
> > the interface into two pieces looks kinda hackish. Is there no other
> > solution? I looked at this once before and wondered why task_unlock()
> > is needed to call avc_audit? audit should be as lock friendly as printk
> > IMO, and I don't recall seeing any deadlock after short review of it.
> > But I didn't get much beyond that. Is it all the flushing that can't
> > hold task_lock?
>
> As Stephen points out, it was more a concern about lock nesting. The
> attached patch simply removes the task_unlock from selinux_bprm_apply_creds,
> and runs just fine on my machine. Stephen, do you have a preference
> either way, or was the task_unlock to relieve the concerns of others?
Unfortunately, running fine isn't indication that it's not
deadlock-able. Issues are making sure nesting is appropriate, as
task_lock is normally inner lock, and making sure normal things like not
taking sem when holding spinlock. It requires more inspection than just
running.
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
next prev parent reply other threads:[~2004-12-16 18:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-15 20:00 Serge E. Hallyn
2004-12-15 21:15 ` Stephen Smalley
2004-12-16 18:25 ` Serge E. Hallyn
2004-12-17 14:10 ` Stephen Smalley
2004-12-17 17:03 ` Chris Wright
2004-12-17 19:32 ` Serge E. Hallyn
2004-12-15 22:52 ` Chris Wright
2004-12-16 12:47 ` Stephen Smalley
2004-12-16 18:16 ` Serge E. Hallyn
2004-12-16 18:16 ` Stephen Smalley
2004-12-16 18:19 ` Chris Wright [this message]
2005-01-04 18:30 [PATCH] split " Serge E. Hallyn
2005-01-04 21:41 ` Stephen Smalley
2005-01-04 21:52 ` Chris Wright
2005-01-05 23:14 ` Chris Wright
2005-01-05 23:16 ` Chris Wright
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=20041216101949.P2357@build.pdx.osdl.net \
--to=chrisw@osdl.org \
--cc=akpm@osdl.org \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=serue@us.ibm.com \
/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
all inboxes | Powered by JetHome®