Skip to contentSkip to conversation

LSM changes for 2.5.27

PATCH In review Greg KH 3 participants 13 messages Jul 23, 2002 – Jul 24, 2002

Subsystems (19)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 LSM changes for 2.5.27

Hi,

These changesets contain some changes to the different arch config.in menus to pull in the security menu, some CREDIT file updates, and the file specific LSM hooks.

Please pull from: bk://lsm.bkbits.net/linus-2.5

thanks,

greg k-h

 CREDITS                   |   24 +
 arch/alpha/config.in      |    1 
 arch/arm/config.in        |    1 
 arch/cris/config.in       |    4 
 arch/ia64/config.in       |    2 
 arch/ia64/kernel/ptrace.c |    4 
 arch/m68k/config.in       |    1 
 arch/mips/config.in       |    1 
 arch/mips64/config.in     |    1 
 arch/parisc/config.in     |    1 
 arch/ppc/config.in        |    3 
 arch/ppc64/config.in      |    1 
 arch/s390/config.in       |    1 
 arch/s390x/config.in      |    1 
 arch/sh/config.in         |    1 
 arch/sparc/config.in      |    1 
 arch/sparc64/config.in    |    1 
 arch/x86_64/config.in     |    1 
 drivers/char/tty_io.c     |   30 +-
 fs/attr.c                 |   11 
 fs/dnotify.c              |    8 
 fs/dquot.c                |    3 
 fs/fcntl.c                |   25 +
 fs/file_table.c           |    9 
 fs/inode.c                |   12 
 fs/ioctl.c                |    8 
 fs/locks.c                |   20 +
 fs/namei.c                |  143 ++++++++--
 fs/namespace.c            |   27 ++
 fs/open.c                 |    4 
 fs/proc/base.c            |    2 
 fs/quota.c                |    4 
 fs/read_write.c           |   45 ++-
 fs/readdir.c              |    5 
 fs/stat.c                 |   13 
 fs/super.c                |    9 
 fs/xattr.c                |   17 +
 include/linux/fs.h        |   38 ++
 include/linux/security.h  |  430 ++++++++++++++++++++++++++++++++
 init/do_mounts.c          |    1 
 kernel/acct.c             |    5 
 mm/filemap.c              |    9 
 mm/mmap.c                 |    5 
 mm/mprotect.c             |    5 
 net/core/scm.c            |    4 
 security/capability.c     |  608 ++++++++++++++++++++++++++++++++++++---------
 security/dummy.c          |  612 ++++++++++++++++++++++++++++++++++++----------
 47 files changed, 1845 insertions(+), 317 deletions(-)

[email protected], 2002-07-22 14:44:56-07:00, [email protected]
LSM: fixed typo that happened in merge

 security/dummy.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

------

[email protected], 2002-07-22 14:20:35-07:00, [email protected]
Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5 into kroah.com:/home/greg/linux/BK/work-2.5

 fs/namei.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

------

[email protected], 2002-07-22 14:17:41-07:00, [email protected]
LSM: convert initializers to C99 style.

 security/capability.c |  106 ++++++++++++++++++++++++------------------------
 security/dummy.c      |  110 +++++++++++++++++++++++++-------------------------
 2 files changed, 108 insertions(+), 108 deletions(-)

------

[email protected], 2002-07-22 14:06:28-07:00, [email protected]
merge

 drivers/char/tty_io.c |   26 ++++++-----------
 fs/namei.c            |   10 +-----
 include/linux/fs.h    |   33 ++++++++++++++++++++-
 security/capability.c |   76 +++++++++++++++++++++++++-------------------------
 security/dummy.c      |   70 +++++++++++++++++++++++-----------------------
 5 files changed, 117 insertions(+), 98 deletions(-)

------

[email protected], 2002-07-22 13:50:01-07:00, [email protected]
[PATCH] LSM: file related LSM hooks

The below patch adds the filesystem-related LSM hooks, specifically the super_block, inode, and file hooks, to the 2.5.27 kernel.

 drivers/char/tty_io.c    |    4 
 fs/attr.c                |   11 -
 fs/dnotify.c             |    8 
 fs/dquot.c               |    3 
 fs/fcntl.c               |   25 ++
 fs/file_table.c          |    9 
 fs/inode.c               |   12 +
 fs/ioctl.c               |    8 
 fs/locks.c               |   20 ++
 fs/namei.c               |  127 ++++++++++---
 fs/namespace.c           |   27 ++
 fs/open.c                |    4 
 fs/proc/base.c           |    2 
 fs/quota.c               |    4 
 fs/read_write.c          |   45 +++-
 fs/readdir.c             |    5 
 fs/stat.c                |   13 +
 fs/super.c               |    9 
 fs/xattr.c               |   17 +
 include/linux/fs.h       |    5 
 include/linux/security.h |  430 +++++++++++++++++++++++++++++++++++++++++++++++
 init/do_mounts.c         |    1 
 kernel/acct.c            |    5 
 mm/filemap.c             |    9 
 mm/mmap.c                |    5 
 mm/mprotect.c            |    5 
 net/core/scm.c           |    4 
 security/capability.c    |  362 +++++++++++++++++++++++++++++++++++++++
 security/dummy.c         |  366 ++++++++++++++++++++++++++++++++++++++++
 29 files changed, 1501 insertions(+), 44 deletions(-)

------

[email protected], 2002-07-22 13:21:07-07:00, [email protected]
[PATCH] LSM: CREDITS entry

 CREDITS |    8 ++++++++
 1 files changed, 8 insertions(+)

------

[email protected], 2002-07-22 12:32:00-07:00, [email protected]
added ptrace hook for ia64

 arch/ia64/kernel/ptrace.c |    4 ++++
 1 files changed, 4 insertions(+)

------

[email protected], 2002-07-22 12:29:42-07:00, [email protected]
updated my CREDITS entry.

 CREDITS |    1 +
 1 files changed, 1 insertion(+)

------

[email protected], 2002-07-22 12:26:00-07:00, [email protected]
[PATCH] LSM: CREDITS entries

Here are CREDITS entries for myself and my two colleagues who also contributed to LSM.

 CREDITS |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

------

[email protected], 2002-07-22 11:55:00-07:00, [email protected]
LSM: fixed up all of the other archs (non i386) to include the security config menu.

 arch/alpha/config.in   |    1 +
 arch/arm/config.in     |    1 +
 arch/cris/config.in    |    4 +++-
 arch/ia64/config.in    |    2 ++
 arch/m68k/config.in    |    1 +
 arch/mips/config.in    |    1 +
 arch/mips64/config.in  |    1 +
 arch/parisc/config.in  |    1 +
 arch/ppc/config.in     |    3 +++
 arch/ppc64/config.in   |    1 +
 arch/s390/config.in    |    1 +
 arch/s390x/config.in   |    1 +
 arch/sh/config.in      |    1 +
 arch/sparc/config.in   |    1 +
 arch/sparc64/config.in |    1 +
 arch/x86_64/config.in  |    1 +
 16 files changed, 21 insertions(+), 1 deletion(-)

------

[email protected], 2002-07-22 10:11:56-07:00, [email protected]
[PATCH] LSM to designated initializers

