Skip to contentSkip to conversation

LSM changes for 2.5.56

PATCH In review Greg KH 1 participant 3 messages Jan 11, 2003 Security (LSM)

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 LSM changes for 2.5.56

This changset includes security hooks for the remaining System V IPC hooks. The patch has been posted for discussion a few weeks ago, and there were no objections to it being included.

Please pull from:

	bk://lsm.bkbits.net/linus-2.5

thanks,

greg k-h

 CREDITS                  |    3 
 include/linux/msg.h      |    1 
 include/linux/security.h |  244 +++++++++++++++++++++++++++++++++++++++++++++++
 ipc/msg.c                |   41 +++++++
 ipc/sem.c                |   32 +++++-
 ipc/shm.c                |   41 +++++++
 security/dummy.c         |   77 ++++++++++++++
 7 files changed, 429 insertions(+), 10 deletions(-)

-----

[email protected], 2003-01-10 12:33:40-08:00, [email protected]
[PATCH] CREDITS patch

The attached patch against 2.5.55 updates my CREDITS entry for my current email address.

 CREDITS |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

------

[email protected], 2003-01-10 12:30:59-08:00, [email protected]
[PATCH] 2.5.52-lsm-{dummy,ipc}.patch

This patch adds the remaining System V IPC hooks, including the inline documentation for them in security.h. This includes a restored sem_semop hook, as it does seem to be necessary to support fine-grained access.

All of these System V IPC hooks are used by SELinux. The SELinux System V IPC access controls were originally described in the technical report available from http://www.nsa.gov/selinux/slinux-abs.html, and the LSM-based implementation is described in the technical report available from http://www.nsa.gov/selinux/module-abs.html.

 include/linux/msg.h      |    1 
 include/linux/security.h |  244 +++++++++++++++++++++++++++++++++++++++++++++++
 ipc/msg.c                |   41 +++++++
 ipc/sem.c                |   32 +++++-
 ipc/shm.c                |   41 +++++++
 security/dummy.c         |   77 ++++++++++++++
 6 files changed, 428 insertions(+), 8 deletions(-)

------

author
#1 lore raw

ChangeSet 1.889.20.1, 2003/01/10 12:30:59-08:00, [email protected]

[PATCH] 2.5.52-lsm-{dummy,ipc}.patch

This patch adds the remaining System V IPC hooks, including the inline documentation for them in security.h. This includes a restored sem_semop hook, as it does seem to be necessary to support fine-grained access.

All of these System V IPC hooks are used by SELinux. The SELinux System V IPC access controls were originally described in the technical report available from http://www.nsa.gov/selinux/slinux-abs.html, and the LSM-based implementation is described in the technical report available from http://www.nsa.gov/selinux/module-abs.html.

include/linux/msg.h +1 -0
diff -Nru a/include/linux/msg.h b/include/linux/msg.h
@@ -69,6 +69,7 @@
 	long  m_type;          
 	int m_ts;           /* message text size */
 	struct msg_msgseg* next;
+	void *security;
 	/* the actual message follows immediately */
 };
 
include/linux/security.h +244 -0

330 lines not on this page · raw message

ipc/msg.c +37 -4

106 lines not on this page · raw message

ipc/sem.c +30 -2
diff -Nru a/ipc/sem.c b/ipc/sem.c
@@ -188,8 +188,12 @@
 			err = -EINVAL;
 		else if (ipcperms(&sma->sem_perm, semflg))
 			err = -EACCES;
-		else
-			err = sem_buildid(id, sma->sem_perm.seq);
+		else {
+			int semid = sem_buildid(id, sma->sem_perm.seq);
+			err = security_sem_associate(sma, semflg);
+			if (!err)
+				err = semid;
+		}
 		sem_unlock(sma);
 	}
 
@@ -466,6 +470,10 @@
 		struct seminfo seminfo;
 		int max_id;
 
+		err = security_sem_semctl(NULL, cmd);
+		if (err)
+			return err;
+		
 		memset(&seminfo,0,sizeof(seminfo));
 		seminfo.semmni = sc_semmni;
 		seminfo.semmns = sc_semmns;
@@ -506,6 +514,11 @@
 		err = -EACCES;
 		if (ipcperms (&sma->sem_perm, S_IRUGO))
 			goto out_unlock;
+
+		err = security_sem_semctl(sma, cmd);
+		if (err)
+			goto out_unlock;
+
 		id = sem_buildid(semid, sma->sem_perm.seq);
 
 		kernel_to_ipc64_perm(&sma->sem_perm, &tbuf.sem_perm);
@@ -549,6 +562,11 @@
 	if (ipcperms (&sma->sem_perm, (cmd==SETVAL||cmd==SETALL)?S_IWUGO:S_IRUGO))
 		goto out_unlock;
 
+	err = security_sem_semctl(sma, cmd);
+	if (err)
+		goto out_unlock;
+
+	err = -EACCES;
 	switch (cmd) {
 	case GETALL:
 	{
@@ -740,6 +758,10 @@
 		goto out_unlock;
 	}
 
+	err = security_sem_semctl(sma, cmd);
+	if (err)
+		goto out_unlock;
+
 	switch(cmd){
 	case IPC_RMID:
 		freeary(semid);
@@ -1035,6 +1057,12 @@
 	error = -EACCES;
 	if (ipcperms(&sma->sem_perm, alter ? S_IWUGO : S_IRUGO))
 		goto out_unlock_semundo_free;
+
+	error = security_sem_semop(sma, sops, nsops, alter);
+	if (error)
+		goto out_unlock_semundo_free;
+
+	error = -EACCES;		
 	if (undos) {
 		/* Make sure we have an undo structure
 		 * for this process and this semaphore set.
ipc/shm.c +39 -2

95 lines not on this page · raw message

security/dummy.c +77 -0

113 lines not on this page · raw message

author
#2 lore raw

ChangeSet 1.889.20.2, 2003/01/10 12:33:40-08:00, [email protected]

[PATCH] CREDITS patch

The attached patch against 2.5.55 updates my CREDITS entry for my current email address.

CREDITS +1 -2
diff -Nru a/CREDITS b/CREDITS
@@ -2884,8 +2884,7 @@
 S: Australia
 
 N: Stephen Smalley
-E: [email protected]
-E: [email protected]
+E: [email protected]
 D: portions of the Linux Security Module (LSM) framework and security modules
 
 N: Chris Smith