Skip to contentSkip to conversation

LSM root_plug fixup

PATCH New bert hubert 4 participants 6 messages Aug 4, 2003 – Sep 9, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LSM root_plug fixup

Greg,

For root_plug, which is a fun way to demonstrate LSM, depends on capability.o, but when loaded, capability.o installs its own security module which won't accept root_plug anymore.

This patch abstracts out the functionality of capability.o which is needed by root_plug, but leaves the actual security module in capability.o.

This creates the new file commoncap.c, which contains the functions capability.o and root_plug.o both need.

It also fixes a cosmetic oddity in root_plug.

Please apply.

security/Makefile +3 -3
diff -uBbrN linux-2.6.0-test1/security/Makefile linux-2.6.0-test2-ahu/security/Makefile
@@ -4,10 +4,10 @@
 
 # if we don't select a security model, use the default capabilities
 ifneq ($(CONFIG_SECURITY),y)
-obj-y		+= capability.o
+obj-y		+= commoncap.c capability.o
 endif
 
 # Object file lists
 obj-$(CONFIG_SECURITY)			+= security.o dummy.o
-obj-$(CONFIG_SECURITY_CAPABILITIES)	+= capability.o
-obj-$(CONFIG_SECURITY_ROOTPLUG)		+= root_plug.o
+obj-$(CONFIG_SECURITY_CAPABILITIES)	+= commoncap.o capability.o
+obj-$(CONFIG_SECURITY_ROOTPLUG)		+= commoncap.o root_plug.o
security/capability.c +0 -327

333 lines not on this page · raw message

security/commoncap.c +341 -0

341 lines not on this page · raw message

security/root_plug.c +2 -2
diff -uBbrN linux-2.6.0-test1/security/root_plug.c linux-2.6.0-test2-ahu/security/root_plug.c
@@ -108,7 +108,7 @@
 		/* try registering with primary module */
 		if (mod_reg_security (MY_NAME, &rootplug_security_ops)) {
 			printk (KERN_INFO "Failure registering Root Plug "
-				" module with primary security module.\n");
+				"module with primary security module.\n");
 			return -EINVAL;
 		}
 		secondary = 1;