Over the last few days there has been discussion on the LKML list about converting struct initializers from the
field: val,
format into
.field = val,

I have included a patch that will do this for both the dummy and capabilities files.

 security/capability.c |   64 +++++++++++++++++++++++++-------------------------
 security/dummy.c      |   64 +++++++++++++++++++++++++-------------------------
 2 files changed, 64 insertions(+), 64 deletions(-)

------

author
#1 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:

#	           ChangeSet	1.665   -> 1.665.1.1
#	     fs/file_table.c	1.9     -> 1.10   
#	           fs/open.c	1.26    -> 1.27   
#	           mm/mmap.c	1.35    -> 1.36   
#	      fs/proc/base.c	1.26    -> 1.27   
#	          fs/fcntl.c	1.11    -> 1.12   
#	          fs/dquot.c	1.43    -> 1.44   
#	           fs/attr.c	1.9     -> 1.10   
#	include/linux/security.h	1.1     -> 1.2    
#	           fs/stat.c	1.12    -> 1.13   
#	          fs/ioctl.c	1.4     -> 1.5    
#	    security/dummy.c	1.1     -> 1.1.1.1
#	  include/linux/fs.h	1.145   -> 1.145.1.1
#	        fs/dnotify.c	1.4     -> 1.5    
#	        mm/filemap.c	1.113   -> 1.114  
#	          fs/namei.c	1.50    -> 1.50.2.1
#	security/capability.c	1.1     -> 1.1.1.1
#	    init/do_mounts.c	1.19    -> 1.20   
#	      net/core/scm.c	1.2     -> 1.3    
#	       mm/mprotect.c	1.11    -> 1.12   
#	          fs/xattr.c	1.6     -> 1.7    
#	          fs/super.c	1.79    -> 1.80   
#	        fs/readdir.c	1.8     -> 1.9    
#	       kernel/acct.c	1.11    -> 1.12   
#	drivers/char/tty_io.c	1.28    -> 1.28.1.1
#	     fs/read_write.c	1.9     -> 1.10   
#	      fs/namespace.c	1.26    -> 1.27   
#	          fs/locks.c	1.20    -> 1.21   
#	          fs/quota.c	1.7     -> 1.8    
#	          fs/inode.c	1.66    -> 1.67   

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.665.1.1
# [PATCH] LSM: file related LSM hooks
#
# The below patch adds the filesystem-related LSM hooks, specifically the # super_block, inode, and file hooks, to the 2.5.27 kernel.
# --------------------------------------------
#

drivers/char/tty_io.c +4 -0
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
@@ -1458,6 +1458,10 @@
 		if (!waitqueue_active(&tty->read_wait))
 			tty->minimum_to_wake = 1;
 		if (filp->f_owner.pid == 0) {
+			retval = security_ops->file_set_fowner(filp);
+			if (retval)
+				return retval;
+
 			filp->f_owner.pid = (-tty->pgrp) ? : current->pid;
 			filp->f_owner.uid = current->uid;
 			filp->f_owner.euid = current->euid;
fs/attr.c +8 -3
diff -Nru a/fs/attr.c b/fs/attr.c
@@ -12,6 +12,7 @@
 #include <linux/dnotify.h>
 #include <linux/fcntl.h>
 #include <linux/quotaops.h>
+#include <linux/security.h>
 
 /* Taken over from the old code... */
 
@@ -151,10 +152,14 @@
 		}
 	}
 
