Skip to contentSkip to conversation

security: Convert LSM into a static interface

PATCH In review James Morris 13 participants 27 messages Jul 14, 2007 – Jul 24, 2007

Subsystems (4)
lore
Share & tools
lore

James Morris

author maintainer
#0 lore raw

PATCH 1/1 security: Convert LSM into a static interface

Convert LSM into a static interface, as the ability to unload a security module is not required by in-tree users and potentially complicates the overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API abuse.

Parameters for the capability and root_plug modules are now specified at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

---

I've just resynced this patch to the current Linus git and tested various permutations of configuration options. The only real change to the code is to account for the extra mmap hook arguments.

Please review and consider for 2.6.23 merge.

 Documentation/kernel-parameters.txt |   17 +
 include/linux/security.h            | 1177 ++++++-----------------------------
 security/Kconfig                    |    4 +-
 security/capability.c               |   24 -
 security/commoncap.c                |    3 -
 security/dummy.c                    |    1 -
 security/root_plug.c                |   31 +-
 security/security.c                 |  955 ++++++++++++++++++++++++++++-
 security/selinux/hooks.c            |    2 +-
 security/selinux/xfrm.c             |    1 -
 10 files changed, 1171 insertions(+), 1044 deletions(-)
Documentation/kernel-parameters.txt +17 -0
index 4d880b3..9ad4a46 100644
@@ -74,10 +74,12 @@ parameter is applicable:
 	PPT	Parallel port support is enabled.
 	PS2	Appropriate PS/2 support is enabled.
 	RAM	RAM disk support is enabled.
+	ROOTPLUG The example Root Plug LSM is enabled.
 	S390	S390 architecture is enabled.
 	SCSI	Appropriate SCSI support is enabled.
 			A lot of drivers has their options described inside of
 			Documentation/scsi/.
+	SECURITY Different security models are enabled.
 	SELINUX SELinux support is enabled.
 	SERIAL	Serial support is enabled.
 	SH	SuperH architecture is enabled.
@@ -371,6 +373,12 @@ and is between 256 and 4096 characters. It is defined in the file
 			possible to determine what the correct size should be.
 			This option provides an override for these situations.
 
+	capability.disable=
+			[SECURITY] Disable capabilities.  This would normally
+			be used only if an alternative security model is to be
+			configured.  Potentially dangerous and should only be
+			used if you are entirely sure of the consequences.
+
 	cdu31a=		[HW,CD]
 			Format: <io>,<irq>[,PAS]
 			See header of drivers/cdrom/cdu31a.c.
@@ -1493,6 +1501,15 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	rootfstype=	[KNL] Set root filesystem type
 
+	root_plug.vendor_id=
+			[ROOTPLUG] Override the default vendor ID
+
+	root_plug.product_id=
+			[ROOTPLUG] Override the default product ID
+
+	root_plug.debug=
+			[ROOTPLUG] Enable debugging output
+
 	rw		[KNL] Mount root device read-write on boot
 
 	S		[KNL] Run init in single mode
include/linux/security.h +203 -974

1,213 lines not on this page · raw message

security/Kconfig +2 -2
index 460e5c9..8ae5490 100644
@@ -74,14 +74,14 @@ config SECURITY_NETWORK_XFRM
 	  If you are unsure how to answer this question, answer N.
 
 config SECURITY_CAPABILITIES
-	tristate "Default Linux Capabilities"
+	bool "Default Linux Capabilities"
 	depends on SECURITY
 	help
 	  This enables the "default" Linux capabilities functionality.
 	  If you are unsure how to answer this question, answer Y.
 
 config SECURITY_ROOTPLUG
-	tristate "Root Plug Support"
+	bool "Root Plug Support"
 	depends on USB && SECURITY
 	help
 	  This is a sample LSM module that should only be used as such.
security/capability.c +0 -24
index 38296a0..fda6a14 100644
@@ -8,7 +8,6 @@
  *
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/security.h>
@@ -52,7 +51,6 @@ static int secondary;
 
 static int capability_disable;
 module_param_named(disable, capability_disable, int, 0);
-MODULE_PARM_DESC(disable, "To disable capabilities module set disable = 1");
 
 static int __init capability_init (void)
 {
@@ -75,26 +73,4 @@ static int __init capability_init (void)
 	return 0;
 }
 
-static void __exit capability_exit (void)
-{
-	if (capability_disable)
-		return;
-	/* remove ourselves from the security framework */
-	if (secondary) {
-		if (mod_unreg_security (KBUILD_MODNAME, &capability_ops))
-			printk (KERN_INFO "Failure unregistering capabilities "
-				"with primary module.\n");
-		return;
-	}
-
-	if (unregister_security (&capability_ops)) {
-		printk (KERN_INFO
-			"Failure unregistering capabilities with the kernel\n");
-	}
-}
-
 security_initcall (capability_init);
-module_exit (capability_exit);
-
-MODULE_DESCRIPTION("Standard Linux Capabilities Security Module");
-MODULE_LICENSE("GPL");
security/commoncap.c +0 -3
index 384379e..04bd44b 100644
@@ -339,6 +339,3 @@ EXPORT_SYMBOL(cap_task_post_setuid);
 EXPORT_SYMBOL(cap_task_reparent_to_init);
 EXPORT_SYMBOL(cap_syslog);
 EXPORT_SYMBOL(cap_vm_enough_memory);
-
-MODULE_DESCRIPTION("Standard Linux Common Capabilities Security Module");
-MODULE_LICENSE("GPL");
security/dummy.c +0 -1
index d6a112c..427cb93 100644
@@ -15,7 +15,6 @@
 #undef DEBUG
 
 #include <linux/capability.h>
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mman.h>
 #include <linux/pagemap.h>
security/root_plug.c +1 -30
index 38dd4f3..870f130 100644
@@ -22,11 +22,11 @@
  *	License.
  */
 
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/security.h>
 #include <linux/usb.h>
