From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
Ashwin Ganti <ashwin.ganti@gmail.com>,
David Howells <dhowells@redhat.com>, Greg KH <greg@kroah.com>,
rsc@swtch.com, ericvh@gmail.com,
linux-security-module@vger.kernel.org,
Ron Minnich <rminnich@gmail.com>,
jt.beard@gmail.com, Andrew Morgan <morgan@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Eric Paris <eparis@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Randy Dunlap <rdunlap@xenotime.net>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Kyle Moffett <kyle@moffetthome.net>,
Steve Grubb <sgrubb@redhat.com>
Subject: Re: [PATCH 3/3] RFC: p9auth: add p9auth fs
Date: Wed, 28 Apr 2010 10:10:15 -0500 [thread overview]
Message-ID: <20100428151015.GB4100@us.ibm.com> (raw)
In-Reply-To: <20100428111749.GA27247@redhat.com>
Quoting Oleg Nesterov (oleg@redhat.com):
> On 04/27, Serge E. Hallyn wrote:
> >
> > This introduces a Plan 9 style setuid capability filesystem.
> > See Documentation/p9auth.txt for a description of how to use this.
>
> Can't comment these changes due to the lack of knowledge, just
> a couple of minor nits.
Thanks, Oleg.
> > +static ssize_t p9auth_use_write(struct file *file, const char __user *buffer,
> > + size_t count, loff_t *ppos)
> > +{
> > + ssize_t retval = -ENOMEM;
> > + char *user_buf;
> > +
> > + if (mutex_lock_interruptible(&cap_mutex))
> > + return -EINTR;
>
> EINTR doesn't look exactly right here, especially if TIF_SIGPENDING is
> spurious. Probably ERESTARTNOINTR makes more sense. Or mutex_lock_killable().
Ashwin had had this as ERESTARTSYS I believe. I'd read something about
userspace should only see -EINTR so I changed it. Sounds like I need
to follow the caller chain some more and learn a thing or two, before
I repost.
> > + user_buf = kzalloc(count+1, GFP_KERNEL);
>
> Probably this is OK, but it looks a bit strange we do no check that
> count is not too large.
Yes, I should check that, thanks!
> > + if (copy_from_user(user_buf, buffer, count)) {
> > + retval = -EFAULT;
> > + goto out;
> > + }
> > +
> > + retval = use_setuid_capability(user_buf);
>
> It seems that use_setuid_capability() pathes assume that user_buf is
> null terminated? Say, parse_user_capability() does kstrdup(user_buf).
I kzalloc()d to count+1 before, and only copy_from_user() count bytes,
so the last byte should always be 0.
Thanks again,
-serge
next prev parent reply other threads:[~2010-04-28 15:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 16:41 [PATCH 0/3] p9auth fs: introduction Serge E. Hallyn
2010-04-27 16:42 ` [PATCH 1/3] p9auth: split core function out of some set*{u,g}id functions Serge E. Hallyn
2010-05-04 14:52 ` David Howells
2010-04-27 16:43 ` [PATCH 2/3] p9auth: add CAP_GRANT_ID to authorize use of /dev/caphash Serge E. Hallyn
2010-04-27 16:45 ` [PATCH 3/3] RFC: p9auth: add p9auth fs Serge E. Hallyn
2010-04-28 11:17 ` Oleg Nesterov
2010-04-28 15:10 ` Serge E. Hallyn [this message]
2010-04-28 15:39 ` Oleg Nesterov
2010-05-03 23:50 ` Serge E. Hallyn
2010-05-04 14:57 ` David Howells
2010-05-04 15:14 ` 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=20100428151015.GB4100@us.ibm.com \
--to=serue@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=ashwin.ganti@gmail.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=eparis@redhat.com \
--cc=ericvh@gmail.com \
--cc=greg@kroah.com \
--cc=jt.beard@gmail.com \
--cc=kyle@moffetthome.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=morgan@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=oleg@redhat.com \
--cc=rdunlap@xenotime.net \
--cc=rminnich@gmail.com \
--cc=rsc@swtch.com \
--cc=sgrubb@redhat.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 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.