-	if (inode->i_op && inode->i_op->setattr) 
-		error = inode->i_op->setattr(dentry, attr);
-	else {
+	if (inode->i_op && inode->i_op->setattr) {
+		error = security_ops->inode_setattr(dentry, attr);
+		if (!error)
+			error = inode->i_op->setattr(dentry, attr);
+	} else {
 		error = inode_change_ok(inode, attr);
+		if (!error)
+			error = security_ops->inode_setattr(dentry, attr);
 		if (!error) {
 			if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
 			    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
fs/dnotify.c +8 -0
diff -Nru a/fs/dnotify.c b/fs/dnotify.c
@@ -68,6 +68,7 @@
 	struct dnotify_struct **prev;
 	struct inode *inode;
 	fl_owner_t id = current->files;
+	int error;
 
 	if ((arg & ~DN_MULTISHOT) == 0) {
 		dnotify_flush(filp, id);
@@ -93,6 +94,13 @@
 		}
 		prev = &odn->dn_next;
 	}
+
+	error = security_ops->file_set_fowner(filp);
+	if (error) {
+		write_unlock(&dn_lock);
+		return error;
+	}
+
 	filp->f_owner.pid = current->pid;
 	filp->f_owner.uid = current->uid;
 	filp->f_owner.euid = current->euid;
fs/dquot.c +3 -0
diff -Nru a/fs/dquot.c b/fs/dquot.c
@@ -1316,6 +1316,9 @@
 	error = -EIO;
 	if (!f->f_op || !f->f_op->read || !f->f_op->write)
 		goto out_f;
+	error = security_ops->quota_on(f);
+	if (error)
+		goto out_f;
 	inode = f->f_dentry->d_inode;
 	error = -EACCES;
 	if (!S_ISREG(inode->i_mode))
fs/fcntl.c +25 -0
diff -Nru a/fs/fcntl.c b/fs/fcntl.c
@@ -11,6 +11,7 @@
 #include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/iobuf.h>
+#include <linux/security.h>
 
 #include <asm/poll.h>
 #include <asm/siginfo.h>
@@ -305,6 +306,13 @@
 			break;
 		case F_SETOWN:
 			lock_kernel();
+
+			err = security_ops->file_set_fowner(filp);
+			if (err) {
+				unlock_kernel();
+				break;
+			}
+
 			filp->f_owner.pid = arg;
 			filp->f_owner.uid = current->uid;
 			filp->f_owner.euid = current->euid;
@@ -353,6 +361,12 @@
 	if (!filp)
 		goto out;
 
+	err = security_ops->file_fcntl(filp, cmd, arg);
+	if (err) {
+		fput(filp);
+		return err;
+	}
+
 	err = do_fcntl(fd, cmd, arg, filp);
 
  	fput(filp);
@@ -371,6 +385,13 @@
 	if (!filp)
 		goto out;
 
+	err = security_ops->file_fcntl(filp, cmd, arg);
+	if (err) {
+		fput(filp);
+		return err;
+	}
+	err = -EBADF;
+	
 	switch (cmd) {
 		case F_GETLK64:
 			err = fcntl_getlk64(filp, (struct flock64 *) arg);
@@ -409,6 +430,10 @@
 	    (fown->euid ^ p->suid) && (fown->euid ^ p->uid) &&
 	    (fown->uid ^ p->suid) && (fown->uid ^ p->uid))
 		return;
+
+	if (security_ops->file_send_sigiotask(p, fown, fd, reason))
+		return;
+
 	switch (fown->signum) {
 		siginfo_t si;
 		default:
fs/file_table.c +9 -0
diff -Nru a/fs/file_table.c b/fs/file_table.c
@@ -13,6 +13,7 @@
 #include <linux/smp_lock.h>
 #include <linux/iobuf.h>
 #include <linux/fs.h>
+#include <linux/security.h>
 
 /* sysctl tunables... */
 struct files_stat_struct files_stat = {0, 0, NR_FILE};
@@ -43,6 +44,12 @@
 		files_stat.nr_free_files--;
 	new_one:
 		memset(f, 0, sizeof(*f));
+		if (security_ops->file_alloc_security(f)) {
+			list_add(&f->f_list, &free_list);
+			files_stat.nr_free_files++;
+			file_list_unlock();
+			return NULL;
+		}
 		atomic_set(&f->f_count,1);
 		f->f_version = ++event;
 		f->f_uid = current->fsuid;
@@ -117,6 +124,7 @@
 
 	if (file->f_op && file->f_op->release)
 		file->f_op->release(inode, file);
+	security_ops->file_free_security(file);
 	fops_put(file->f_op);
 	if (file->f_mode & FMODE_WRITE)
 		put_write_access(inode);
@@ -149,6 +157,7 @@
 void put_filp(struct file *file)
 {
 	if(atomic_dec_and_test(&file->f_count)) {
+		security_ops->file_free_security(file);
 		file_list_lock();
 		list_del(&file->f_list);
 		list_add(&file->f_list, &free_list);
fs/inode.c +12 -0
diff -Nru a/fs/inode.c b/fs/inode.c
@@ -16,6 +16,7 @@
 #include <linux/backing-dev.h>
 #include <linux/wait.h>
 #include <linux/hash.h>
+#include <linux/security.h>
 
 /*
  * This is needed for the following functions:
@@ -100,6 +101,14 @@
 	if (inode) {
 		struct address_space * const mapping = &inode->i_data;
 
+		inode->i_security = NULL;
+		if (security_ops->inode_alloc_security(inode)) {
+			if (inode->i_sb->s_op->destroy_inode)
+				inode->i_sb->s_op->destroy_inode(inode);
+			else
+				kmem_cache_free(inode_cachep, (inode));
+			return NULL;
+		}
 		inode->i_sb = sb;
 		inode->i_dev = sb->s_dev;
 		inode->i_blkbits = sb->s_blocksize_bits;
@@ -137,6 +146,7 @@
 {
 	if (inode_has_buffers(inode))
 		BUG();
+	security_ops->inode_free_security(inode);
 	if (inode->i_sb->s_op->destroy_inode)
 		inode->i_sb->s_op->destroy_inode(inode);
 	else
@@ -792,6 +802,8 @@
 
 	if (inode->i_data.nrpages)
 		truncate_inode_pages(&inode->i_data, 0);
+
+	security_ops->inode_delete(inode);
 
 	if (op && op->delete_inode) {
 		void (*delete)(struct inode *) = op->delete_inode;
fs/ioctl.c +8 -0
diff -Nru a/fs/ioctl.c b/fs/ioctl.c
@@ -8,6 +8,7 @@
 #include <linux/smp_lock.h>
 #include <linux/file.h>
 #include <linux/fs.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
@@ -57,6 +58,13 @@
 	if (!filp)
 		goto out;
 	error = 0;
+
+	error = security_ops->file_ioctl(filp, cmd, arg);
+        if (error) {
+                fput(filp);
+                goto out;
+        }
+
 	lock_kernel();
 	switch (cmd) {
 		case FIOCLEX:
fs/locks.c +20 -0
diff -Nru a/fs/locks.c b/fs/locks.c
@@ -1309,6 +1309,11 @@
 	fl->fl_next = *before;
 	*before = fl;
 	list_add(&fl->fl_link, &file_lock_list);
+
+	error = security_ops->file_set_fowner(filp);
+	if (error)
+		goto out_unlock;
+
 	filp->f_owner.pid = current->pid;
 	filp->f_owner.uid = current->uid;
 	filp->f_owner.euid = current->euid;
@@ -1354,6 +1359,11 @@
 	if (error < 0)
 		goto out_putf;
 
+	error = security_ops->file_lock(filp, cmd,
+					(cmd & LOCK_NB) ? 0 : 1);
+	if (error)
+		goto out_putf;
+
 	error = flock_lock_file(filp, lock,
 				(cmd & (LOCK_UN | LOCK_NB)) ? 0 : 1);
 
@@ -1484,6 +1494,11 @@
 		goto out;
 	}
 
+	error = security_ops->file_lock(filp, file_lock->fl_type,
+	                                cmd == F_SETLKW);
+	if (error)
+		goto out;
+
 	if (filp->f_op && filp->f_op->lock != NULL) {
 		error = filp->f_op->lock(filp, cmd, file_lock);
 		if (error < 0)
@@ -1602,6 +1617,11 @@
 		error = -EINVAL;
 		goto out;
 	}
+
+	error = security_ops->file_lock(filp, file_lock->fl_type,
+					cmd == F_SETLKW64);
+	if (error)
+		goto out;
 
 	if (filp->f_op && filp->f_op->lock != NULL) {
 		error = filp->f_op->lock(filp, cmd, file_lock);
fs/namei.c +100 -27

283 lines not on this page · raw message

fs/namespace.c +27 -0
diff -Nru a/fs/namespace.c b/fs/namespace.c
@@ -288,6 +288,10 @@
 	struct super_block * sb = mnt->mnt_sb;
 	int retval = 0;
 
+	retval = security_ops->sb_umount(mnt, flags);
+	if (retval)
+		return retval;
+
 	/*
 	 * If we may have to abort operations to get out of this
 	 * mount, and they will themselves hold resources we must
@@ -337,6 +341,7 @@
 		DQUOT_OFF(sb);
 		acct_auto_close(sb);
 		unlock_kernel();
+		security_ops->sb_umount_close(mnt);
 		spin_lock(&dcache_lock);
 	}
 	retval = -EBUSY;
@@ -346,6 +351,8 @@
 		retval = 0;
 	}
 	spin_unlock(&dcache_lock);
+	if (retval)
+		security_ops->sb_umount_busy(mnt);
 	up_write(&current->namespace->sem);
 	return retval;
 }
@@ -463,6 +470,10 @@
 	if (IS_DEADDIR(nd->dentry->d_inode))
 		goto out_unlock;
 
+	err = security_ops->sb_check_sb(mnt, nd);
+	if (err)
+		goto out_unlock;
+
 	spin_lock(&dcache_lock);
 	if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) {
 		struct list_head head;
@@ -475,6 +486,8 @@
 	spin_unlock(&dcache_lock);
 out_unlock:
 	up(&nd->dentry->d_inode->i_sem);
+	if (!err)
+		security_ops->sb_post_addmount(mnt, nd);
 	return err;
 }
 
@@ -544,6 +557,8 @@
 	if (!err)
 		nd->mnt->mnt_flags=mnt_flags;
 	up_write(&sb->s_umount);
+	if (!err)
+		security_ops->sb_post_remount(nd->mnt, flags, data);
 	return err;
 }
 
@@ -726,6 +741,10 @@
 	if (retval)
 		return retval;
 
+	retval = security_ops->sb_mount(dev_name, &nd, type_page, flags, data_page);
+	if (retval)
+		goto dput_out;
+
 	if (flags & MS_REMOUNT)
 		retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
 				    data_page);
@@ -736,6 +755,7 @@
 	else
 		retval = do_add_mount(&nd, type_page, flags, mnt_flags,
 				      dev_name, data_page);
+dput_out:
 	path_release(&nd);
 	return retval;
 }
@@ -919,6 +939,12 @@
 	if (error)
 		goto out1;
 
+	error = security_ops->sb_pivotroot(&old_nd, &new_nd);
+	if (error) {
+		path_release(&old_nd);
+		goto out1;
+	}
+
 	read_lock(&current->fs->lock);
 	user_nd.mnt = mntget(current->fs->rootmnt);
 	user_nd.dentry = dget(current->fs->root);
@@ -963,6 +989,7 @@
 	attach_mnt(new_nd.mnt, &root_parent);
 	spin_unlock(&dcache_lock);
 	chroot_fs_refs(&user_nd, &new_nd);
+	security_ops->sb_post_pivotroot(&user_nd, &new_nd);
 	error = 0;
 	path_release(&root_parent);
 	path_release(&parent_nd);
fs/open.c +4 -0
diff -Nru a/fs/open.c b/fs/open.c
@@ -17,6 +17,7 @@
 #include <linux/iobuf.h>
 #include <linux/namei.h>
 #include <linux/backing-dev.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 
@@ -30,6 +31,9 @@
 		retval = -ENOSYS;
 		if (sb->s_op && sb->s_op->statfs) {
 			memset(buf, 0, sizeof(struct statfs));
+			retval = security_ops->sb_statfs(sb);
+			if (retval)
+				return retval;
 			retval = sb->s_op->statfs(sb, buf);
 		}
 	}
fs/proc/base.c +1 -1
diff -Nru a/fs/proc/base.c b/fs/proc/base.c
@@ -406,7 +406,7 @@
 };
 
 #define MAY_PTRACE(p) \
-(p==current||(p->parent==current&&(p->ptrace & PT_PTRACED)&&p->state==TASK_STOPPED))
+(p==current||(p->parent==current&&(p->ptrace & PT_PTRACED)&&p->state==TASK_STOPPED&&security_ops->ptrace(current,p)==0))
 
 
 static int mem_open(struct inode* inode, struct file* file)
fs/quota.c +3 -1
diff -Nru a/fs/quota.c b/fs/quota.c
@@ -12,6 +12,7 @@
 #include <asm/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/smp_lock.h>
+#include <linux/security.h>
 
 /* Check validity of quotactl */
 static int check_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
@@ -96,7 +97,8 @@
 	else if (cmd != Q_GETFMT && cmd != Q_SYNC && cmd != Q_GETINFO && cmd != Q_XGETQSTAT)
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-	return 0;
+
+	return security_ops->quotactl (cmd, type, id, sb);
 }
 
 /* Resolve device pathname to superblock */
fs/read_write.c +35 -10

87 lines not on this page · raw message

fs/readdir.c +5 -0
diff -Nru a/fs/readdir.c b/fs/readdir.c
@@ -20,6 +20,11 @@
 	int res = -ENOTDIR;
 	if (!file->f_op || !file->f_op->readdir)
 		goto out;
+
+	res = security_ops->file_permission(file, MAY_READ);
+	if (res)
+		goto out;
+
 	down(&inode->i_sem);
 	res = -ENOENT;
 	if (!IS_DEADDIR(inode)) {
fs/stat.c +11 -2
diff -Nru a/fs/stat.c b/fs/stat.c
@@ -12,6 +12,7 @@
 #include <linux/highuid.h>
 #include <linux/fs.h>
 #include <linux/namei.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 
@@ -36,6 +37,11 @@
 int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 {
 	struct inode *inode = dentry->d_inode;
+	int retval;
+
+	retval = security_ops->inode_getattr(mnt, dentry);
+	if (retval)
+		return retval;
 
 	if (inode->i_op->getattr)
 		return inode->i_op->getattr(mnt, dentry, stat);
@@ -232,8 +238,11 @@
 
 		error = -EINVAL;
 		if (inode->i_op && inode->i_op->readlink) {
-			UPDATE_ATIME(inode);
-			error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
+			error = security_ops->inode_readlink(nd.dentry);
+			if (!error) {
+				UPDATE_ATIME(inode);
+				error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
+			}
 		}
 		path_release(&nd);
 	}
fs/super.c +9 -0
diff -Nru a/fs/super.c b/fs/super.c
@@ -31,6 +31,8 @@
 #include <linux/buffer_head.h>		/* for fsync_super() */
 #include <asm/uaccess.h>
 
+#include <linux/security.h>
+
 void get_filesystem(struct file_system_type *fs);
 void put_filesystem(struct file_system_type *fs);
 struct file_system_type *get_fs_type(const char *name);
@@ -49,6 +51,11 @@
 	struct super_block *s = kmalloc(sizeof(struct super_block),  GFP_USER);
 	if (s) {
 		memset(s, 0, sizeof(struct super_block));
+		if (security_ops->sb_alloc_security(s)) {
+			kfree(s);
+			s = NULL;
+			goto out;
+		}
 		INIT_LIST_HEAD(&s->s_dirty);
 		INIT_LIST_HEAD(&s->s_io);
 		INIT_LIST_HEAD(&s->s_locked_inodes);
@@ -67,6 +74,7 @@
 		s->dq_op = sb_dquot_ops;
 		s->s_qcop = sb_quotactl_ops;
 	}
+out:
 	return s;
 }
 
@@ -78,6 +86,7 @@
  */
 static inline void destroy_super(struct super_block *s)
 {
+	security_ops->sb_free_security(s);
 	kfree(s);
 }
 
fs/xattr.c +17 -0
diff -Nru a/fs/xattr.c b/fs/xattr.c
@@ -85,11 +85,16 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->setxattr) {
+		error = security_ops->inode_setxattr(d, kname, kvalue,
+				size, flags);
+		if (error)
+			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->setxattr(d, kname, kvalue, size, flags);
 		up(&d->d_inode->i_sem);
 	}
 
+out:
 	xattr_free(kvalue, size);
 	return error;
 }
@@ -158,6 +163,9 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->getxattr) {
+		error = security_ops->inode_getxattr(d, kname);
+		if (error)
+			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
 		up(&d->d_inode->i_sem);
@@ -166,6 +174,7 @@
 	if (kvalue && error > 0)
 		if (copy_to_user(value, kvalue, error))
 			error = -EFAULT;
+out:
 	xattr_free(kvalue, size);
 	return error;
 }
@@ -227,6 +236,9 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
+		error = security_ops->inode_listxattr(d);
+		if (error)
+			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->listxattr(d, klist, size);
 		up(&d->d_inode->i_sem);
@@ -235,6 +247,7 @@
 	if (klist && error > 0)
 		if (copy_to_user(list, klist, error))
 			error = -EFAULT;
+out:
 	xattr_free(klist, size);
 	return error;
 }