+#include <linux/moduleparam.h>
 
 /* flag to keep track of how we were registered */
 static int secondary;
@@ -36,22 +36,14 @@ static int vendor_id = 0x0557;
 static int product_id = 0x2008;
 
 module_param(vendor_id, uint, 0400);
-MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
-
 module_param(product_id, uint, 0400);
-MODULE_PARM_DESC(product_id, "USB Product ID of device to look for");
 
 /* should we print out debug messages */
 static int debug = 0;
 
 module_param(debug, bool, 0600);
-MODULE_PARM_DESC(debug, "Debug enabled or not");
 
-#if defined(CONFIG_SECURITY_ROOTPLUG_MODULE)
-#define MY_NAME THIS_MODULE->name
-#else
 #define MY_NAME "root_plug"
-#endif
 
 #define root_dbg(fmt, arg...)					\
 	do {							\
@@ -117,25 +109,4 @@ static int __init rootplug_init (void)
 	return 0;
 }
 
-static void __exit rootplug_exit (void)
-{
-	/* remove ourselves from the security framework */
-	if (secondary) {
-		if (mod_unreg_security (MY_NAME, &rootplug_security_ops))
-			printk (KERN_INFO "Failure unregistering Root Plug "
-				" module with primary module.\n");
-	} else { 
-		if (unregister_security (&rootplug_security_ops)) {
-			printk (KERN_INFO "Failure unregistering Root Plug "
-				"module with the kernel\n");
-		}
-	}
-	printk (KERN_INFO "Root Plug module removed\n");
-}
-
 security_initcall (rootplug_init);
-module_exit (rootplug_exit);
-
-MODULE_DESCRIPTION("Root Plug sample LSM module, written for Linux Journal article");
-MODULE_LICENSE("GPL");
-
security/security.c +947 -8

970 lines not on this page · raw message

security/selinux/hooks.c +1 -1
index 78c3f98..c312428 100644
@@ -20,7 +20,6 @@
  *      as published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/ptrace.h>
@@ -84,6 +83,7 @@
 extern unsigned int policydb_loaded_version;
 extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
 extern int selinux_compat_net;
+extern struct security_operations *security_ops;
 
 #ifdef CONFIG_SECURITY_SELINUX_DEVELOP
 int selinux_enforcing = 0;
security/selinux/xfrm.c +0 -1
index bd8d1ef..b589238 100644
@@ -31,7 +31,6 @@
  *   2. Emulating a reasonable SO_PEERSEC across machines
  *   3. Testing addition of sk_policy's with security context via setsockopt
  */
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/security.h>
Signature · 1 line
1.5.2.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · James Morris

Convert LSM into a static interface, as the ability to unload a security module is not required by in-tree users and potentially complicates the overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API abuse.

Quoted 6 lines

Parameters for the capability and root_plug modules are now specified at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

This is a good cleanup since modular LSM modules just aren't working, and prepares for the option of removing the runtime overhead of LSM altogether for selected configs... that is going to be a big step forward to make SELinux and any other model be more acceptable for people who care about performance.

#2 lore raw
In reply to James Morris
Quoted 11 lines · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface, as the ability to unload a security module is not required by in-tree users and potentially complicates the overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API abuse.

Parameters for the capability and root_plug modules are now specified at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

I'd like to understand who is (or claims to be) adversely affected by this change, and what their complaints (if any) will be.

Because I prefer my flamewars pre- rather than post-merge.

Quoted 6 lines
(quoted diff) +5 -0
+int security_ptrace (struct task_struct * parent, struct task_struct * child);
+int security_capget (struct task_struct *target,
+		     kernel_cap_t *effective,
+		     kernel_cap_t *inheritable,
+		     kernel_cap_t *permitted);

Review

Quoted 10 lines
(quoted diff) +10 -0
+int security_capset_check (struct task_struct *target,
+			   kernel_cap_t *effective,
+			   kernel_cap_t *inheritable,
+			   kernel_cap_t *permitted);
+void security_capset_set (struct task_struct *target,
+			  kernel_cap_t *effective,
+			  kernel_cap_t *inheritable,
+			  kernel_cap_t *permitted);
+int security_capable(struct task_struct *tsk, int cap);
+int security_acct (struct file *file);

aww man, you passed over an opportunity to fix vast amounts of coding style cruftiness.

<does whizzy things>

Here you go..

 include/linux/security.h |  252 +++++++++---------
 security/security.c      |  504 ++++++++++++++++++-------------------
 2 files changed, 378 insertions(+), 378 deletions(-)
