From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Ashwin Ganti
<ashwin.ganti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
rsc-kPPrOchjzlEAvxtiuMwx3w@public.gmane.org,
ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ron Minnich <rminnich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
jt.beard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Andrew Morgan <morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
oleg-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
Eric Paris <eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Randy Dunlap <rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
Subject: Re: [PATCH 3/3] p9auth: add p9auth driver
Date: Fri, 23 Apr 2010 22:36:14 -0500 [thread overview]
Message-ID: <20100424033614.GA4180@us.ibm.com> (raw)
In-Reply-To: <m1zl0xo1m9.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
Quoting Eric W. Biederman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org):
> "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> writes:
>
> > Quoting Greg KH (greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org):
> >> On Tue, Apr 20, 2010 at 08:29:08PM -0500, Serge E. Hallyn wrote:
> >> > This is a driver that adds Plan 9 style capability device
> >> > implementation. See Documentation/p9auth.txt for a description
> >> > of how to use this.
> >>
> >> Hm, you didn't originally write this driver, so it would be good to get
> >> some original authorship information in here to keep everything correct,
> >> right?
> >
> > That's why I left the MODULE_AUTHOR line in there - not sure what
> > else to do for that. I'll add a comment in p9auth.txt, especially
> > pointing back to Ashwin's original paper.
> >
> >> > Documentation/p9auth.txt | 47 ++++
> >> > drivers/char/Kconfig | 2 +
> >> > drivers/char/Makefile | 2 +
> >> > drivers/char/p9auth/Kconfig | 9 +
> >> > drivers/char/p9auth/Makefile | 1 +
> >> > drivers/char/p9auth/p9auth.c | 517 ++++++++++++++++++++++++++++++++++++++++++
> >>
> >> Is this code really ready for drivers/char/? What has changed in it
> >> that makes it ok to move out of the staging tree?
> >
> > It was dropped from staging :) I don't particularly care to see it
> > go back into staging, as opposed to working out issues out of tree
> > (assuming they are solvable). For one thing, as you note below,
> > there is the question of whether it should be a device driver at
> > all.
> >
> >> And who is going to maintain it? You? Or someone else?
> >
> > If Ashwin doesn't want to maintain it, I'll do it. Either way.
> >
> >> > 6 files changed, 578 insertions(+), 0 deletions(-)
> >> > create mode 100644 Documentation/p9auth.txt
> >> > create mode 100644 drivers/char/p9auth/Kconfig
> >> > create mode 100644 drivers/char/p9auth/Makefile
> >> > create mode 100644 drivers/char/p9auth/p9auth.c
> >> >
> >> > diff --git a/Documentation/p9auth.txt b/Documentation/p9auth.txt
> >> > new file mode 100644
> >> > index 0000000..14a69d8
> >> > --- /dev/null
> >> > +++ b/Documentation/p9auth.txt
> >> > @@ -0,0 +1,47 @@
> >> > +The p9auth device driver implements a plan-9 factotum-like
> >> > +capability API. Tasks which are privileged (authorized by
> >> > +possession of the CAP_GRANT_ID privilege (POSIX capability))
> >> > +can write new capabilities to /dev/caphash. The kernel then
> >> > +stores these until a task uses them by writing to the
> >> > +/dev/capuse device. Each capability represents the ability
> >> > +for a task running as userid X to switch to userid Y and
> >> > +some set of groups. Each capability may be used only once,
> >> > +and unused capabilities are cleared after two minutes.
> >> > +
> >> > +The following examples shows how to use the API. Shell 1
> >> > +contains a privileged root shell. Shell 2 contains an
> >> > +unprivileged shell as user 501 in the same user namespace. If
> >> > +not already done, the privileged shell should create the p9auth
> >> > +devices:
> >> > +
> >> > + majfile=/sys/module/p9auth/parameters/cap_major
> >> > + minfile=/sys/module/p9auth/parameters/cap_minor
> >> > + maj=`cat $majfile`
> >> > + mknod /dev/caphash c $maj 0
> >> > + min=`cat $minfile`
> >> > + mknod /dev/capuse c $maj 1
> >> > + chmod ugo+w /dev/capuse
> >>
> >> That is incorrect, you don't need the cap_major/minor files at all, the
> >> device node should be automatically created for you, right?
> >
> > Hmm, where? Not in /dev on my SLES11 partition...
> >
> >> And do you really want to do all of this control through a device node?
> >> Why?
> >
> > Well...
> >
> > At first I was thinking same as you were. So I was going to switch
> > to a pure syscall-based approach. But it just turned out more
> > complicated. The factotum server would call sys_grantid(), and
> > the target task would end up doing some huge sys_setresugid() or
> > else multiple syscalls using the granted id. It just was uglier.
> > I think there's an experimental patchset sitting somewhere I could
> > point to (if I weren't embarassed :).
> >
> > Another possibility would be to use netlink, but that doesn't
> > appear as amenable to segragation by user namespaces. The pid
> > (presumably/hopefully global pid, as __u32) is available, so it
> > shouldn't be impossible, but a simple device with simple synchronous
> > read/write certainly has its appeal. Firing off a message hoping
> > that at some point our credentials will be changes, less so.
>
> pid in the netlink context is the netlink port-id. It is a very
> different concept from struct pid. These days netlink calls to
> the kernel are synchronous, not that I would encourage netlink
> for anything except networking code.
>
> Can we make this a trivial filesystem? I expect that would match
> up better with whatever plan9 userspace apps already exist,
> remove the inode double translation, and would make it much more
> reasonable to do a user namespace aware version if and when
BTW, this current version is user namespace aware.
> that becomes necessary.
An fs actually seems overkill for two write-only files for
process-related information. Would these actually be candidates
for new /proc files?
/proc/grantcred - replaces /dev/caphash, for privileged
tasks to tell the kernel about new setuid
capabilities
/proc/self/usecred - replaces /dev/capuse for unprivileged
tasks to make use of a setuid capability
-serge
WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Greg KH <greg@kroah.com>, lkml <linux-kernel@vger.kernel.org>,
David Howells <dhowells@redhat.com>,
Ashwin Ganti <ashwin.ganti@gmail.com>,
rsc@swtch.com, ericvh@gmail.com,
linux-security-module@vger.kernel.org,
Ron Minnich <rminnich@gmail.com>,
jt.beard@gmail.com, Andrew Morton <akpm@linux-foundation.org>,
Andrew Morgan <morgan@kernel.org>,
oleg@us.ibm.com, Eric Paris <eparis@redhat.com>,
linux-api@vger.kernel.org, Randy Dunlap <rdunlap@xenotime.net>
Subject: Re: [PATCH 3/3] p9auth: add p9auth driver
Date: Fri, 23 Apr 2010 22:36:14 -0500 [thread overview]
Message-ID: <20100424033614.GA4180@us.ibm.com> (raw)
In-Reply-To: <m1zl0xo1m9.fsf@fess.ebiederm.org>
Quoting Eric W. Biederman (ebiederm@xmission.com):
> "Serge E. Hallyn" <serue@us.ibm.com> writes:
>
> > Quoting Greg KH (greg@kroah.com):
> >> On Tue, Apr 20, 2010 at 08:29:08PM -0500, Serge E. Hallyn wrote:
> >> > This is a driver that adds Plan 9 style capability device
> >> > implementation. See Documentation/p9auth.txt for a description
> >> > of how to use this.
> >>
> >> Hm, you didn't originally write this driver, so it would be good to get
> >> some original authorship information in here to keep everything correct,
> >> right?
> >
> > That's why I left the MODULE_AUTHOR line in there - not sure what
> > else to do for that. I'll add a comment in p9auth.txt, especially
> > pointing back to Ashwin's original paper.
> >
> >> > Documentation/p9auth.txt | 47 ++++
> >> > drivers/char/Kconfig | 2 +
> >> > drivers/char/Makefile | 2 +
> >> > drivers/char/p9auth/Kconfig | 9 +
> >> > drivers/char/p9auth/Makefile | 1 +
> >> > drivers/char/p9auth/p9auth.c | 517 ++++++++++++++++++++++++++++++++++++++++++
> >>
> >> Is this code really ready for drivers/char/? What has changed in it
> >> that makes it ok to move out of the staging tree?
> >
> > It was dropped from staging :) I don't particularly care to see it
> > go back into staging, as opposed to working out issues out of tree
> > (assuming they are solvable). For one thing, as you note below,
> > there is the question of whether it should be a device driver at
> > all.
> >
> >> And who is going to maintain it? You? Or someone else?
> >
> > If Ashwin doesn't want to maintain it, I'll do it. Either way.
> >
> >> > 6 files changed, 578 insertions(+), 0 deletions(-)
> >> > create mode 100644 Documentation/p9auth.txt
> >> > create mode 100644 drivers/char/p9auth/Kconfig
> >> > create mode 100644 drivers/char/p9auth/Makefile
> >> > create mode 100644 drivers/char/p9auth/p9auth.c
> >> >
> >> > diff --git a/Documentation/p9auth.txt b/Documentation/p9auth.txt
> >> > new file mode 100644
> >> > index 0000000..14a69d8
> >> > --- /dev/null
> >> > +++ b/Documentation/p9auth.txt
> >> > @@ -0,0 +1,47 @@
> >> > +The p9auth device driver implements a plan-9 factotum-like
> >> > +capability API. Tasks which are privileged (authorized by
> >> > +possession of the CAP_GRANT_ID privilege (POSIX capability))
> >> > +can write new capabilities to /dev/caphash. The kernel then
> >> > +stores these until a task uses them by writing to the
> >> > +/dev/capuse device. Each capability represents the ability
> >> > +for a task running as userid X to switch to userid Y and
> >> > +some set of groups. Each capability may be used only once,
> >> > +and unused capabilities are cleared after two minutes.
> >> > +
> >> > +The following examples shows how to use the API. Shell 1
> >> > +contains a privileged root shell. Shell 2 contains an
> >> > +unprivileged shell as user 501 in the same user namespace. If
> >> > +not already done, the privileged shell should create the p9auth
> >> > +devices:
> >> > +
> >> > + majfile=/sys/module/p9auth/parameters/cap_major
> >> > + minfile=/sys/module/p9auth/parameters/cap_minor
> >> > + maj=`cat $majfile`
> >> > + mknod /dev/caphash c $maj 0
> >> > + min=`cat $minfile`
> >> > + mknod /dev/capuse c $maj 1
> >> > + chmod ugo+w /dev/capuse
> >>
> >> That is incorrect, you don't need the cap_major/minor files at all, the
> >> device node should be automatically created for you, right?
> >
> > Hmm, where? Not in /dev on my SLES11 partition...
> >
> >> And do you really want to do all of this control through a device node?
> >> Why?
> >
> > Well...
> >
> > At first I was thinking same as you were. So I was going to switch
> > to a pure syscall-based approach. But it just turned out more
> > complicated. The factotum server would call sys_grantid(), and
> > the target task would end up doing some huge sys_setresugid() or
> > else multiple syscalls using the granted id. It just was uglier.
> > I think there's an experimental patchset sitting somewhere I could
> > point to (if I weren't embarassed :).
> >
> > Another possibility would be to use netlink, but that doesn't
> > appear as amenable to segragation by user namespaces. The pid
> > (presumably/hopefully global pid, as __u32) is available, so it
> > shouldn't be impossible, but a simple device with simple synchronous
> > read/write certainly has its appeal. Firing off a message hoping
> > that at some point our credentials will be changes, less so.
>
> pid in the netlink context is the netlink port-id. It is a very
> different concept from struct pid. These days netlink calls to
> the kernel are synchronous, not that I would encourage netlink
> for anything except networking code.
>
> Can we make this a trivial filesystem? I expect that would match
> up better with whatever plan9 userspace apps already exist,
> remove the inode double translation, and would make it much more
> reasonable to do a user namespace aware version if and when
BTW, this current version is user namespace aware.
> that becomes necessary.
An fs actually seems overkill for two write-only files for
process-related information. Would these actually be candidates
for new /proc files?
/proc/grantcred - replaces /dev/caphash, for privileged
tasks to tell the kernel about new setuid
capabilities
/proc/self/usecred - replaces /dev/capuse for unprivileged
tasks to make use of a setuid capability
-serge
next prev parent reply other threads:[~2010-04-24 3:36 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-21 1:27 [PATCH 1/3] p9auth: split core function out of some set*{u,g}id functions Serge E. Hallyn
2010-04-21 1:28 ` [PATCH 2/3] p9auth: add CAP_GRANT_ID to authorize use of /dev/caphash Serge E. Hallyn
2010-04-21 2:54 ` Greg KH
[not found] ` <20100421012749.GA21338-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21 1:29 ` [PATCH 3/3] p9auth: add p9auth driver Serge E. Hallyn
2010-04-21 1:29 ` Serge E. Hallyn
[not found] ` <20100421012908.GB24251-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21 3:04 ` Greg KH
2010-04-21 3:04 ` Greg KH
[not found] ` <20100421030406.GB10258-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2010-04-21 3:45 ` Serge E. Hallyn
2010-04-21 3:45 ` Serge E. Hallyn
2010-04-21 4:18 ` Ashwin Ganti
2010-04-21 4:18 ` Ashwin Ganti
2010-04-21 13:47 ` Serge E. Hallyn
2010-04-21 13:47 ` Serge E. Hallyn
[not found] ` <20100421134759.GE16326-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-21 14:44 ` Ashwin Ganti
2010-04-21 14:44 ` Ashwin Ganti
2010-04-21 4:45 ` Eric W. Biederman
[not found] ` <m1zl0xo1m9.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-04-21 13:21 ` Serge E. Hallyn
2010-04-21 13:21 ` Serge E. Hallyn
2010-04-24 3:36 ` Serge E. Hallyn [this message]
2010-04-24 3:36 ` Serge E. Hallyn
2010-04-24 16:25 ` ron minnich
2010-04-24 16:25 ` ron minnich
[not found] ` <n2s13426df11004240925id540ed94mc2ebafada0099ec4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-24 18:01 ` Eric W. Biederman
2010-04-24 18:01 ` Eric W. Biederman
2010-04-25 3:24 ` Serge E. Hallyn
2010-04-21 9:27 ` Alan Cox
2010-04-21 9:27 ` Alan Cox
[not found] ` <20100421102739.6ad932fb-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-04-21 13:39 ` Serge E. Hallyn
2010-04-21 13:39 ` Serge E. Hallyn
2010-04-21 14:19 ` Alan Cox
[not found] ` <20100421151917.5ae20265-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-04-21 15:09 ` Serge E. Hallyn
2010-04-21 15:09 ` Serge E. Hallyn
2010-04-21 19:15 ` Eric W. Biederman
2010-04-21 20:23 ` Serge E. Hallyn
2010-04-22 4:57 ` Kyle Moffett
[not found] ` <w2wf73f7ab81004212157o371c5738o10c8b6ff807ba36a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-22 14:36 ` Serge E. Hallyn
2010-04-22 14:36 ` Serge E. Hallyn
2010-04-21 13:55 ` Eric Paris
2010-04-21 13:55 ` Eric Paris
2010-04-21 14:30 ` Serge E. Hallyn
2010-04-21 10:49 ` David Howells
2010-04-21 10:49 ` David Howells
2010-04-21 13:40 ` Serge E. Hallyn
2010-04-21 10:46 ` [PATCH 1/3] p9auth: split core function out of some set*{u,g}id functions David Howells
2010-04-21 13:40 ` 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=20100424033614.GA4180@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=ashwin.ganti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ericvh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=jt.beard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=morgan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=oleg-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org \
--cc=rminnich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=rsc-kPPrOchjzlEAvxtiuMwx3w@public.gmane.org \
/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.