@@ -298,10 +311,14 @@
 
 	error = -EOPNOTSUPP;
 	if (d->d_inode->i_op && d->d_inode->i_op->removexattr) {
+		error = security_ops->inode_removexattr(d, kname);
+		if (error)
+			goto out;
 		down(&d->d_inode->i_sem);
 		error = d->d_inode->i_op->removexattr(d, kname);
 		up(&d->d_inode->i_sem);
 	}
+out:
 	return error;
 }
 
include/linux/fs.h +5 -0
diff -Nru a/include/linux/fs.h b/include/linux/fs.h
@@ -72,6 +72,7 @@
 #define MAY_EXEC 1
 #define MAY_WRITE 2
 #define MAY_READ 4
+#define MAY_APPEND 8
 
 #define FMODE_READ 1
 #define FMODE_WRITE 2
@@ -396,6 +397,7 @@
 	unsigned char		i_sock;
 
 	atomic_t		i_writecount;
+	void			*i_security;
 	__u32			i_generation;
 	union {
 		void				*generic_ip;
@@ -426,6 +428,7 @@
 	int pid;		/* pid or -pgrp where SIGIO should be sent */
 	uid_t uid, euid;	/* uid/euid of process setting the owner */
 	int signum;		/* posix.1b rt signal to be delivered on IO */
+	void *security;
 };
 
 static inline void inode_add_bytes(struct inode *inode, loff_t bytes)