include/linux/security.h renamed from include/linux/security.h~security-convert-lsm-into-a-static-interface-fix +126 -126
diff -puN include/linux/security.h~security-convert-lsm-into-a-static-interface-fix include/linux/security.h
@@ -1414,151 +1414,151 @@ extern void securityfs_remove(struct den
 
 
 /* Security operations */
-int security_ptrace (struct task_struct * parent, struct task_struct * child);
-int security_capget (struct task_struct *target,
+int security_ptrace(struct task_struct *parent, struct task_struct *child);
+int security_capget(struct task_struct *target,
 		     kernel_cap_t *effective,
 		     kernel_cap_t *inheritable,
 		     kernel_cap_t *permitted);
-int security_capset_check (struct task_struct *target,
+int security_capset_check(struct task_struct *target,
 			   kernel_cap_t *effective,
 			   kernel_cap_t *inheritable,
 			   kernel_cap_t *permitted);
-void security_capset_set (struct task_struct *target,
+void security_capset_set(struct task_struct *target,
 			  kernel_cap_t *effective,
 			  kernel_cap_t *inheritable,
 			  kernel_cap_t *permitted);
 int security_capable(struct task_struct *tsk, int cap);
-int security_acct (struct file *file);
+int security_acct(struct file *file);
 int security_sysctl(struct ctl_table *table, int op);
-int security_quotactl (int cmds, int type, int id, struct super_block *sb);
-int security_quota_on (struct dentry * dentry);
+int security_quotactl(int cmds, int type, int id, struct super_block *sb);
+int security_quota_on(struct dentry *dentry);
 int security_syslog(int type);
 int security_settime(struct timespec *ts, struct timezone *tz);
 int security_vm_enough_memory(long pages);
-int security_bprm_alloc (struct linux_binprm *bprm);
-void security_bprm_free (struct linux_binprm *bprm);
-void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);
-void security_bprm_post_apply_creds (struct linux_binprm *bprm);
-int security_bprm_set (struct linux_binprm *bprm);
-int security_bprm_check (struct linux_binprm *bprm);
-int security_bprm_secureexec (struct linux_binprm *bprm);
-int security_sb_alloc (struct super_block *sb);
-void security_sb_free (struct super_block *sb);
-int security_sb_copy_data (struct file_system_type *type, void *orig, void *copy);
-int security_sb_kern_mount (struct super_block *sb, void *data);
-int security_sb_statfs (struct dentry *dentry);
-int security_sb_mount (char *dev_name, struct nameidata *nd,
+int security_bprm_alloc(struct linux_binprm *bprm);
+void security_bprm_free(struct linux_binprm *bprm);
+void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
+void security_bprm_post_apply_creds(struct linux_binprm *bprm);
+int security_bprm_set(struct linux_binprm *bprm);
+int security_bprm_check(struct linux_binprm *bprm);
+int security_bprm_secureexec(struct linux_binprm *bprm);
+int security_sb_alloc(struct super_block *sb);
+void security_sb_free(struct super_block *sb);
+int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy);
+int security_sb_kern_mount(struct super_block *sb, void *data);
+int security_sb_statfs(struct dentry *dentry);
+int security_sb_mount(char *dev_name, struct nameidata *nd,
                        char *type, unsigned long flags, void *data);
-int security_sb_check_sb (struct vfsmount *mnt, struct nameidata *nd);
-int security_sb_umount (struct vfsmount *mnt, int flags);
-void security_sb_umount_close (struct vfsmount *mnt);
-void security_sb_umount_busy (struct vfsmount *mnt);
-void security_sb_post_remount (struct vfsmount *mnt, unsigned long flags, void *data);
-void security_sb_post_mountroot (void);
-void security_sb_post_addmount (struct vfsmount *mnt, struct nameidata *mountpoint_nd);
-int security_sb_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd);
-void security_sb_post_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd);
-int security_inode_alloc (struct inode *inode);
-void security_inode_free (struct inode *inode);
-int security_inode_init_security (struct inode *inode, struct inode *dir,
+int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd);
+int security_sb_umount(struct vfsmount *mnt, int flags);
+void security_sb_umount_close(struct vfsmount *mnt);
+void security_sb_umount_busy(struct vfsmount *mnt);
+void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
+void security_sb_post_mountroot(void);
+void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
+int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+int security_inode_alloc(struct inode *inode);
+void security_inode_free(struct inode *inode);
+int security_inode_init_security(struct inode *inode, struct inode *dir,
 				  char **name, void **value, size_t *len);
-int security_inode_create (struct inode *dir, struct dentry *dentry, int mode);
-int security_inode_link (struct dentry *old_dentry, struct inode *dir,
+int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
+int security_inode_link(struct dentry *old_dentry, struct inode *dir,
 			 struct dentry *new_dentry);
-int security_inode_unlink (struct inode *dir, struct dentry *dentry);
-int security_inode_symlink (struct inode *dir, struct dentry *dentry,
+int security_inode_unlink(struct inode *dir, struct dentry *dentry);
+int security_inode_symlink(struct inode *dir, struct dentry *dentry,
 			    const char *old_name);
-int security_inode_mkdir (struct inode *dir, struct dentry *dentry, int mode);
-int security_inode_rmdir (struct inode *dir, struct dentry *dentry);
-int security_inode_mknod (struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
-int security_inode_rename (struct inode *old_dir, struct dentry *old_dentry,
+int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
+int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
+int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
+int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
 			   struct inode *new_dir, struct dentry *new_dentry);
-int security_inode_readlink (struct dentry *dentry);
-int security_inode_follow_link (struct dentry *dentry, struct nameidata *nd);
-int security_inode_permission (struct inode *inode, int mask, struct nameidata *nd);
-int security_inode_setattr (struct dentry *dentry, struct iattr *attr);
-int security_inode_getattr (struct vfsmount *mnt, struct dentry *dentry);
-void security_inode_delete (struct inode *inode);
-int security_inode_setxattr (struct dentry *dentry, char *name,
+int security_inode_readlink(struct dentry *dentry);
+int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
+int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
+int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
+int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
+void security_inode_delete(struct inode *inode);
+int security_inode_setxattr(struct dentry *dentry, char *name,
 			     void *value, size_t size, int flags);
-void security_inode_post_setxattr (struct dentry *dentry, char *name,
+void security_inode_post_setxattr(struct dentry *dentry, char *name,
 				   void *value, size_t size, int flags);
-int security_inode_getxattr (struct dentry *dentry, char *name);
-int security_inode_listxattr (struct dentry *dentry);
-int security_inode_removexattr (struct dentry *dentry, char *name);
+int security_inode_getxattr(struct dentry *dentry, char *name);
+int security_inode_listxattr(struct dentry *dentry);
+int security_inode_removexattr(struct dentry *dentry, char *name);
 const char *security_inode_xattr_getsuffix(void);
 int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
 int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
 int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
-int security_file_permission (struct file *file, int mask);
-int security_file_alloc (struct file *file);
-void security_file_free (struct file *file);
-int security_file_ioctl (struct file *file, unsigned int cmd, unsigned long arg);
-int security_file_mmap (struct file *file, unsigned long reqprot,
+int security_file_permission(struct file *file, int mask);
+int security_file_alloc(struct file *file);
+void security_file_free(struct file *file);
+int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+int security_file_mmap(struct file *file, unsigned long reqprot,
 			unsigned long prot, unsigned long flags,
 			unsigned long addr, unsigned long addr_only);
-int security_file_mprotect (struct vm_area_struct *vma, unsigned long reqprot,
+int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
 			    unsigned long prot);
-int security_file_lock (struct file *file, unsigned int cmd);
-int security_file_fcntl (struct file *file, unsigned int cmd, unsigned long arg);
-int security_file_set_fowner (struct file *file);
-int security_file_send_sigiotask (struct task_struct *tsk,
+int security_file_lock(struct file *file, unsigned int cmd);
+int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
+int security_file_set_fowner(struct file *file);
+int security_file_send_sigiotask(struct task_struct *tsk,
 				  struct fown_struct *fown, int sig);
-int security_file_receive (struct file *file);
-int security_task_create (unsigned long clone_flags);
-int security_task_alloc (struct task_struct *p);
-void security_task_free (struct task_struct *p);
-int security_task_setuid (uid_t id0, uid_t id1, uid_t id2, int flags);
-int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
+int security_file_receive(struct file *file);
+int security_task_create(unsigned long clone_flags);
+int security_task_alloc(struct task_struct *p);
+void security_task_free(struct task_struct *p);
+int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
+int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
 			       uid_t old_suid, int flags);
-int security_task_setgid (gid_t id0, gid_t id1, gid_t id2, int flags);
-int security_task_setpgid (struct task_struct *p, pid_t pgid);
-int security_task_getpgid (struct task_struct *p);
-int security_task_getsid (struct task_struct *p);
-void security_task_getsecid (struct task_struct *p, u32 *secid);
-int security_task_setgroups (struct group_info *group_info);
-int security_task_setnice (struct task_struct *p, int nice);
-int security_task_setioprio (struct task_struct *p, int ioprio);
-int security_task_getioprio (struct task_struct *p);
-int security_task_setrlimit (unsigned int resource, struct rlimit *new_rlim);
-int security_task_setscheduler (struct task_struct *p,
+int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
+int security_task_setpgid(struct task_struct *p, pid_t pgid);
+int security_task_getpgid(struct task_struct *p);
+int security_task_getsid(struct task_struct *p);
+void security_task_getsecid(struct task_struct *p, u32 *secid);
+int security_task_setgroups(struct group_info *group_info);
+int security_task_setnice(struct task_struct *p, int nice);
+int security_task_setioprio(struct task_struct *p, int ioprio);
+int security_task_getioprio(struct task_struct *p);
+int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim);
+int security_task_setscheduler(struct task_struct *p,
 				int policy, struct sched_param *lp);
-int security_task_getscheduler (struct task_struct *p);
-int security_task_movememory (struct task_struct *p);
-int security_task_kill (struct task_struct *p, struct siginfo *info,
+int security_task_getscheduler(struct task_struct *p);
+int security_task_movememory(struct task_struct *p);
+int security_task_kill(struct task_struct *p, struct siginfo *info,
 			int sig, u32 secid);
-int security_task_wait (struct task_struct *p);
-int security_task_prctl (int option, unsigned long arg2, unsigned long arg3,
+int security_task_wait(struct task_struct *p);
+int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
 			 unsigned long arg4, unsigned long arg5);
-void security_task_reparent_to_init (struct task_struct *p);
+void security_task_reparent_to_init(struct task_struct *p);
 void security_task_to_inode(struct task_struct *p, struct inode *inode);
-int security_ipc_permission (struct kern_ipc_perm *ipcp, short flag);
-int security_msg_msg_alloc (struct msg_msg * msg);
-void security_msg_msg_free (struct msg_msg * msg);
-int security_msg_queue_alloc (struct msg_queue *msq);
-void security_msg_queue_free (struct msg_queue *msq);
-int security_msg_queue_associate (struct msg_queue * msq, int msqflg);
-int security_msg_queue_msgctl (struct msg_queue * msq, int cmd);
-int security_msg_queue_msgsnd (struct msg_queue * msq,
-			       struct msg_msg * msg, int msqflg);
-int security_msg_queue_msgrcv (struct msg_queue * msq, struct msg_msg * msg,
-			       struct task_struct * target, long type, int mode);
-int security_shm_alloc (struct shmid_kernel *shp);
-void security_shm_free (struct shmid_kernel *shp);
-int security_shm_associate (struct shmid_kernel * shp, int shmflg);
-int security_shm_shmctl (struct shmid_kernel * shp, int cmd);
-int security_shm_shmat (struct shmid_kernel * shp, char __user *shmaddr, int shmflg);
-int security_sem_alloc (struct sem_array *sma);
-void security_sem_free (struct sem_array *sma);
-int security_sem_associate (struct sem_array * sma, int semflg);
-int security_sem_semctl (struct sem_array * sma, int cmd);
-int security_sem_semop (struct sem_array * sma, struct sembuf * sops,
+int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
+int security_msg_msg_alloc(struct msg_msg *msg);
+void security_msg_msg_free(struct msg_msg *msg);
+int security_msg_queue_alloc(struct msg_queue *msq);
+void security_msg_queue_free(struct msg_queue *msq);
+int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
+int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
+int security_msg_queue_msgsnd(struct msg_queue *msq,
+			       struct msg_msg *msg, int msqflg);
+int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
+			       struct task_struct *target, long type, int mode);
+int security_shm_alloc(struct shmid_kernel *shp);
+void security_shm_free(struct shmid_kernel *shp);
+int security_shm_associate(struct shmid_kernel *shp, int shmflg);
+int security_shm_shmctl(struct shmid_kernel *shp, int cmd);
+int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg);
+int security_sem_alloc(struct sem_array *sma);
+void security_sem_free(struct sem_array *sma);
+int security_sem_associate(struct sem_array *sma, int semflg);
+int security_sem_semctl(struct sem_array *sma, int cmd);
+int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
 			unsigned nsops, int alter);
 void security_d_instantiate (struct dentry *dentry, struct inode *inode);
 int security_getprocattr(struct task_struct *p, char *name, char **value);
 int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
-int security_netlink_send(struct sock *sk, struct sk_buff * skb);
-int security_netlink_recv(struct sk_buff * skb, int cap);
+int security_netlink_send(struct sock *sk, struct sk_buff *skb);
+int security_netlink_recv(struct sk_buff *skb, int cap);
 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
 void security_release_secctx(char *secdata, u32 seclen);
 
@@ -2229,26 +2229,26 @@ static inline void security_release_secc
 
 #ifdef CONFIG_SECURITY_NETWORK
 
-int security_unix_stream_connect(struct socket * sock, struct socket * other,
-				 struct sock * newsk);
-int security_unix_may_send(struct socket * sock,  struct socket * other);
-int security_socket_create (int family, int type, int protocol, int kern);
-int security_socket_post_create(struct socket * sock, int family,
+int security_unix_stream_connect(struct socket *sock, struct socket *other,
+				 struct sock *newsk);
+int security_unix_may_send(struct socket *sock,  struct socket *other);
+int security_socket_create(int family, int type, int protocol, int kern);
+int security_socket_post_create(struct socket *sock, int family,
 				int type, int protocol, int kern);
-int security_socket_bind(struct socket * sock, struct sockaddr * address, int addrlen);
-int security_socket_connect(struct socket * sock, struct sockaddr * address, int addrlen);
-int security_socket_listen(struct socket * sock, int backlog);
-int security_socket_accept(struct socket * sock, struct socket * newsock);
-void security_socket_post_accept(struct socket * sock, struct socket * newsock);
-int security_socket_sendmsg(struct socket * sock, struct msghdr * msg, int size);
-int security_socket_recvmsg(struct socket * sock, struct msghdr * msg,
+int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen);
+int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
+int security_socket_listen(struct socket *sock, int backlog);
+int security_socket_accept(struct socket *sock, struct socket *newsock);
+void security_socket_post_accept(struct socket *sock, struct socket *newsock);
+int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
+int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
 			    int size, int flags);
-int security_socket_getsockname(struct socket * sock);
-int security_socket_getpeername(struct socket * sock);
-int security_socket_getsockopt(struct socket * sock, int level, int optname);
-int security_socket_setsockopt(struct socket * sock, int level, int optname);
-int security_socket_shutdown(struct socket * sock, int how);
-int security_sock_rcv_skb (struct sock * sk, struct sk_buff * skb);
+int security_socket_getsockname(struct socket *sock);
+int security_socket_getpeername(struct socket *sock);
+int security_socket_getsockopt(struct socket *sock, int level, int optname);
+int security_socket_setsockopt(struct socket *sock, int level, int optname);
+int security_socket_shutdown(struct socket *sock, int how);
+int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb);
 int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
 				      int __user *optlen, unsigned len);
 int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid);
@@ -2257,7 +2257,7 @@ void security_sk_free(struct sock *sk);
 void security_sk_clone(const struct sock *sk, struct sock *newsk);
 void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
 void security_req_classify_flow(const struct request_sock *req, struct flowi *fl);
-void security_sock_graft(struct sock* sk, struct socket *parent);
+void security_sock_graft(struct sock*sk, struct socket *parent);
 int security_inet_conn_request(struct sock *sk,
 			struct sk_buff *skb, struct request_sock *req);
 void security_inet_csk_clone(struct sock *newsk,
security/security.c renamed from security/security.c~security-convert-lsm-into-a-static-interface-fix +252 -252

1,004 lines not on this page · raw message

_

author maintainer
#3 lore raw
Quoted 6 lines · Andrew Morton
Quoted 1 line

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

I'd like to understand who is (or claims to be) adversely affected by this change, and what their complaints (if any) will be.

Because I prefer my flamewars pre- rather than post-merge.

This was already discussed and resolved during previous postings of the patch.

In a nutshell, there is no safe way to unload an LSM. The modular interface is thus unecessary and broken infrastructure. It is used only by out-of-tree modules, which are often binary-only, illegal, abusive of the API and dangerous, e.g. silently re-vectoring SELinux.

Chris has already agreed to take the patch:
http://lkml.org/lkml/2007/6/24/152

Quoted 2 lines

aww man, you passed over an opportunity to fix vast amounts of coding style cruftiness.

GregKH-esque :-)

Quoted 3 lines

<does whizzy things>

Here you go..

Thanks.

Signature · 2 lines
James Morris
<[email protected]>
#4 lore raw
Quoted 10 lines · James Morris
Quoted 6 lines · Andrew Morton
Quoted 1 line

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

I'd like to understand who is (or claims to be) adversely affected by this change, and what their complaints (if any) will be.

Because I prefer my flamewars pre- rather than post-merge.

Quoted 7 lines

This was already discussed and resolved during previous postings of the patch.

In a nutshell, there is no safe way to unload an LSM. The modular interface is thus unecessary and broken infrastructure. It is used only by out-of-tree modules, which are often binary-only, illegal, abusive of the API and dangerous, e.g. silently re-vectoring SELinux.

there's a difference between 'often' and 'always'. I really don't think you want to start that sort of argument (after all, would you like it if the MPAA argued "dvd burners are often used to make pirate copies, let's make it so that they won't burn anything without being given a special key"?)

and arguing that the LSM is only used by out-of-tree modules and then strenuously opposing mergeing of such modules means that one of your arguments is bogus

David Lang

Quoted 17 lines

Chris has already agreed to take the patch:
http://lkml.org/lkml/2007/6/24/152

Quoted 2 lines

aww man, you passed over an opportunity to fix vast amounts of coding style cruftiness.

GregKH-esque :-)

Quoted 3 lines

<does whizzy things>

Here you go..

Thanks.

#5 lore raw
In reply to James Morris
Quoted 5 lines · James Morris
Quoted 2 lines · Andrew Morton

aww man, you passed over an opportunity to fix vast amounts of coding style cruftiness.

GregKH-esque :-)

Yeah, sorry, that was when I was young and foolish and liked to bang on the spacebar more than I should have :)

