From: Luca Barbieri <ldb@ldb.ods.org>
To: trond.myklebust@fys.uio.no
Cc: Linux FSdevel <linux-fsdevel@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Initial support for struct vfs_cred [0/1]
Date: 01 Sep 2002 23:36:05 +0200 [thread overview]
Message-ID: <1030916165.1993.348.camel@ldb> (raw)
In-Reply-To: <15730.27061.640906.564411@charged.uio.no>
[-- Attachment #1: Type: text/plain, Size: 3795 bytes --]
On Sun, 2002-09-01 at 21:25, Trond Myklebust wrote:
> >>>>> " " == Luca Barbieri <ldb@ldb.ods.org> writes:
>
> > But you'll need to modify the declaration of the various
> > function pointers whose implementations might need credentials
> > and modify all functions that call them and deal with
> > permissions. Instead with my proposal the credentials are
>
> Yes... And this is a useful activity in itself, as the existence of
> all these hacks that temporarily change uid/gid/whatever... show.
I disagree.
It reduces performance, and results in huge patches.
Furthermore you can't predict whether the target of a function pointer
will need credentials or not.
> > automatically immutable across the syscall without needing to
> > worry at all about locks, counts and sharing.
>
> I still have no opinion about your proposal for implementing CLONE_CRED.
>
> What I fail to see is why you appear to insist it would be
> incompatible with the idea of copy-on-write VFS credentials (which I
> explained are interesting for other purposes).
I don't insist on that (see below).
> I also fail to understand why you insist that we need to drop the idea
> of copy-on-write credentials in order to optimize for this fringe case
> in which somebody calls sys_access() or exec with euid != fsuid.
I do not propose to remove the idea of copy-on-write credentials, just
to use copy-on-write only for groups and "copy-always" for uid and gid
so that access to uid and gid doesn't need to go through the credentials
pointer.
You have code like this:
+ cred = get_current_vfscred();
fdata->fd_do_lml = 0;
- fdata->fd_fsuid = current->fsuid;
- fdata->fd_fsgid = current->fsgid;
+ fdata->fd_fsuid = cred->uid;
+ fdata->fd_fsgid = cred->gid;
fdata->fd_mode = file->f_dentry->d_inode->i_mode;
- fdata->fd_ngroups = current->ngroups;
- for (i=0 ; i<current->ngroups ; i++)
- fdata->fd_groups[i] = current->groups[i];
+ fdata->fd_ngroups = cred->ngroups;
+ for (i=0 ; i<cred->ngroups ; i++)
+ fdata->fd_groups[i] = cred->groups[i];
fdata->fd_bytes_written = 0; /*when open,written data is zero*/
file->private_data = fdata;
+ put_vfscred(cred);
The get/put here only make sense if something else can modify the
credentials without it.
Otherwise, you can skip them since the reference count will always be >
0 because nothing else can change the current->vfscred pointer, and that
will contribute to the reference count.
What I'm trying to do is to design credentials in such a way that, even
with shared credentials, the get/put won't be necessary.
I'm also trying to put such credentials directly in task_struct so that
the code doesn't need to get a pointer from task_struct and then fetch
the credentials from the structure it points to.
The order of likelyhood of credential operations is assumed to be the
following:
1. Use/copy/local temporary modification of uid and gid
2. Use/copy/local temporary modification of groups
3. Permanent modification of something
* Local temporary modification means that the modification only has
effect on the current task and is revert before the end of the syscall
To optimize for this I propose to:
1. Put uid and gid directly in task_struct (optimize for 1)
2. Use copy-on-write on groups so that we avoid copying an big array
(optimize for 2.copy)
3. Change credentials only when not performing a syscall (optimize for 1
and 2)
> "changing fsuid/fsgid is *not* the common case that needs optimization."
I completely agree with this, that's the whole point!
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-09-01 21:31 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-31 16:32 [PATCH] Initial support for struct vfs_cred [0/1] Trond Myklebust
2002-08-31 18:57 ` Luca Barbieri
2002-08-31 19:36 ` Linus Torvalds
2002-08-31 19:38 ` Luca Barbieri
2002-08-31 22:30 ` Trond Myklebust
2002-08-31 23:13 ` Luca Barbieri
2002-09-01 13:03 ` Trond Myklebust
2002-09-01 14:10 ` Trond Myklebust
2002-09-01 14:10 ` Trond Myklebust
2002-09-01 14:20 ` Luca Barbieri
2002-09-01 16:40 ` Trond Myklebust
2002-09-01 16:40 ` Trond Myklebust
2002-09-01 18:54 ` Luca Barbieri
2002-09-01 19:40 ` Trond Myklebust
2002-09-01 21:34 ` Luca Barbieri
2002-09-01 21:34 ` Luca Barbieri
2002-09-01 21:56 ` Trond Myklebust
2002-09-01 21:56 ` Trond Myklebust
2002-09-01 22:50 ` Luca Barbieri
[not found] ` <20020903034607.GF29452@ravel.coda.cs.cmu.edu>
2002-09-08 22:04 ` Luca Barbieri
2002-09-09 6:22 ` Jan Harkes
2002-09-09 11:17 ` Luca Barbieri
2002-09-01 19:40 ` Trond Myklebust
2002-09-01 14:20 ` Luca Barbieri
2002-09-01 14:33 ` Luca Barbieri
2002-09-01 16:38 ` Trond Myklebust
2002-09-01 18:42 ` Luca Barbieri
2002-09-01 19:25 ` Trond Myklebust
2002-09-01 21:36 ` Luca Barbieri [this message]
2002-09-01 21:36 ` Luca Barbieri
2002-09-01 15:15 ` Daniel Phillips
2002-09-01 15:35 ` Luca Barbieri
2002-08-31 18:57 ` Luca Barbieri
2002-08-31 19:51 ` Luca Barbieri
-- strict thread matches above, loose matches on Subject: below --
2002-08-31 16:32 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=1030916165.1993.348.camel@ldb \
--to=ldb@ldb.ods.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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.