From: Chris Friedhoff <chris@friedhoff.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Stephen Smalley <sds@tycho.nsa.gov>,
James Morris <jmorris@namei.org>,
Chris Wright <chrisw@sous-sol.org>, Andrew Morton <akpm@osdl.org>,
KaiGai Kohei <kaigai@kaigai.gr.jp>
Subject: Re: [PATCH 1/1] security: introduce file posix caps
Date: Wed, 8 Nov 2006 19:50:59 +0100 [thread overview]
Message-ID: <20061108195059.0931837d.chris@friedhoff.org> (raw)
In-Reply-To: <20061108053229.GA23210@sergelap.austin.ibm.com>
The patch from Nov 7 2006 with this fix configures, compiles, installs
and runns smotthly on 2.6.18.2.
I updated the page http://www.friedhoff.org/fscaps.html.
I also put the patch and this fix for download on the page and I put a
slackware-package with Kaigai Kohei's libcap/userspace tools on the
page.
I hope this will increase the interest and so testing of this patch.
Thanks Serge and Kaigai
Chris
On Tue, 7 Nov 2006 23:32:29 -0600
"Serge E. Hallyn" <serue@us.ibm.com> wrote:
> Quoting Seth Arnold (seth.arnold@suse.de):
> > On Mon, Nov 06, 2006 at 09:45:50PM -0600, Serge E. Hallyn wrote:
> > > #define CAP_AUDIT_CONTROL 30
> > >
> > > +#define CAP_NUMCAPS 31
> >
> > [...]
> >
> > > +struct vfs_cap_data_struct {
> > > + __u32 version;
> > > + __u32 effective;
> > > + __u32 permitted;
> > > + __u32 inheritable;
> > > +};
> >
> > [...]
> >
> > > +static int check_cap_sanity(struct vfs_cap_data_struct *cap)
> > > +{
> > > + int i;
> > > +
> > > + if (cap->version != _LINUX_CAPABILITY_VERSION)
> > > + return -EPERM;
> > > +
> > > + for (i=CAP_NUMCAPS; i<sizeof(cap->effective); i++) {
> > > + if (cap->effective & CAP_TO_MASK(i))
> > > + return -EPERM;
> > > + }
> > > + for (i=CAP_NUMCAPS; i<sizeof(cap->permitted); i++) {
> > > + if (cap->permitted & CAP_TO_MASK(i))
> > > + return -EPERM;
> > > + }
> > > + for (i=CAP_NUMCAPS; i<sizeof(cap->inheritable); i++) {
> > > + if (cap->inheritable & CAP_TO_MASK(i))
> > > + return -EPERM;
> > > + }
> > > +
> > > + return 0;
> > > +}
> >
> > for (i=31; i<4; i++) ...
> >
> > I'm not sure this checks what you think it checks? :)
>
> Thanks again for catching this. Here is the obvious patch. Hopefully
> I have it right this time.
>
> >From b91c46589b13bab78ddf431245a7ecbd59bcf2fd Mon Sep 17 00:00:00 2001
> From: Serge E. Hallyn <serue@us.ibm.com>
> Date: Tue, 7 Nov 2006 23:16:06 -0600
> Subject: [PATCH 1/1] fscaps: fix cap sanity check
>
> When checking for valid capabilities on files, we want to
> make sure that unused bits are not set. Fix the calculation
> of the highest bit checked.
>
> Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
> ---
> security/commoncap.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 6a0d033..6f5e46c 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -133,15 +133,15 @@ static int check_cap_sanity(struct vfs_c
> if (cap->version != _LINUX_CAPABILITY_VERSION)
> return -EPERM;
>
> - for (i=CAP_NUMCAPS; i<sizeof(cap->effective); i++) {
> + for (i=CAP_NUMCAPS; i<8*sizeof(cap->effective); i++) {
> if (cap->effective & CAP_TO_MASK(i))
> return -EPERM;
> }
> - for (i=CAP_NUMCAPS; i<sizeof(cap->permitted); i++) {
> + for (i=CAP_NUMCAPS; i<8*sizeof(cap->permitted); i++) {
> if (cap->permitted & CAP_TO_MASK(i))
> return -EPERM;
> }
> - for (i=CAP_NUMCAPS; i<sizeof(cap->inheritable); i++) {
> + for (i=CAP_NUMCAPS; i<8*sizeof(cap->inheritable); i++) {
> if (cap->inheritable & CAP_TO_MASK(i))
> return -EPERM;
> }
> --
> 1.4.3.3
>
--------------------
Chris Friedhoff
chris@friedhoff.org
prev parent reply other threads:[~2006-11-08 18:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-07 3:45 [PATCH 1/1] security: introduce file posix caps Serge E. Hallyn
2006-11-07 12:27 ` KaiGai Kohei
2006-11-07 14:56 ` Stephen Smalley
2006-11-07 15:10 ` Serge E. Hallyn
2006-11-07 15:26 ` Stephen Smalley
2006-11-07 16:43 ` Serge E. Hallyn
2006-11-07 18:45 ` Serge E. Hallyn
2006-11-07 21:54 ` Seth Arnold
2006-11-07 22:06 ` Serge E. Hallyn
2006-11-08 5:32 ` Serge E. Hallyn
2006-11-08 18:50 ` Chris Friedhoff [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=20061108195059.0931837d.chris@friedhoff.org \
--to=chris@friedhoff.org \
--cc=akpm@osdl.org \
--cc=chrisw@sous-sol.org \
--cc=jmorris@namei.org \
--cc=kaigai@kaigai.gr.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--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