greg k-h

#6 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface, as the ability to unload a security module is not required by in-tree users and potentially complicates the overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API abuse.

Quoted 7 lines
Quoted 4 lines

Parameters for the capability and root_plug modules are now specified at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

I'd like to understand who is (or claims to be) adversely affected by this change, and what their complaints (if any) will be.

I am currently loading and unloading a prototype like security module on a regular basis. The fact that such a module can be loaded and unloaded (albeit in an unsecure way) greatly simplifies development. Thus this change will adversely affect me and probably also others that develop LSMs.

Additionally deployment of and choice among legitimate security modules that may or may not (yet) be part of the main kernel tree is simplified by an option to load these security modules (e.g. at boot time) into a running kernel. This way a distribution can provide AppArmor, SELinux, SecLevl and whatever as options very much in the same way that this works for a driver.

Quoted 1 line

Because I prefer my flamewars pre- rather than post-merge.

You asked for oppinion. I do not plan to engage in any flamewars.

regards Christian

maintainer
#7 lore raw
Quoted 25 lines · Christian Ehrhardt
Quoted 10 lines · Andrew Morton
Quoted 7 lines · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface, as the ability to unload a security module is not required by in-tree users and potentially complicates the overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API abuse.

Quoted 7 lines
Quoted 4 lines