@@ -124,7 +124,7 @@
 	if (secondary) {
 		if (mod_unreg_security (MY_NAME, &rootplug_security_ops))
 			printk (KERN_INFO "Failure unregistering Root Plug "
-				" module with primary module.\n");
+				"module with primary module.\n");
 	} else { 
 		if (unregister_security (&rootplug_security_ops)) {
 			printk (KERN_INFO "Failure unregistering Root Plug "
Signature · 2 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
#1 lore raw

PATCH 1/1 (improved) LSM root_plug fixup

Stephen Smalley noticed a typo in my new Makefile and suggested rediffing against bitkeeper which now has SELinux merged.

Further changes, added small comment, added module license & description, actually tested compiling the kernel with different security settings.

Please consider applying.

To recap, this patch allows root_plug to work again. It needs functions that used to reside in capability.c but linking in capability.c, disabled root_plug from loading, as a security module is already present then. This patch splits out the functions root_plug needs from capability.c.

security/Makefile +3 -3
diff -uBbrNw -X ./dontdiff linux-2.6.0-test2-bk/security/Makefile linux-2.6.0-test2-bk-ahu/security/Makefile
@@ -6,7 +6,7 @@
 
 # if we don't select a security model, use the default capabilities
 ifneq ($(CONFIG_SECURITY),y)
-obj-y		+= capability.o
+obj-y		+= commoncap.o capability.o
 endif
 
 # Object file lists
@@ -15,5 +15,5 @@
 ifeq ($(CONFIG_SECURITY_SELINUX),y)
 	obj-$(CONFIG_SECURITY_SELINUX)	+= selinux/built-in.o
 endif
-obj-$(CONFIG_SECURITY_CAPABILITIES)	+= capability.o
-obj-$(CONFIG_SECURITY_ROOTPLUG)		+= root_plug.o
+obj-$(CONFIG_SECURITY_CAPABILITIES)	+= commoncap.o capability.o
+obj-$(CONFIG_SECURITY_ROOTPLUG)		+= commoncap.o root_plug.o
security/capability.c +1 -327

340 lines not on this page · raw message

security/commoncap.c +354 -0

354 lines not on this page · raw message

Signature · 2 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
#2 lore raw

Re: [PATCH] (improved) LSM root_plug fixup

Quoted 2 lines · bert hubert

Further changes, added small comment, added module license & description, actually tested compiling the kernel with different security settings.

Looks good to me.

- James

Signature · 2 lines
James Morris
<[email protected]>
#3 lore raw

Re: [PATCH] (improved) LSM root_plug fixup

In reply to bert hubert
Quoted 7 lines · bert hubert

Stephen Smalley noticed a typo in my new Makefile and suggested rediffing against bitkeeper which now has SELinux merged.

Further changes, added small comment, added module license & description, actually tested compiling the kernel with different security settings.

Please consider applying.

Sorry for the long delay, I've been busy with other stuff.

Yes, you are correct, this kind of change is necessary in order to get root_plug working again.

I only have one very tiny, cosmetic, problem with the patch:

security/capability.c

Quoted 11 lines
security/capability.c +1 -0
@@ -6,6 +6,7 @@
  *	the Free Software Foundation; either version 2 of the License, or
  *	(at your option) any later version.
  *
+ *	2003-08-05	Split out common functions to commoncap.c ([email protected])
  */
 
 #include <linux/config.h>
@@ -23,333 +24,6 @@

and:

security/commoncap.c line 9

Quoted 12 lines
security/commoncap.c +9 -0
@@ -0,0 +1,354 @@
+/* Common capabilities, needed by capability.o and root_cap.o 
+ *
+ *	This program is free software; you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation; either version 2 of the License, or
+ *	(at your option) any later version.
+ *
+ *	2003-08-05	Split out from capability.c ([email protected])
+ */

Please do not add "changelog" type comments to files that do not already have changelogs in them. They are unmaintainable within the kernel and do nothing to help anyone out.

Rely on the change history that we now have due to the use of bitkeeper, which shows your name associated with a specific changeset.

If you take these lines out, I have no problem with the patch.

thanks,

greg k-h

#4 lore raw

Re: [PATCH] (improved) LSM root_plug fixup

Quoted 3 lines · Greg KH

Please do not add "changelog" type comments to files that do not already have changelogs in them. They are unmaintainable within the kernel and do nothing to help anyone out.

Ok - that was just my lame attempt to grafitti my name into the kernel :-)

Please find new patch attached, rediffed against test5. The directory in the patch says 2.6.0-test2, but it is against test5. Compiles & works for me.

Thanks.

Signature · 2 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
security/Makefile +3 -3
diff -urNBbw -X dontdiff linux-2.6.0-test2-bk/security/Makefile linux-2.6.0-test2-bk-ahu/security/Makefile
@@ -6,7 +6,7 @@
 
 # if we don't select a security model, use the default capabilities
 ifneq ($(CONFIG_SECURITY),y)
-obj-y		+= capability.o
+obj-y		+= commoncap.o capability.o
 endif
 
 # Object file lists
@@ -15,5 +15,5 @@
 ifeq ($(CONFIG_SECURITY_SELINUX),y)
 	obj-$(CONFIG_SECURITY_SELINUX)	+= selinux/built-in.o
 endif
-obj-$(CONFIG_SECURITY_CAPABILITIES)	+= capability.o
-obj-$(CONFIG_SECURITY_ROOTPLUG)		+= root_plug.o
+obj-$(CONFIG_SECURITY_CAPABILITIES)	+= commoncap.o capability.o
+obj-$(CONFIG_SECURITY_ROOTPLUG)		+= commoncap.o root_plug.o
security/capability.c +0 -328

334 lines not on this page · raw message

security/commoncap.c +353 -0

353 lines not on this page · raw message

#5 lore raw

Re: [PATCH] (improved) LSM root_plug fixup

Quoted 2 lines · * bert hubert ([email protected]) wrote:

Please find new patch attached, rediffed against test5. The directory in the patch says 2.6.0-test2, but it is against test5. Compiles & works for me.

It's working for me. I put it in the LSM tree with one minor typo fixed:

security/commoncap.c line 1

Quoted 3 lines

+++ linux-2.6.0-test2-bk-ahu/security/commoncap.c 2003-09-09 09:56:53.000000000 +0200

security/commoncap.c +1 -0
@@ -0,0 +1,353 @@
+/* Common capabilities, needed by capability.o and root_cap.o 

s/root_cap/root_plug/

thanks,
-chris

Signature · 1 line
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net