@@ -489,6 +492,7 @@
 	struct file_ra_state	f_ra;
 
 	unsigned long		f_version;
+	void			*f_security;
 
 	/* needed for tty driver, and maybe others */
 	void			*private_data;
@@ -642,6 +646,7 @@
 	int			s_count;
 	int			s_syncing;
 	atomic_t		s_active;
+	void                    *s_security;
 
 	struct list_head	s_dirty;	/* dirty inodes */
 	struct list_head	s_io;		/* parked for writeback */
include/linux/security.h +430 -0

457 lines not on this page · raw message

init/do_mounts.c +1 -0
diff -Nru a/init/do_mounts.c b/init/do_mounts.c
@@ -845,6 +845,7 @@
 	sys_umount("/dev", 0);
 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
 	sys_chroot(".");
+	security_ops->sb_post_mountroot();
 	mount_devfs_fs ();
 }
 
kernel/acct.c +5 -0
diff -Nru a/kernel/acct.c b/kernel/acct.c
@@ -195,6 +195,7 @@
 {
 	struct file *file = NULL;
 	char *tmp;
+	int error;
 
 	if (!capable(CAP_SYS_PACCT))
 		return -EPERM;
@@ -220,6 +221,10 @@
 			return (-EIO);
 		}
 	}
+
+	error = security_ops->acct(file);
+	if (error)
+		return error;
 
 	spin_lock(&acct_globals.lock);
 	acct_file_reopen(file);
mm/filemap.c +9 -0
diff -Nru a/mm/filemap.c b/mm/filemap.c
@@ -21,6 +21,7 @@
 #include <linux/iobuf.h>
 #include <linux/hash.h>
 #include <linux/writeback.h>
+#include <linux/security.h>
 /*
  * This is needed for the following functions:
  *  - try_to_release_page
@@ -1143,6 +1144,10 @@
 	if (retval)
 		goto fput_in;
 
+	retval = security_ops->file_permission (in_file, MAY_READ);
+	if (retval)
+		goto fput_in;
+
 	/*
 	 * Get output file, and verify that it is ok..
 	 */
@@ -1157,6 +1162,10 @@
 		goto fput_out;
 	out_inode = out_file->f_dentry->d_inode;
 	retval = locks_verify_area(FLOCK_VERIFY_WRITE, out_inode, out_file, out_file->f_pos, count);
+	if (retval)
+		goto fput_out;
+
+	retval = security_ops->file_permission (out_file, MAY_WRITE);
 	if (retval)
 		goto fput_out;
 
mm/mmap.c +5 -0
diff -Nru a/mm/mmap.c b/mm/mmap.c
@@ -14,6 +14,7 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/personality.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -475,6 +476,10 @@
 		}
 	}
 
+	error = security_ops->file_mmap(file, prot, flags);
+	if (error)
+		return error;
+		
 	/* Clear old maps */
 	error = -ENOMEM;
 munmap_back:
mm/mprotect.c +5 -0
diff -Nru a/mm/mprotect.c b/mm/mprotect.c
@@ -10,6 +10,7 @@
 #include <linux/mman.h>
 #include <linux/fs.h>
 #include <linux/highmem.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -305,6 +306,10 @@
 			error = -EACCES;
 			goto out;
 		}