Parameters for the capability and root_plug modules are now specified at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

I'd like to understand who is (or claims to be) adversely affected by this change, and what their complaints (if any) will be.

I am currently loading and unloading a prototype like security module on a regular basis. The fact that such a module can be loaded and unloaded (albeit in an unsecure way) greatly simplifies development. Thus this change will adversely affect me and probably also others that develop LSMs.

Quoted 3 lines

Additionally deployment of and choice among legitimate security modules that may or may not (yet) be part of the main kernel tree is simplified by an option to load these security modules (e.g. at boot time) into a running

Right, the ability to boot with security.capability=disabpled (or whatever) and then load a custom module without having to use a whole new kernel is something I'm sure end-users want.

Especially since compiling a kernel which works with, say, a default fedora install, with lvm etc, is not imo for a novice (where novice != security novice).

Maybe there are no out of tree modules being used this way, or maybe there are but I just don't know about them, or maybe like James says they are all illegal modules and kill a puppy every time they are loaded.

Quoted 6 lines

kernel. This way a distribution can provide AppArmor, SELinux, SecLevl and whatever as options very much in the same way that this works for a driver.

Quoted 1 line

Because I prefer my flamewars pre- rather than post-merge.

You asked for oppinion. I do not plan to engage in any flamewars.

Ditto. There is very loud support for this - which may mean there is *broad* support for it.

