public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] p9auth: set fsuid
@ 2010-02-16 22:44 Serge Hallyn
  2010-02-16 22:44 ` [PATCH 2/8] p9auth: split core function out of some set*{u,g}id functions Serge Hallyn
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Serge Hallyn @ 2010-02-16 22:44 UTC (permalink / raw)
  To: serue; +Cc: Greg KH, rsc, Ashwin Ganti, ericvh, devel, linux-kernel,
	Ron Minnich

From: Serge E. Hallyn <serue@us.ibm.com>

fsuid should always trail euid changes.  So p9auth should
set fsuid as well when it sets ruid and euid.  Whether the
suid should also be set is an open question - keeping the
old uid in suid may be useful, or may just serve to trick
lazy userspace.

Note that so long as we do not also set suid, the setuid_fixup()
code will not (when we later switch to setresuid()) fully
fill/clear capability sets.  So while I had previously thought
that keeping suid unchanged would be useful, I think it is
better to change all uids.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Greg KH <greg@kroah.com>
cc: rsc@swtch.com
Cc: Ashwin Ganti <ashwin.ganti@gmail.com>
Cc: ericvh@gmail.com
Cc: devel@linuxdriverproject.org
Cc: linux-kernel@vger.kernel.org
Cc: Ron Minnich <rminnich@gmail.com>
---
 drivers/staging/p9auth/p9auth.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/p9auth/p9auth.c b/drivers/staging/p9auth/p9auth.c
index db79626..70ef45b 100644
--- a/drivers/staging/p9auth/p9auth.c
+++ b/drivers/staging/p9auth/p9auth.c
@@ -275,10 +275,14 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
 					goto out;
 				}
 				/*
-				 * What all id's need to be changed here? uid,
-				 * euid, fsid, savedids ??  Currently I am
-				 * changing the effective user id since most of
-				 * the authorisation decisions are based on it
+				 * Change all uids.  It might be useful to
+				 * keep suid unchanged, however that will
+				 * mean that changing from uid=0 to uid=!0
+				 * pP is not emptied (only pE is), and when
+				 * changing from  uid=!0 to  uid=0, sets are
+				 * not filled.  They will be correct after
+				 * the next exec, but this is IMO not
+				 * sufficient.  So change all uids.
 				 */
 				new = prepare_creds();
 				if (!new) {
@@ -286,7 +290,7 @@ static ssize_t cap_write(struct file *filp, const char __user *buf,
 					goto out;
 				}
 				new->uid = (uid_t) target_int;
-				new->euid = (uid_t) target_int;
+				new->suid = new->fsuid = new->euid = new->uid;
 				retval = commit_creds(new);
 				if (retval)
 					goto out;
-- 
1.6.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-03-05 20:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 22:44 [PATCH 1/8] p9auth: set fsuid Serge Hallyn
2010-02-16 22:44 ` [PATCH 2/8] p9auth: split core function out of some set*{u,g}id functions Serge Hallyn
2010-02-16 22:44 ` [PATCH 3/8] p9auth: use setresuid Serge Hallyn
2010-02-16 22:44 ` [PATCH 4/8] p9auth: add CAP_GRANT_ID to authorize use of /dev/caphash Serge Hallyn
2010-02-16 22:44 ` [PATCH 5/8] p9auth cleanup Serge Hallyn
2010-02-16 22:44 ` [PATCH 6/8] p9auth: do groups Serge Hallyn
2010-02-16 22:45 ` [PATCH 7/8] p9auth: add cap_node timeout Serge Hallyn
2010-02-16 22:45 ` [PATCH 8/8] p9auth: don't trim entries on write-only open Serge Hallyn
2010-02-25 23:28 ` [PATCH 1/8] p9auth: set fsuid Greg KH
2010-02-26  4:05   ` Serge E. Hallyn
2010-02-26  5:06     ` Greg KH
2010-02-26 18:19       ` Serge E. Hallyn
2010-03-04 22:04         ` Ashwin Ganti
2010-03-05 20:07           ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox