From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
Linux FSdevel <linux-fsdevel@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Introduce BSD-style user credential [3/3]
Date: Sat, 31 Aug 2002 02:24:01 +0200 [thread overview]
Message-ID: <15728.3233.550886.99549@charged.uio.no> (raw)
In-Reply-To: <Pine.LNX.4.44.0208301634580.5430-100000@home.transmeta.com>
>>>>> " " == Linus Torvalds <torvalds@transmeta.com> writes:
> Also, I don't see how this is going to solve the credential
> clone problem, which basically says that sometimes you do _not_
> want to do COW on the credentials (when changing them when they
> are shared with other threads) and sometimes you do (when
> changing them when they are shared with a background filesystem
> lookup).
> Any ideas on that?
task->ucred is not the unit for implementing shared creds between
threads. In the BSD design (on which this is loosely based) the ucred
is a structure designed for caching user credentials so that you can
pass them around inside the VFS. It is supposed to ensure that despite
shared creds, we always use the same authentication for a given
'atomic' sequence of VFS ops.
For instance the sequence
lookup(cred, dir, dentry)
permission(cred, dentry->d_inode, MAY_WRITE);
dentry_open(cred, dentry, mnt, FMODE_WRITE)
should all be using the same credentials, so here you will always want
'cred' to be a COW structure even if it is shared among several
threads.
For CLONE_CRED, the idea is that once we've got the ucred firmly
established as part of the VFS' API, we can add the concept of process
credentials ('pcred' in *BSD parlance). The latter are indeed shared
between the threads, and their contents are *not* COW. They will be
something of the form
struct pcred {
atomic_t count;
uid_t uid, euid, suid;
gid_t gid, egid, sgid;
struct ucred *cred;
kernel_cap_t ... capabilities ...
struct user_struct *user;
};
For 'pcred' any one thread could be allowed to swap any one of its
member elements without breaking the filesystem auth checking
premises. i.e. it would still not be allowed to change the member
elements of cred, but it could swap out one struct ucred for another.
> (And I _really_ don't like those trivial inline functions in
> [1/3] - I think it's much better to just show that we're doing
> a pointer dereference than trying to hide it behind some silly
> "current_fsuid()" inline function).
The current_fsuid() thing is an artifice that is designed to make the
actual patches smaller and more readable. I would expect all of them
to have disappeared once we get to the point of full VFS support for
ucreds in place. When that is done, I would something like open()
should be doing a single
cred = current_getucred();
and then passing the resulting ucred directly down to the file
subsystems. References to current_fsuid() will be unnecessary and
indeed *wrong* once we get to that point, since they will break the
'atomicity' premise as described above.
In fact, at some point we could probably set
#define current_fsuid() BUG()
Cheers,
Trond
next prev parent reply other threads:[~2002-08-31 0:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15727.64653.78081.277222@charged.uio.no>
2002-08-30 23:40 ` [PATCH] Introduce BSD-style user credential [3/3] Linus Torvalds
2002-08-31 0:24 ` Trond Myklebust [this message]
2002-08-31 0:49 ` Linus Torvalds
[not found] ` <Pine.LNX.4.44.0208301741430.5561-100000@home.transmeta.com>
2002-08-31 0:51 ` Alan Cox
2002-08-31 0:56 ` Trond Myklebust
2002-08-31 1:01 ` Chris Wright
2002-08-31 1:04 ` Linus Torvalds
2002-08-31 16:13 ` Daniel Phillips
2002-08-31 16:43 ` Alan Cox
2002-08-31 1:29 ` Trond Myklebust
2002-08-31 4:18 ` Linus Torvalds
2002-08-31 12:02 ` Kai Henningsen
2002-08-31 16:30 ` Trond Myklebust
2002-09-01 15:23 ` Daniel Phillips
2002-08-30 23:15 Trond Myklebust
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=15728.3233.550886.99549@charged.uio.no \
--to=trond.myklebust@fys.uio.no \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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