If we could get a few (non-afilliated :) people who work with customers in the security field to tell us whether this is being used, that would be very helpful. Not sure how to get that.

Or we just apply the patch and see who yells :)

-serge

author maintainer
#8 lore raw
Quoted 3 lines · Serge E. Hallyn

If we could get a few (non-afilliated :) people who work with customers in the security field to tell us whether this is being used, that would be very helpful. Not sure how to get that.

The mainline kernel does not cater to out of tree code.

Quoted 1 line

Or we just apply the patch and see who yells :)

It's already pretty clear.

- James

Signature · 2 lines
James Morris
<[email protected]>
maintainer
#9 lore raw
Quoted 7 lines · James Morris
Quoted 3 lines · Serge E. Hallyn

If we could get a few (non-afilliated :) people who work with customers in the security field to tell us whether this is being used, that would be very helpful. Not sure how to get that.

The mainline kernel does not cater to out of tree code.

(Must... resist...)

Quoted 4 lines
Quoted 1 line

Or we just apply the patch and see who yells :)

It's already pretty clear.

I doubt anyone not on lkml or linux-security-module has heard of this.

So we'll see.

(I was, obviously, talking about end-users)

-serge

author maintainer
#10 lore raw
Quoted 7 lines · Serge E. Hallyn
Quoted 1 line

It's already pretty clear.

I doubt anyone not on lkml or linux-security-module has heard of this.

So we'll see.

(I was, obviously, talking about end-users)

If distributions are shipping binary modules and other out of tree code to their users, then they should bear responsibility for supporting and maintaining the infrastructure required for it, and not expect upstream maintainers to do it for them.

Additionally, if they want to expose their users to risks arising from broken and unecessary infrastructure, then they should bear the cost and responsibility of doing that and not expect others to do so as well.

I don't see how this is even slightly difficult to understand.

- James

Signature · 2 lines
James Morris
<[email protected]>
#11 lore raw
Quoted 15 lines · James Morris
Quoted 7 lines · Serge E. Hallyn
Quoted 1 line

It's already pretty clear.

I doubt anyone not on lkml or linux-security-module has heard of this.

So we'll see.

(I was, obviously, talking about end-users)

If distributions are shipping binary modules and other out of tree code to their users, then they should bear responsibility for supporting and maintaining the infrastructure required for it, and not expect upstream maintainers to do it for them.

Quoted 5 lines

Additionally, if they want to expose their users to risks arising from broken and unecessary infrastructure, then they should bear the cost and responsibility of doing that and not expect others to do so as well.