+
+		error = security_ops->file_mprotect(vma, prot);
+		if (error)
+			goto out;
 
 		if (vma->vm_end > end) {
 			error = mprotect_fixup(vma, &prev, nstart, end, newflags);
net/core/scm.c +4 -0
diff -Nru a/net/core/scm.c b/net/core/scm.c
@@ -22,6 +22,7 @@
 #include <linux/net.h>
 #include <linux/interrupt.h>
 #include <linux/netdevice.h>
+#include <linux/security.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -216,6 +217,9 @@
 	for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
 	{
 		int new_fd;
+		err = security_ops->file_receive(fp[i]);
+		if (err)
+			break;
 		err = get_unused_fd();
 		if (err < 0)
 			break;
security/capability.c +362 -0

394 lines not on this page · raw message

security/dummy.c +366 -0

398 lines not on this page · raw message

author
#2 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683 -> 1.683.1.1
# security/dummy.c 1.1 -> 1.2
# security/capability.c 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.1
# [PATCH] LSM to designated initializers
#
# Over the last few days there has been discussion on the
# LKML list about converting struct initializers from the
# field: val,

# format into
#     .field =  val,
# 
# I have included a patch that will do this for both the
# dummy and capabilities files.
# --------------------------------------------
#
diff -Nru a/security/capability.c b/security/capability.c
--- a/security/capability.c	Mon Jul 22 17:26:07 2002
+++ b/security/capability.c	Mon Jul 22 17:26:07 2002
@@ -387,41 +387,41 @@
 }

static struct security_operations capability_ops = {
- ptrace: cap_ptrace,
- capget: cap_capget,
- capset_check: cap_capset_check,
- capset_set: cap_capset_set,
- capable: cap_capable,
- sys_security: cap_sys_security,
+ .ptrace = cap_ptrace,
+ .capget = cap_capget,
+ .capset_check = cap_capset_check,
+ .capset_set = cap_capset_set,
+ .capable = cap_capable,
+ .sys_security = cap_sys_security,

- bprm_alloc_security: cap_bprm_alloc_security,
- bprm_free_security: cap_bprm_free_security,
- bprm_compute_creds: cap_bprm_compute_creds,
- bprm_set_security: cap_bprm_set_security,
- bprm_check_security: cap_bprm_check_security,
+ .bprm_alloc_security = cap_bprm_alloc_security,
+ .bprm_free_security = cap_bprm_free_security,
+ .bprm_compute_creds = cap_bprm_compute_creds,
+ .bprm_set_security = cap_bprm_set_security,
+ .bprm_check_security = cap_bprm_check_security,

- task_create: cap_task_create,
- task_alloc_security: cap_task_alloc_security,
- task_free_security: cap_task_free_security,
- task_setuid: cap_task_setuid,
- task_post_setuid: cap_task_post_setuid,
- task_setgid: cap_task_setgid,
- task_setpgid: cap_task_setpgid,
- task_getpgid: cap_task_getpgid,
- task_getsid: cap_task_getsid,
- task_setgroups: cap_task_setgroups,
- task_setnice: cap_task_setnice,
- task_setrlimit: cap_task_setrlimit,
- task_setscheduler: cap_task_setscheduler,
- task_getscheduler: cap_task_getscheduler,
- task_wait: cap_task_wait,
- task_kill: cap_task_kill,
- task_prctl: cap_task_prctl,
- task_kmod_set_label: cap_task_kmod_set_label,
- task_reparent_to_init: cap_task_reparent_to_init,
+ .task_create = cap_task_create,
+ .task_alloc_security = cap_task_alloc_security,
+ .task_free_security = cap_task_free_security,
+ .task_setuid = cap_task_setuid,
+ .task_post_setuid = cap_task_post_setuid,
+ .task_setgid = cap_task_setgid,
+ .task_setpgid = cap_task_setpgid,
+ .task_getpgid = cap_task_getpgid,
+ .task_getsid = cap_task_getsid,
+ .task_setgroups = cap_task_setgroups,
+ .task_setnice = cap_task_setnice,
+ .task_setrlimit = cap_task_setrlimit,
+ .task_setscheduler = cap_task_setscheduler,
+ .task_getscheduler = cap_task_getscheduler,
+ .task_wait = cap_task_wait,
+ .task_kill = cap_task_kill,
+ .task_prctl = cap_task_prctl,
+ .task_kmod_set_label = cap_task_kmod_set_label,
+ .task_reparent_to_init = cap_task_reparent_to_init,

- register_security: cap_register,
- unregister_security: cap_unregister,
+ .register_security = cap_register,
+ .unregister_security = cap_unregister,
};

#if defined(CONFIG_SECURITY_CAPABILITIES_MODULE)

security/dummy.c +32 -32
diff -Nru a/security/dummy.c b/security/dummy.c
@@ -197,40 +197,40 @@
 }
 
 struct security_operations dummy_security_ops = {
-	ptrace:				dummy_ptrace,
-	capget:				dummy_capget,
-	capset_check:			dummy_capset_check,
-	capset_set:			dummy_capset_set,
-	capable:			dummy_capable,
-	sys_security:			dummy_sys_security,
+	.ptrace =			dummy_ptrace,
+	.capget =			dummy_capget,
+	.capset_check =			dummy_capset_check,
+	.capset_set =			dummy_capset_set,
+	.capable =			dummy_capable,
+	.sys_security =			dummy_sys_security,
 	
-	bprm_alloc_security:		dummy_bprm_alloc_security,
-	bprm_free_security:		dummy_bprm_free_security,
-	bprm_compute_creds:		dummy_bprm_compute_creds,
-	bprm_set_security:		dummy_bprm_set_security,
-	bprm_check_security:		dummy_bprm_check_security,
+	.bprm_alloc_security =		dummy_bprm_alloc_security,
+	.bprm_free_security =		dummy_bprm_free_security,
+	.bprm_compute_creds =		dummy_bprm_compute_creds,
+	.bprm_set_security =		dummy_bprm_set_security,
+	.bprm_check_security =		dummy_bprm_check_security,
 
-	task_create:			dummy_task_create,
-	task_alloc_security:		dummy_task_alloc_security,
-	task_free_security:		dummy_task_free_security,
-	task_setuid:			dummy_task_setuid,
-	task_post_setuid:		dummy_task_post_setuid,
-	task_setgid:			dummy_task_setgid,
-	task_setpgid:			dummy_task_setpgid,
-	task_getpgid:			dummy_task_getpgid,
-	task_getsid:			dummy_task_getsid,
-	task_setgroups:			dummy_task_setgroups,
-	task_setnice:			dummy_task_setnice,
-	task_setrlimit:			dummy_task_setrlimit,
-	task_setscheduler:		dummy_task_setscheduler,
-	task_getscheduler:		dummy_task_getscheduler,
-	task_wait:			dummy_task_wait,
-	task_kill:			dummy_task_kill,
-	task_prctl:			dummy_task_prctl,
-	task_kmod_set_label:		dummy_task_kmod_set_label,
-	task_reparent_to_init:		dummy_task_reparent_to_init,
+	.task_create =			dummy_task_create,
+	.task_alloc_security =		dummy_task_alloc_security,
+	.task_free_security =		dummy_task_free_security,
+	.task_setuid =			dummy_task_setuid,
+	.task_post_setuid =		dummy_task_post_setuid,
+	.task_setgid =			dummy_task_setgid,
+	.task_setpgid =			dummy_task_setpgid,
+	.task_getpgid =			dummy_task_getpgid,
+	.task_getsid =			dummy_task_getsid,
+	.task_setgroups =		dummy_task_setgroups,
+	.task_setnice =			dummy_task_setnice,
+	.task_setrlimit =		dummy_task_setrlimit,
+	.task_setscheduler =		dummy_task_setscheduler,
+	.task_getscheduler =		dummy_task_getscheduler,
+	.task_wait =			dummy_task_wait,
+	.task_kill =			dummy_task_kill,
+	.task_prctl =			dummy_task_prctl,
+	.task_kmod_set_label =		dummy_task_kmod_set_label,
+	.task_reparent_to_init =	dummy_task_reparent_to_init,
 	
-	register_security:		dummy_register,
-	unregister_security:		dummy_unregister,
+	.register_security =		dummy_register,
+	.unregister_security =		dummy_unregister,
 };
 
author
#3 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.1 -> 1.683.1.2

#	  arch/ppc/config.in	1.36    -> 1.37   
#	arch/sparc/config.in	1.15    -> 1.16   
#	arch/s390x/config.in	1.8     -> 1.9    
#	arch/mips64/config.in	1.13    -> 1.14   
#	arch/ppc64/config.in	1.9     -> 1.10   
#	  arch/arm/config.in	1.35    -> 1.36   
#	arch/alpha/config.in	1.22    -> 1.23   
#	arch/x86_64/config.in	1.10    -> 1.11   
#	 arch/s390/config.in	1.9     -> 1.10   
#	arch/sparc64/config.in	1.29    -> 1.30   
#	   arch/sh/config.in	1.11    -> 1.12   
#	 arch/cris/config.in	1.15    -> 1.16   
#	 arch/mips/config.in	1.13    -> 1.14   
#	 arch/m68k/config.in	1.14    -> 1.15   

# arch/parisc/config.in 1.8 -> 1.9
# arch/ia64/config.in 1.23 -> 1.24
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.2
# LSM: fixed up all of the other archs (non i386) to include the security config menu. # --------------------------------------------
#

arch/alpha/config.in +1 -0
diff -Nru a/arch/alpha/config.in b/arch/alpha/config.in
@@ -393,4 +393,5 @@
 
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/arm/config.in +1 -0
diff -Nru a/arch/arm/config.in b/arch/arm/config.in
@@ -658,4 +658,5 @@
 dep_bool '    Kernel low-level debugging messages via UART2' CONFIG_DEBUG_CLPS711X_UART2 $CONFIG_DEBUG_LL $CONFIG_ARCH_CLPS711X
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/cris/config.in +3 -1
diff -Nru a/arch/cris/config.in b/arch/cris/config.in
@@ -228,5 +228,7 @@
   int ' Profile shift count' CONFIG_PROFILE_SHIFT 2
 fi
 
-source lib/Config.in
 endmenu
