public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov,
	jwcart2@tycho.nsa.gov, spender@grsecurity.net, dwalsh@redhat.com,
	cl@linux-foundation.org, arjan@infradead.org,
	alan@lxorguk.ukuu.org.uk, kees@outflux.net, csellers@tresys.com,
	penguin-kernel@i-love.sakura.ne.jp
Subject: Re: [PATCH -v3 1/3] Capabilities: move cap_file_mmap to commoncap.c
Date: Thu, 30 Jul 2009 14:31:19 -0400	[thread overview]
Message-ID: <1248978679.2771.24.camel@localhost> (raw)
In-Reply-To: <1248976252.2771.1.camel@localhost>

On Thu, 2009-07-30 at 13:50 -0400, Eric Paris wrote:
> On Thu, 2009-07-30 at 11:58 -0400, Stephen Smalley wrote:
> > On Thu, 2009-07-30 at 10:54 -0500, Serge E. Hallyn wrote:
> > > Quoting Eric Paris (eparis@redhat.com):
> > > > On Thu, 2009-07-30 at 00:14 -0500, Serge E. Hallyn wrote:
> > > > > Quoting Eric Paris (eparis@redhat.com):
> > > > > > Currently we duplicate the mmap_min_addr test in cap_file_mmap and in
> > > > > > security_file_mmap if !CONFIG_SECURITY.  This patch moves cap_file_mmap
> > > > > > into commoncap.c and then calls that function directly from
> > > > > > security_file_mmap ifndef CONFIG_SECURITY like all of the other capability
> > > > > > checks are done.
> > > > > 
> > > > > It also
> > > > > 
> > > > > 	1. changes the return value in error case from -EACCES to
> > > > > 	   -EPERM
> > > > > 	2. no onger sets PF_SUPERPRIV in t->flags if the capability
> > > > > 	   is used.
> > > > > 
> > > > > Do we care about these?
> > > > 
> > > > Personally, not really, but I'll gladly put them back if you care.   #2
> > > > seems more interesting to me than number 1.   I actually kinda like
> > > > getting EPERM from caps rather than EACCES since them I know if I was
> > > > denied by selinux or by caps.....
> > > > 
> > > > -Eric
> > > 
> > > Yup, I asked bc I didn't particularly care myself.
> > > 
> > > I think I agree with you about -EPERM being better anyway.  However I
> > > (now) think in this case PF_SUPERPRIV definately should be set, as this
> > > is a clear use of a capability to do something that couldn't have been
> > > done without it.
> > 
> > On a related but different note, we should consider all current uses of
> > cap_capable(), as they represent capability checks that will not be
> > subject to a further restrictive check by other security modules.  In
> > this case and in the vm_enough_memory case, that is intentional, but not
> > so clear for other uses in commoncap.c.
> 
> Most of commoncap.c is called either as a secondary hook from the active
> lsm (aka selinux calls the commoncap.c functions) or in the !
> CONFIG_SECURITY case.
> 
> I'll audit this afternoon to see which of them might not fit these
> rules....

I just went through all of the cap_* function in commoncap.c to see
which of them are being or are not being called from the selinux hooks.
Only 3 of them look interesting.

cap_inode_setxattr
cap_inode_removexattr
cap_vm_enough_memory

All of the other functions are either called from hooks.c or SELinux
does not define that LSM hook, so it just defaults to the cap_* hook.

These 3 are all a bit odd because the logic inside the cap_ hook is
duplicated inside the selinux_ hook.  I'd much rather see the selinux_
hook call the cap_ hook.  I'm going to think on that topic, but it's a
different set of patches and I don't see missing checks today as the
logic seems to line up.

-Eric


  reply	other threads:[~2009-07-30 18:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 18:56 [PATCH -v3 1/3] Capabilities: move cap_file_mmap to commoncap.c Eric Paris
2009-07-29 18:56 ` [PATCH -v3 2/3] SELinux: call cap_file_mmap in selinux_file_mmap Eric Paris
2009-07-29 18:56 ` [PATCH -v3 3/3] Security/SELinux: seperate lsm specific mmap_min_addr Eric Paris
2009-07-30  5:14 ` [PATCH -v3 1/3] Capabilities: move cap_file_mmap to commoncap.c Serge E. Hallyn
2009-07-30 15:40   ` Eric Paris
2009-07-30 15:54     ` Serge E. Hallyn
2009-07-30 15:58       ` Stephen Smalley
2009-07-30 17:50         ` Eric Paris
2009-07-30 18:31           ` Eric Paris [this message]
2009-07-30 19:47             ` Stephen Smalley
2009-07-30 19:42           ` Stephen Smalley
2009-07-30 19:54             ` Stephen Smalley
2009-07-30 20:01             ` Serge E. Hallyn
2009-07-30 20:05               ` Stephen Smalley
2009-07-30 17:53       ` Eric Paris
2009-07-30 19:41         ` Serge E. Hallyn

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=1248978679.2771.24.camel@localhost \
    --to=eparis@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=cl@linux-foundation.org \
    --cc=csellers@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=jwcart2@tycho.nsa.gov \
    --cc=kees@outflux.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=serue@us.ibm.com \
    --cc=spender@grsecurity.net \
    /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