public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] capabilities not inherited
@ 2005-06-08 20:27 Manfred Georg
  2005-06-08 20:41 ` Alexander Nyberg
  2005-06-08 20:44 ` Chris Wright
  0 siblings, 2 replies; 14+ messages in thread
From: Manfred Georg @ 2005-06-08 20:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

Hi,

I was working with passing capabilities through an exec and it
didn't do what I expected it to.  That is, if I set a bit in
the inherited capabilities, it is not "inherited" after an
exec().  After going through the code many times, and still not
understanding it, I hacked together this patch.  It probably
has unforseen side effects and there was probably some
reason it was not done in the first place.

Thanks for the kernel, I have a new found appreciation for it.

Manfred

Patch against 2.6.12-rc6:

Signed-off-by: Manfred Georg <mgeorg@arl.wustl.edu>

diff -uprN -X dontdiff linux-2.6.12-rc6/security/commoncap.c linux/security/commoncap.c
--- linux-2.6.12-rc6/security/commoncap.c	2005-03-02 01:38:07.000000000 -0600
+++ linux/security/commoncap.c	2005-06-08 14:02:21.000000000 -0500
@@ -113,10 +113,11 @@ int cap_bprm_set_security (struct linux_
 {
 	/* Copied from fs/exec.c:prepare_binprm. */

-	/* We don't have VFS support for capabilities yet */
-	cap_clear (bprm->cap_inheritable);
-	cap_clear (bprm->cap_permitted);
-	cap_clear (bprm->cap_effective);
+	bprm->cap_inheritable = current->cap_inheritable;
+	bprm->cap_permitted = cap_intersect(current->cap_inheritable,
+	                                    current->cap_permitted);
+	bprm->cap_effective = cap_intersect(bprm->cap_permitted,
+	                                    current->cap_effective);

 	/*  To support inheritance of root-permissions and suid-root
 	 *  executables under compatibility mode, we raise all three


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

end of thread, other threads:[~2005-06-09 15:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-08 20:27 [PATCH] capabilities not inherited Manfred Georg
2005-06-08 20:41 ` Alexander Nyberg
2005-06-08 21:26   ` Manfred Georg
2005-06-08 20:44 ` Chris Wright
2005-06-08 21:20   ` Alexander Nyberg
2005-06-08 21:33     ` Manfred Georg
2005-06-08 21:46       ` Alexander Nyberg
2005-06-08 21:54       ` Chris Wright
2005-06-08 21:59     ` Chris Wright
2005-06-08 23:49       ` Lee Revell
2005-06-09  2:59     ` David Wagner
2005-06-09 10:32       ` Alexander Nyberg
2005-06-09 14:55         ` David Wagner
2005-06-09 15:31           ` Lee Revell

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