+
+source security/Config.in
+source lib/Config.in
arch/ia64/config.in +2 -0
diff -Nru a/arch/ia64/config.in b/arch/ia64/config.in
@@ -263,3 +263,5 @@
 fi
 
 endmenu
+
+source security/Config.in
arch/m68k/config.in +1 -0
diff -Nru a/arch/m68k/config.in b/arch/m68k/config.in
@@ -549,4 +549,5 @@
 
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/mips/config.in +1 -0
diff -Nru a/arch/mips/config.in b/arch/mips/config.in
@@ -503,4 +503,5 @@
 fi
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/mips64/config.in +1 -0
diff -Nru a/arch/mips64/config.in b/arch/mips64/config.in
@@ -248,4 +248,5 @@
 fi
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/parisc/config.in +1 -0
diff -Nru a/arch/parisc/config.in b/arch/parisc/config.in
@@ -200,4 +200,5 @@
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/ppc/config.in +3 -0
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
@@ -628,3 +628,6 @@
    bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
 fi
 endmenu
+
+source security/Config.in
+
arch/ppc64/config.in +1 -0
diff -Nru a/arch/ppc64/config.in b/arch/ppc64/config.in
@@ -220,4 +220,5 @@
 fi
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/s390/config.in +1 -0
diff -Nru a/arch/s390/config.in b/arch/s390/config.in
@@ -75,4 +75,5 @@
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/s390x/config.in +1 -0
diff -Nru a/arch/s390x/config.in b/arch/s390x/config.in
@@ -78,4 +78,5 @@
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/sh/config.in +1 -0
diff -Nru a/arch/sh/config.in b/arch/sh/config.in
@@ -369,4 +369,5 @@
 fi
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/sparc/config.in +1 -0
diff -Nru a/arch/sparc/config.in b/arch/sparc/config.in
@@ -242,4 +242,5 @@
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/sparc64/config.in +1 -0
diff -Nru a/arch/sparc64/config.in b/arch/sparc64/config.in
@@ -293,4 +293,5 @@
 
 endmenu
 
+source security/Config.in
 source lib/Config.in
arch/x86_64/config.in +1 -0
diff -Nru a/arch/x86_64/config.in b/arch/x86_64/config.in
@@ -229,4 +229,5 @@
 fi
 endmenu
 
+source security/Config.in
 source lib/Config.in
author
#4 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.2 -> 1.683.1.3
# CREDITS 1.54 -> 1.55
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.3
# [PATCH] LSM: CREDITS entries
#
# Here are CREDITS entries for myself and my two colleagues who also

# contributed to LSM.
# --------------------------------------------
#
diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS	Mon Jul 22 17:26:01 2002
+++ b/CREDITS	Mon Jul 22 17:26:01 2002
@@ -2649,6 +2649,11 @@
 S: 8006 Zuerich
 S: Switzerland

+N: Wayne Salamon
+E: [email protected]
+E: [email protected]
+D: portions of the Linux Security Module (LSM) framework and security modules +
N: Robert Sanders
E: [email protected]
D: Dosemu
@@ -2775,6 +2780,11 @@
S: Minto, NSW, 2566
S: Australia

+N: Stephen Smalley
+E: [email protected]
+E: [email protected]
+D: portions of the Linux Security Module (LSM) framework and security modules +
N: Chris Smith
E: [email protected]
D: Read only HPFS filesystem
@@ -3040,6 +3050,11 @@
S: C. Huysmansstraat 12
S: B-3128 Baal
S: Belgium
+
+N: Chris Vance
+E: [email protected]
+E: [email protected]
+D: portions of the Linux Security Module (LSM) framework and security modules

N: Petr Vandrovec
E: [email protected]

author
#5 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.3 -> 1.683.1.4
# CREDITS 1.55 -> 1.56
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.4

# updated my CREDITS entry.
# --------------------------------------------
#
diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS	Mon Jul 22 17:25:59 2002
+++ b/CREDITS	Mon Jul 22 17:25:59 2002
@@ -1670,6 +1670,7 @@
 D: USB Bluetooth driver, USB Skeleton driver
 D: bits and pieces of USB core code.
 D: PCI Hotplug core, PCI Hotplug Compaq driver modifications
+D: portions of the Linux Security Module (LSM) framework

N: Russell Kroll
E: [email protected]

author
#6 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.4 -> 1.683.1.5
# arch/ia64/kernel/ptrace.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.5

# added ptrace hook for ia64
# --------------------------------------------
#
diff -Nru a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
--- a/arch/ia64/kernel/ptrace.c	Mon Jul 22 17:25:56 2002
+++ b/arch/ia64/kernel/ptrace.c	Mon Jul 22 17:25:56 2002
@@ -15,6 +15,7 @@
 #include <linux/ptrace.h>
 #include <linux/smp_lock.h>
 #include <linux/user.h>
+#include <linux/security.h>

