All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov,
	jwcart2@tycho.nsa.gov, sds@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:41:49 -0500	[thread overview]
Message-ID: <20090730194149.GA20292@us.ibm.com> (raw)
In-Reply-To: <1248976383.2771.4.camel@localhost>

Quoting Eric Paris (eparis@redhat.com):
> 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.
> 
> Easy enough, if I add PF_SUPERPRIV can I add your ACK?  Basically just

Yup.

> ret = cap_capable();
> if (!ret)
> 	current->flags |= PF_SUPERPRIV;
> 
> return ret;

Yup.  (Maybe spell out 'if (ret == 0)' to help people keep straight
that 0 means ok with cap_capable(), but it's up to you)

thanks,
-serge

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov,
	jwcart2@tycho.nsa.gov, sds@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:41:49 -0500	[thread overview]
Message-ID: <20090730194149.GA20292@us.ibm.com> (raw)
In-Reply-To: <1248976383.2771.4.camel@localhost>

Quoting Eric Paris (eparis@redhat.com):
> 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.
> 
> Easy enough, if I add PF_SUPERPRIV can I add your ACK?  Basically just

Yup.

> ret = cap_capable();
> if (!ret)
> 	current->flags |= PF_SUPERPRIV;
> 
> return ret;

Yup.  (Maybe spell out 'if (ret == 0)' to help people keep straight
that 0 means ok with cap_capable(), but it's up to you)

thanks,
-serge

  reply	other threads:[~2009-07-30 19:41 UTC|newest]

Thread overview: 32+ 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 ` 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   ` Eric Paris
2009-07-29 18:56 ` [PATCH -v3 3/3] Security/SELinux: seperate lsm specific mmap_min_addr Eric Paris
2009-07-29 18:56   ` 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  5:14   ` Serge E. Hallyn
2009-07-30 15:40   ` Eric Paris
2009-07-30 15:40     ` Eric Paris
2009-07-30 15:54     ` Serge E. Hallyn
2009-07-30 15:54       ` Serge E. Hallyn
2009-07-30 15:58       ` Stephen Smalley
2009-07-30 15:58         ` Stephen Smalley
2009-07-30 17:50         ` Eric Paris
2009-07-30 17:50           ` Eric Paris
2009-07-30 18:31           ` Eric Paris
2009-07-30 18:31             ` Eric Paris
2009-07-30 19:47             ` Stephen Smalley
2009-07-30 19:47               ` Stephen Smalley
2009-07-30 19:42           ` Stephen Smalley
2009-07-30 19:42             ` Stephen Smalley
2009-07-30 19:54             ` Stephen Smalley
2009-07-30 19:54               ` Stephen Smalley
2009-07-30 20:01             ` Serge E. Hallyn
2009-07-30 20:01               ` Serge E. Hallyn
2009-07-30 20:05               ` Stephen Smalley
2009-07-30 20:05                 ` Stephen Smalley
2009-07-30 17:53       ` Eric Paris
2009-07-30 17:53         ` Eric Paris
2009-07-30 19:41         ` Serge E. Hallyn [this message]
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=20090730194149.GA20292@us.ibm.com \
    --to=serue@us.ibm.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=eparis@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.