I don't see how this is even slightly difficult to understand.

I'm not talking about distros - I don't see how this is even slightly difficult to understand :)

The situation I have in mind is someone who decideds to use, say, SLIM, but wants to otherwise use the distro kernel.

James, relax, I'm done arguing against your patch, I just think end-users/customers might complain.

-serge

#12 lore raw
Quoted 20 lines · Serge E. Hallyn
Quoted 19 lines · James Morris
Quoted 7 lines · Serge E. Hallyn
Quoted 1 line

It's already pretty clear.

I doubt anyone not on lkml or linux-security-module has heard of this.

So we'll see.

(I was, obviously, talking about end-users)

If distributions are shipping binary modules and other out of tree code to their users, then they should bear responsibility for supporting and maintaining the infrastructure required for it, and not expect upstream maintainers to do it for them.

Additionally, if they want to expose their users to risks arising from broken and unecessary infrastructure, then they should bear the cost and responsibility of doing that and not expect others to do so as well.

Quoted 8 lines
Quoted 1 line

I don't see how this is even slightly difficult to understand.

I'm not talking about distros - I don't see how this is even slightly difficult to understand :)

The situation I have in mind is someone who decideds to use, say, SLIM, but wants to otherwise use the distro kernel.
...

AFAIR this does anyway not work because at least the version of SLIM that once was in -mm required some patching of the kernel.

Quoted 1 line

-serge

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#13 lore raw
In reply to James Morris
Quoted 7 lines · James Morris
Quoted 3 lines · Serge E. Hallyn

If we could get a few (non-afilliated :) people who work with customers in the security field to tell us whether this is being used, that would be very helpful. Not sure how to get that.

The mainline kernel does not cater to out of tree code.

Please distinguish between "cater to" and "support". If the kernel didn't worry about supporting out-of-tree code, then why would there be loadable module at all?

Christian Ehrhardt already pointed to two reasons for loadable LSMs that are sufficient to justify keeping them - so you can replace them iteratively while you're developing them or choose between alternatives.

Another twist is to use a tool to generate the module from a policy-definition file; this could be done at boot-time or could be done to replace the current policy on a running system (perhaps to add a new domain corresponding to a newly added service). Yes, this would need to be done with a lot of care, but part of providing mechanism (rather than policy) is enabling people to use the mechanism in the ways they prefer.

scott

Signature · 1 line
scott preece
#14 lore raw
Quoted 4 lines

Please distinguish between "cater to" and "support". If the kernel didn't worry about supporting out-of-tree code, then why would there be loadable module at all?

Memory usage, flexibility, debugging.

Module support was not added for external modules.

#15 lore raw
Quoted 9 lines · Alan Cox
Quoted 4 lines

Please distinguish between "cater to" and "support". If the kernel didn't worry about supporting out-of-tree code, then why would there be loadable module at all?

Memory usage, flexibility, debugging.

Module support was not added for external modules.

Code that is being debugged is, often [usually, I hope], out-of-tree code, though it may be aimed at future inclusion.

However, I do agree that there is value to having loadable modules for in-tree functionality, too.

scott

Signature · 1 line
scott preece
#16 lore raw
In reply to Scott Preece
Quoted 7 lines · Scott Preece
Quoted 6 lines · James Morris
Quoted 3 lines · Serge E. Hallyn

If we could get a few (non-afilliated :) people who work with customers in the security field to tell us whether this is being used, that would be very helpful. Not sure how to get that.

Quoted 6 lines
Quoted 1 line

The mainline kernel does not cater to out of tree code.

Please distinguish between "cater to" and "support". If the kernel didn't worry about supporting out-of-tree code, then why would there be loadable module at all?
...

Distribution kernels need modules or the kernel images would be extremely large.

Quoted 7 lines

Another twist is to use a tool to generate the module from a policy-definition file; this could be done at boot-time or could be done to replace the current policy on a running system (perhaps to add a new domain corresponding to a newly added service). Yes, this would need to be done with a lot of care, but part of providing mechanism (rather than policy) is enabling people to use the mechanism in the ways they prefer.

Why do you need to generate a module for changing a policy?

Software like SELinux contains the mechanisms to change the policy without having to change the kernel.

Quoted 1 line

scott

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#17 lore raw
In reply to Serge E. Hallyn
Quoted 8 lines

Right, the ability to boot with security.capability=disabpled (or whatever) and then load a custom module without having to use a whole new kernel is something I'm sure end-users want.

Especially since compiling a kernel which works with, say, a default fedora install, with lvm etc, is not imo for a novice (where novice != security novice).

the next step after this patch is to have an option to get rid of all the function pointer chasing (which is expensive) for the case where you know you only want one security module (which you then can turn on or off)... that advantage is a performance gain for a lot of people.... but if the person configuring the kernel selects this, it does mean there's no way to load modules. I don't know what Fedora will do, but they might select such an option. That's CHOICE... they chose a performance improvement over enabling external kernel modules that they don't ship anyway...

but is it really worth blocking such clear improvements in performance?

Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
#18 lore raw
Quoted 9 lines · Arjan van de Ven
Quoted 8 lines

Right, the ability to boot with security.capability=disabpled (or whatever) and then load a custom module without having to use a whole new kernel is something I'm sure end-users want.

Especially since compiling a kernel which works with, say, a default fedora install, with lvm etc, is not imo for a novice (where novice != security novice).

Quoted 7 lines

the next step after this patch is to have an option to get rid of all the function pointer chasing (which is expensive) for the case where you know you only want one security module (which you then can turn on or off)... that advantage is a performance gain for a lot of people.... but if the person configuring the kernel selects this, it does mean there's no way to load modules. I don't know what Fedora will do, but they might select such an option. That's CHOICE...

War is peace
Freedom is slavery
Ignorance is strength

	-1984

:)