#include <asm/pgtable.h>
#include <asm/processor.h>
@@ -1099,6 +1100,9 @@
if (request == PTRACE_TRACEME) {
/* are we already being traced? */ if (current->ptrace & PT_PTRACED)
+ goto out;
+ ret = security_ops->ptrace(current->parent, current);
+ if (ret)
goto out;
current->ptrace |= PT_PTRACED; ret = 0;

author
#7 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.5 -> 1.683.1.6
# CREDITS 1.56 -> 1.57
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.6
# [PATCH] LSM: CREDITS entry
#
# --------------------------------------------
#

CREDITS +8 -0
diff -Nru a/CREDITS b/CREDITS
@@ -3289,6 +3289,14 @@
 S: Cambridge. CB1 7EG
 S: England
 
+N: Chris Wright
+E: [email protected]
+D: hacking on LSM framework and security modules.
+S: c/o WireX
+S: 920 SW 3rd, Ste. 100
+S: Portland, OR 97204
+S: USA
+
 N: Frank Xia
 E: [email protected]
 D: Xiafs filesystem [defunct]
author
#8 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.683.1.7 -> 1.683.1.8
# security/dummy.c 1.3 -> 1.4
# security/capability.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.683.1.8
# LSM: convert initializers to C99 style.
# --------------------------------------------
#

security/capability.c +53 -53
diff -Nru a/security/capability.c b/security/capability.c
@@ -706,61 +706,61 @@
 	.bprm_set_security =		cap_bprm_set_security,
 	.bprm_check_security =		cap_bprm_check_security,
 
-	sb_alloc_security:		cap_sb_alloc_security,
-	sb_free_security:		cap_sb_free_security,
-	sb_statfs:			cap_sb_statfs,
-	sb_mount:			cap_mount,
-	sb_check_sb:			cap_check_sb,
-	sb_umount:			cap_umount,
-	sb_umount_close:		cap_umount_close,
-	sb_umount_busy:			cap_umount_busy,
-	sb_post_remount:		cap_post_remount,
-	sb_post_mountroot:		cap_post_mountroot,
-	sb_post_addmount:		cap_post_addmount,
-	sb_pivotroot:			cap_pivotroot,
-	sb_post_pivotroot:		cap_post_pivotroot,
+	.sb_alloc_security =		cap_sb_alloc_security,
+	.sb_free_security =		cap_sb_free_security,
+	.sb_statfs =			cap_sb_statfs,
+	.sb_mount =			cap_mount,
+	.sb_check_sb =			cap_check_sb,
+	.sb_umount =			cap_umount,
+	.sb_umount_close =		cap_umount_close,
+	.sb_umount_busy =		cap_umount_busy,
+	.sb_post_remount =		cap_post_remount,
+	.sb_post_mountroot =		cap_post_mountroot,
+	.sb_post_addmount =		cap_post_addmount,
+	.sb_pivotroot =			cap_pivotroot,
+	.sb_post_pivotroot =		cap_post_pivotroot,
 	
-	inode_alloc_security:		cap_inode_alloc_security,
-	inode_free_security:		cap_inode_free_security,
-	inode_create:			cap_inode_create,
-	inode_post_create:		cap_inode_post_create,
-	inode_link:			cap_inode_link,
-	inode_post_link:		cap_inode_post_link,
-	inode_unlink:			cap_inode_unlink,
-	inode_symlink:			cap_inode_symlink,
-	inode_post_symlink:		cap_inode_post_symlink,
-	inode_mkdir:			cap_inode_mkdir,
-	inode_post_mkdir:		cap_inode_post_mkdir,
-	inode_rmdir:			cap_inode_rmdir,
-	inode_mknod:			cap_inode_mknod,
-	inode_post_mknod:		cap_inode_post_mknod,
-	inode_rename:			cap_inode_rename,
-	inode_post_rename:		cap_inode_post_rename,
-	inode_readlink:			cap_inode_readlink,
-	inode_follow_link:		cap_inode_follow_link,
-	inode_permission:		cap_inode_permission,
-	inode_permission_lite:		cap_inode_permission_lite,
-	inode_setattr:			cap_inode_setattr,
-	inode_getattr:			cap_inode_getattr,
-	inode_post_lookup:		cap_post_lookup,
-	inode_delete:			cap_delete,
-	inode_setxattr:			cap_inode_setxattr,
-	inode_getxattr:			cap_inode_getxattr,
-	inode_listxattr:		cap_inode_listxattr,
-	inode_removexattr:		cap_inode_removexattr,
+	.inode_alloc_security =		cap_inode_alloc_security,
+	.inode_free_security =		cap_inode_free_security,
+	.inode_create =			cap_inode_create,
+	.inode_post_create =		cap_inode_post_create,
+	.inode_link =			cap_inode_link,
+	.inode_post_link =		cap_inode_post_link,
+	.inode_unlink =			cap_inode_unlink,
+	.inode_symlink =		cap_inode_symlink,
+	.inode_post_symlink =		cap_inode_post_symlink,
+	.inode_mkdir =			cap_inode_mkdir,
+	.inode_post_mkdir =		cap_inode_post_mkdir,
+	.inode_rmdir =			cap_inode_rmdir,
+	.inode_mknod =			cap_inode_mknod,
+	.inode_post_mknod =		cap_inode_post_mknod,
+	.inode_rename =			cap_inode_rename,
+	.inode_post_rename =		cap_inode_post_rename,
+	.inode_readlink =		cap_inode_readlink,
+	.inode_follow_link =		cap_inode_follow_link,
+	.inode_permission =		cap_inode_permission,
+	.inode_permission_lite =	cap_inode_permission_lite,
+	.inode_setattr =		cap_inode_setattr,
+	.inode_getattr =		cap_inode_getattr,
+	.inode_post_lookup =		cap_post_lookup,
+	.inode_delete =			cap_delete,
+	.inode_setxattr =		cap_inode_setxattr,
+	.inode_getxattr =		cap_inode_getxattr,
+	.inode_listxattr =		cap_inode_listxattr,
+	.inode_removexattr =		cap_inode_removexattr,
 	
-	file_permission:		cap_file_permission,
-	file_alloc_security:		cap_file_alloc_security,
-	file_free_security:		cap_file_free_security,
-	file_llseek:			cap_file_llseek,
-	file_ioctl:			cap_file_ioctl,
-	file_mmap:			cap_file_mmap,
-	file_mprotect:			cap_file_mprotect,
-	file_lock:			cap_file_lock,
-	file_fcntl:			cap_file_fcntl,
-	file_set_fowner:		cap_file_set_fowner,
-	file_send_sigiotask:		cap_file_send_sigiotask,
-	file_receive:			cap_file_receive,
+	.file_permission =		cap_file_permission,
+	.file_alloc_security =		cap_file_alloc_security,
+	.file_free_security =		cap_file_free_security,
+	.file_llseek =			cap_file_llseek,
+	.file_ioctl =			cap_file_ioctl,
+	.file_mmap =			cap_file_mmap,
+	.file_mprotect =		cap_file_mprotect,
+	.file_lock =			cap_file_lock,
+	.file_fcntl =			cap_file_fcntl,
+	.file_set_fowner =		cap_file_set_fowner,
+	.file_send_sigiotask =		cap_file_send_sigiotask,
+	.file_receive =			cap_file_receive,
 
 	.task_create =			cap_task_create,
 	.task_alloc_security =		cap_task_alloc_security,
security/dummy.c +55 -55

124 lines not on this page · raw message

author
#9 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.685 -> 1.686
# security/dummy.c 1.4 -> 1.5
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/22 [email protected] 1.686
# LSM: fixed typo that happened in merge
# --------------------------------------------
#

security/dummy.c +1 -1
diff -Nru a/security/dummy.c b/security/dummy.c
@@ -508,7 +508,7 @@
 	.capget =			dummy_capget,
 	.capset_check =			dummy_capset_check,
 	.capset_set =			dummy_capset_set,
-	.acct =				dummy_act,
+	.acct =				dummy_acct,
 	.capable =			dummy_capable,
 	.sys_security =			dummy_sys_security,
 	.quotactl =			dummy_quotactl,
#10 lore raw
In reply to Greg KH

Hi,

Review

Quoted 1 line · Greg KH
(quoted diff) +1 -0
+		error = security_ops->inode_setattr(dentry, attr);

Am I the only one who'd like to see this as an inline function?
1. It can be optimized away.
2. It's easier to read.

bye, Roman

#11 lore raw
Quoted 9 lines · Roman Zippel

Hi,

Review

Quoted 1 line · Greg KH
(quoted diff) +1 -0
+		error = security_ops->inode_setattr(dentry, attr);

Am I the only one who'd like to see this as an inline function?
1. It can be optimized away.
2. It's easier to read.

You are not the only one. At the kernel summit there were discussions about both wrapping the few performance impacting ones in ifdefs, and/or using dynamic patching.

author
#12 lore raw
Quoted 10 lines · Alan Cox
Quoted 9 lines · Roman Zippel

Hi,

Review

Quoted 1 line · Greg KH
(quoted diff) +1 -0
+		error = security_ops->inode_setattr(dentry, attr);

Am I the only one who'd like to see this as an inline function?
1. It can be optimized away.
2. It's easier to read.

Yes, I've considered it. I might still wrap them in a inline function if people _really_ don't like the look of them.

Quoted 3 lines

You are not the only one. At the kernel summit there were discussions about both wrapping the few performance impacting ones in ifdefs, and/or using dynamic patching.

Yes, for the hooks that might affect performance (like the network ones) they will probably be wrapped in inline functions, and controlled by a config option.

thanks,

greg k-h