linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Allison <jra@samba.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Jim Lieb <jlieb@panasas.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	LSM List <linux-security-module@vger.kernel.org>,
	"Serge E. Hallyn" <serge@canonical.com>,
	Kees Cook <keescook@chromium.org>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Theodore Ts'o <tytso@mit.edu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	bfields@redhat.com
Subject: Re: Thoughts on credential switching
Date: Thu, 27 Mar 2014 11:26:17 -0700	[thread overview]
Message-ID: <20140327182617.GC2526@jeremy-laptop> (raw)
In-Reply-To: <20140327070126.41ac75ac@ipyr.poochiereds.net>

On Thu, Mar 27, 2014 at 07:01:26AM -0700, Jeff Layton wrote:
> On Thu, 27 Mar 2014 14:06:32 +0100
> Florian Weimer <fweimer@redhat.com> wrote:
> 
> > On 03/27/2014 02:02 PM, Jeff Layton wrote:
> > 
> > >> This interface does not address the long-term lack of POSIX
> > >> compliance in setuid and friends, which are required to be
> > >> process-global and not thread-specific (as they are on the kernel
> > >> side).
> > >>
> > >> glibc works around this by reserving a signal and running set*id on
> > >> every thread in a special signal handler.  This is just crass, and
> > >> it is likely impossible to restore the original process state in
> > >> case of partial failure.  We really need kernel support to perform
> > >> the process-wide switch in an all-or-nothing manner.
> > >>
> > >
> > > I disagree. We're treading new ground here with this syscall. It's
> > > not defined by POSIX so we're under no obligation to follow its
> > > silly directives in this regard. Per-process cred switching doesn't
> > > really make much sense in this day and age, IMO. Wasn't part of the
> > > spec was written before threading existed
> > 
> > Okay, then we need to add a separate set of system calls.
> > 
> > I really, really want to get rid of that signal handler mess in
> > glibc, with its partial failures.
> > 
> 
> I agree, it's a hack, but hardly anyone these days really wants to
> switch creds on a per-process basis. It's just that we're saddled with
> a spec for those calls that was written before threads really existed.
> 
> The kernel syscalls already do the right thing as far as I'm concerned.
> What would be nice however is a blessed glibc interface to them
> that didn't involve all of the signal handling stuff. Then samba et. al.
> wouldn't need to call syscall() directly to get at them.

Amen to that :-).

However, after talking with Jeff and Jim at CollabSummit,
I was 'encouraged' to make my opinions known on the list.

To me, calling the creds handle a file descriptor just
feels wrong. IT *isn't* an fd, you can't read/write/poll
on it, and it's only done as a convenience to get the
close-on-exec semantics and the fact that the creds are
already hung off the fd's in kernel space.

I'd rather any creads call use a different type, even if
it's a typedef of 'int -> creds_handle_t', just to make
it really clear it's *NOT* an fd.

That way we can also make it clear this thing only has
meaning to a thread group, and SHOULD NOT (and indeed
preferably CAN NOT) be passed between processes.

Cheers,

	Jeremy.

  reply	other threads:[~2014-03-27 18:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  0:23 Thoughts on credential switching Andy Lutomirski
2014-03-27  0:42 ` Serge Hallyn
2014-03-27  1:01   ` Andy Lutomirski
2014-03-27 15:41     ` Florian Weimer
2014-03-27 16:21       ` Andy Lutomirski
2014-03-27  2:48 ` Jeff Layton
2014-03-27  3:05   ` Andy Lutomirski
2014-03-27  3:25     ` Jeff Layton
2014-03-27 14:08       ` Jeff Layton
2014-03-29  6:43         ` Alex Elsayed
2014-03-30 13:03         ` Theodore Ts'o
2014-03-30 18:56           ` Andy Lutomirski
2014-03-31 11:51           ` Jeff Layton
2014-03-31 18:06             ` Trond Myklebust
2014-03-31 18:12               ` Jeff Layton
2014-03-31 19:26               ` Andy Lutomirski
2014-03-31 20:14                 ` Trond Myklebust
2014-03-31 21:25                   ` Andy Lutomirski
2014-03-27 12:46 ` Florian Weimer
2014-03-27 13:02   ` Jeff Layton
2014-03-27 13:06     ` Florian Weimer
2014-03-27 13:33       ` Boaz Harrosh
2014-04-22 11:37         ` Florian Weimer
2014-04-22 12:14           ` Boaz Harrosh
2014-04-22 16:35             ` Jim Lieb
2014-03-27 14:01       ` Jeff Layton
2014-03-27 18:26         ` Jeremy Allison [this message]
2014-03-27 18:46           ` Andy Lutomirski
2014-03-27 18:56             ` Jeremy Allison
2014-03-27 19:02               ` Andy Lutomirski
2014-03-27 19:30           ` Jim Lieb
2014-03-27 19:45             ` Andy Lutomirski
2014-03-27 20:47               ` Jim Lieb
2014-03-27 21:19                 ` Andy Lutomirski
2014-03-31 10:44 ` One Thousand Gnomes
2014-03-31 16:49   ` Andy Lutomirski
2014-04-01 20:22     ` One Thousand Gnomes
2014-03-31 19:05   ` Jeremy Allison

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=20140327182617.GC2526@jeremy-laptop \
    --to=jra@samba.org \
    --cc=bfields@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=fweimer@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=jlieb@panasas.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=serge@canonical.com \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).