Actually, given that when lsm was being introduced, lsm seemed to improve performance overall, have you taken any measurements to show that this is actually the case? Of course it makes sense that it would, but witjout measurements we do not know.

Quoted 6 lines

they chose a performance

improvement over enabling external kernel modules that they don't ship anyway...

but is it really worth blocking such clear improvements in performance?

I'm blocking nothing.

In fact I concede that this patch might force any out of tree module authors to come to the table, which is a good thing.

-serge

#19 lore raw
Quoted 4 lines · * Serge E. Hallyn ([email protected]) wrote:

Actually, given that when lsm was being introduced, lsm seemed to improve performance overall, have you taken any measurements to show that this is actually the case? Of course it makes sense that it would, but witjout measurements we do not know.

Yes, it does. I have measured it as have others (esp. after Kurt Garloff pointed out issues on ia64).

thanks,
-chris

#20 lore raw
In reply to Serge E. Hallyn
Quoted 8 lines

:)

Actually, given that when lsm was being introduced, lsm seemed to improve performance overall, have you taken any measurements to show that this is actually the case? Of course it makes sense that it would, but witjout measurements we do not know.

SuSE did a bunch of measurement I think a year ago and they showed a several percent performance increase with a hack similar to the proposed next step..

Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
#21 lore raw
Quoted 4 lines · Arjan van de Ven
Quoted 4 lines

:)

Quoted 8 lines
Quoted 4 lines

Actually, given that when lsm was being introduced, lsm seemed to improve performance overall, have you taken any measurements to show that this is actually the case? Of course it makes sense that it would, but witjout measurements we do not know.

SuSE did a bunch of measurement I think a year ago and they showed a several percent performance increase with a hack similar to the proposed next step..

Very good.

-serge

#22 lore raw
In reply to Arjan van de Ven
Quoted 4 lines · Arjan van de Ven

the next step after this patch is to have an option to get rid of all the function pointer chasing (which is expensive) for the case where you know you only want one security module (which you then can turn on or off)... that advantage is a performance gain for a lot of people....

I'm pretty sure that at least the security_ops function pointers could be resolved statically with some proprocessor trickery right now.

E.g. define macros for the security_* hooks in the single security module that is configured statically and include those defines in security.h instead of the prototypes for the inline functions. Am I missing something?

If a distribution enables such an option there is no way to load a security module, true. This is what we have right now if the distro disables loadable module support or disables security modules.

regards Christian

#23 lore raw
In reply to James Morris
Quoted 1 line · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface

allmodconfig broke

security/built-in.o: In function `rootplug_bprm_check_security':
security/root_plug.c:64: undefined reference to usb_find_device' security/root_plug.c:70: undefined reference to usb_put_dev'

#24 lore raw
Quoted 9 lines · Andrew Morton
Quoted 1 line · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface

allmodconfig broke

security/built-in.o: In function `rootplug_bprm_check_security':
security/root_plug.c:64: undefined reference to usb_find_device' security/root_plug.c:70: undefined reference to usb_put_dev'

That's wierd, who would have disabled the exports of those functions or removed the "#include <linux/usb.h>" from this file?

thanks,

greg k-h

#25 lore raw
Quoted 5 lines · On Tue, 24 Jul 2007 01:53:58 -0700 Greg KH <[email protected]> wrote:
Quoted 4 lines · Andrew Morton
Quoted 1 line · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface

Quoted 9 lines
Quoted 5 lines

allmodconfig broke

security/built-in.o: In function `rootplug_bprm_check_security':
security/root_plug.c:64: undefined reference to usb_find_device' security/root_plug.c:70: undefined reference to usb_put_dev'

That's wierd, who would have disabled the exports of those functions or removed the "#include <linux/usb.h>" from this file?

root_plug is linked into vmlinux and usb is modular. I did this:

security/Kconfig renamed from security/Kconfig~security-convert-lsm-into-a-static-interface-fix-2 +1 -1
@@ -82,7 +82,7 @@ config SECURITY_CAPABILITIES
 
 config SECURITY_ROOTPLUG
 	bool "Root Plug Support"
-	depends on USB && SECURITY
+	depends on USB=y && SECURITY
 	help
 	  This is a sample LSM module that should only be used as such.
 	  It prevents any programs running with egid == 0 if a specific

_

I suppose we could do SECURITY_ROOTPLUG=m if USB=m, but I thought the whole point was to disallow modular LSM clients?

#26 lore raw
Quoted 22 lines · Andrew Morton
Quoted 5 lines · On Tue, 24 Jul 2007 01:53:58 -0700 Greg KH <[email protected]> wrote:
Quoted 4 lines · Andrew Morton
Quoted 1 line · On Sat, 14 Jul 2007 12:37:01 -0400 (EDT) James Morris <[email protected]> wrote:

Convert LSM into a static interface

Quoted 9 lines
Quoted 5 lines

allmodconfig broke

security/built-in.o: In function `rootplug_bprm_check_security':
security/root_plug.c:64: undefined reference to usb_find_device' security/root_plug.c:70: undefined reference to usb_put_dev'

That's wierd, who would have disabled the exports of those functions or removed the "#include <linux/usb.h>" from this file?

root_plug is linked into vmlinux and usb is modular. I did this:

security/Kconfig config SECURITY_CAPABILITIES · line 88

Quoted 8 lines
security/Kconfig renamed from security/Kconfig~security-convert-lsm-into-a-static-interface-fix-2 +1 -1
@@ -82,7 +82,7 @@ config SECURITY_CAPABILITIES
 
 config SECURITY_ROOTPLUG
 	bool "Root Plug Support"
-	depends on USB && SECURITY
+	depends on USB=y && SECURITY
 	help
 	  This is a sample LSM module that should only be used as such.
 	  It prevents any programs running with egid == 0 if a specific

That looks correct to me.

thanks,

greg k-h