* [BK PATCH] LSM setup changes for 2.5.26
@ 2002-07-17 18:23 Greg KH
2002-07-17 18:23 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2002-07-17 18:23 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, linux-security-module
Hi,
These changesets contain some minor changes that are needed by the LSM
(lsm.immunix.org) patch, before we start to merge in the LSM patch
itself. They move some structures out of a .c file and put them into a
.h file so other portions of the kernel can reference them.
Please pull from: bk://lsm.bkbits.net/linus-2.5
These patches were created by Stephen Smalley <sds@tislabs.com> from the
main LSM tree.
If anyone has any questions about these changes, please let us know.
thanks,
greg k-h
include/linux/msg.h | 29 +++++++++++++++++++++++++++++
include/linux/shm.h | 13 +++++++++++++
ipc/msg.c | 34 ++++------------------------------
ipc/sem.c | 7 ++++---
ipc/shm.c | 21 +++++----------------
5 files changed, 55 insertions(+), 49 deletions(-)
------
ChangeSet@1.639.1.2, 2002-07-15 12:53:35-07:00, greg@kroah.com
LSM: move struct shmid_kernel out of ipc/shm.c to include/linux/shm.h
Also move where we set sma->sem_perm.mode and .key to before ipc_addid() gets called.
include/linux/shm.h | 13 +++++++++++++
ipc/sem.c | 7 ++++---
ipc/shm.c | 21 +++++----------------
3 files changed, 22 insertions(+), 19 deletions(-)
------
ChangeSet@1.639.1.1, 2002-07-15 12:51:26-07:00, greg@kroah.com
LSM: move the struct msg_msg and struct msg_queue definitions out of the msg.c file to the msg.h file
Also move where the msg->q_perm.mode and .key values get set to before
ipc_addid() gets called to make placing a hook there easier.
include/linux/msg.h | 29 +++++++++++++++++++++++++++++
ipc/msg.c | 34 ++++------------------------------
2 files changed, 33 insertions(+), 30 deletions(-)
------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BK PATCH] LSM setup changes for 2.5.26
2002-07-17 18:23 [BK PATCH] LSM setup changes for 2.5.26 Greg KH
@ 2002-07-17 18:23 ` Greg KH
2002-07-17 18:23 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2002-07-17 18:23 UTC (permalink / raw)
To: linux-kernel, linux-security-module
# 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.639 -> 1.639.1.1
# include/linux/msg.h 1.1 -> 1.2
# ipc/msg.c 1.4 -> 1.5
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/15 greg@kroah.com 1.639.1.1
# LSM: move the struct msg_msg and struct msg_queue definitions out of the msg.c file to the msg.h file
#
# Also move where the msg->q_perm.mode and .key values get set to before
# ipc_addid() gets called to make placing a hook there easier.
# --------------------------------------------
#
diff -Nru a/include/linux/msg.h b/include/linux/msg.h
--- a/include/linux/msg.h Wed Jul 17 11:08:16 2002
+++ b/include/linux/msg.h Wed Jul 17 11:08:16 2002
@@ -63,6 +63,35 @@
#ifdef __KERNEL__
+/* one msg_msg structure for each message */
+struct msg_msg {
+ struct list_head m_list;
+ long m_type;
+ int m_ts; /* message text size */
+ struct msg_msgseg* next;
+ /* the actual message follows immediately */
+};
+
+#define DATALEN_MSG (PAGE_SIZE-sizeof(struct msg_msg))
+#define DATALEN_SEG (PAGE_SIZE-sizeof(struct msg_msgseg))
+
+/* one msq_queue structure for each present queue on the system */
+struct msg_queue {
+ struct kern_ipc_perm q_perm;
+ time_t q_stime; /* last msgsnd time */
+ time_t q_rtime; /* last msgrcv time */
+ time_t q_ctime; /* last change time */
+ unsigned long q_cbytes; /* current number of bytes on queue */
+ unsigned long q_qnum; /* number of messages in queue */
+ unsigned long q_qbytes; /* max number of bytes on queue */
+ pid_t q_lspid; /* pid of last msgsnd */
+ pid_t q_lrpid; /* last receive pid */
+
+ struct list_head q_messages;
+ struct list_head q_receivers;
+ struct list_head q_senders;
+};
+
asmlinkage long sys_msgget (key_t key, int msgflg);
asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
diff -Nru a/ipc/msg.c b/ipc/msg.c
--- a/ipc/msg.c Wed Jul 17 11:08:16 2002
+++ b/ipc/msg.c Wed Jul 17 11:08:16 2002
@@ -52,34 +52,6 @@
struct msg_msgseg* next;
/* the next part of the message follows immediately */
};
-/* one msg_msg structure for each message */
-struct msg_msg {
- struct list_head m_list;
- long m_type;
- int m_ts; /* message text size */
- struct msg_msgseg* next;
- /* the actual message follows immediately */
-};
-
-#define DATALEN_MSG (PAGE_SIZE-sizeof(struct msg_msg))
-#define DATALEN_SEG (PAGE_SIZE-sizeof(struct msg_msgseg))
-
-/* one msq_queue structure for each present queue on the system */
-struct msg_queue {
- struct kern_ipc_perm q_perm;
- time_t q_stime; /* last msgsnd time */
- time_t q_rtime; /* last msgrcv time */
- time_t q_ctime; /* last change time */
- unsigned long q_cbytes; /* current number of bytes on queue */
- unsigned long q_qnum; /* number of messages in queue */
- unsigned long q_qbytes; /* max number of bytes on queue */
- pid_t q_lspid; /* pid of last msgsnd */
- pid_t q_lrpid; /* last receive pid */
-
- struct list_head q_messages;
- struct list_head q_receivers;
- struct list_head q_senders;
-};
#define SEARCH_ANY 1
#define SEARCH_EQUAL 2
@@ -122,13 +94,15 @@
msq = (struct msg_queue *) kmalloc (sizeof (*msq), GFP_KERNEL);
if (!msq)
return -ENOMEM;
+
+ msq->q_perm.mode = (msgflg & S_IRWXUGO);
+ msq->q_perm.key = key;
+
id = ipc_addid(&msg_ids, &msq->q_perm, msg_ctlmni);
if(id == -1) {
kfree(msq);
return -ENOSPC;
}
- msq->q_perm.mode = (msgflg & S_IRWXUGO);
- msq->q_perm.key = key;
msq->q_stime = msq->q_rtime = 0;
msq->q_ctime = CURRENT_TIME;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [BK PATCH] LSM setup changes for 2.5.26
2002-07-17 18:23 ` Greg KH
@ 2002-07-17 18:23 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2002-07-17 18:23 UTC (permalink / raw)
To: linux-kernel, linux-security-module
# 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.639.1.1 -> 1.639.1.2
# ipc/sem.c 1.9 -> 1.10
# ipc/shm.c 1.11 -> 1.12
# include/linux/shm.h 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/15 greg@kroah.com 1.639.1.2
# LSM: move struct shmid_kernel out of ipc/shm.c to include/linux/shm.h
#
# Also move where we set sma->sem_perm.mode and .key to before ipc_addid() gets called.
# --------------------------------------------
#
diff -Nru a/include/linux/shm.h b/include/linux/shm.h
--- a/include/linux/shm.h Wed Jul 17 11:08:09 2002
+++ b/include/linux/shm.h Wed Jul 17 11:08:09 2002
@@ -71,6 +71,19 @@
};
#ifdef __KERNEL__
+struct shmid_kernel /* private to the kernel */
+{
+ struct kern_ipc_perm shm_perm;
+ struct file * shm_file;
+ int id;
+ unsigned long shm_nattch;
+ unsigned long shm_segsz;
+ time_t shm_atim;
+ time_t shm_dtim;
+ time_t shm_ctim;
+ pid_t shm_cprid;
+ pid_t shm_lprid;
+};
/* shm_mode upper byte flags */
#define SHM_DEST 01000 /* segment will be destroyed on last detach */
diff -Nru a/ipc/sem.c b/ipc/sem.c
--- a/ipc/sem.c Wed Jul 17 11:08:09 2002
+++ b/ipc/sem.c Wed Jul 17 11:08:09 2002
@@ -129,15 +129,16 @@
return -ENOMEM;
}
memset (sma, 0, size);
+
+ sma->sem_perm.mode = (semflg & S_IRWXUGO);
+ sma->sem_perm.key = key;
+
id = ipc_addid(&sem_ids, &sma->sem_perm, sc_semmni);
if(id == -1) {
ipc_free(sma, size);
return -ENOSPC;
}
used_sems += nsems;
-
- sma->sem_perm.mode = (semflg & S_IRWXUGO);
- sma->sem_perm.key = key;
sma->sem_base = (struct sem *) &sma[1];
/* sma->sem_pending = NULL; */
diff -Nru a/ipc/shm.c b/ipc/shm.c
--- a/ipc/shm.c Wed Jul 17 11:08:09 2002
+++ b/ipc/shm.c Wed Jul 17 11:08:09 2002
@@ -28,20 +28,6 @@
#include "util.h"
-struct shmid_kernel /* private to the kernel */
-{
- struct kern_ipc_perm shm_perm;
- struct file * shm_file;
- int id;
- unsigned long shm_nattch;
- unsigned long shm_segsz;
- time_t shm_atim;
- time_t shm_dtim;
- time_t shm_ctim;
- pid_t shm_cprid;
- pid_t shm_lprid;
-};
-
#define shm_flags shm_perm.mode
static struct file_operations shm_file_operations;
@@ -193,6 +179,10 @@
shp = (struct shmid_kernel *) kmalloc (sizeof (*shp), GFP_USER);
if (!shp)
return -ENOMEM;
+
+ shp->shm_perm.key = key;
+ shp->shm_flags = (shmflg & S_IRWXUGO);
+
sprintf (name, "SYSV%08x", key);
file = shmem_file_setup(name, size);
error = PTR_ERR(file);
@@ -203,8 +193,7 @@
id = shm_addid(shp);
if(id == -1)
goto no_id;
- shp->shm_perm.key = key;
- shp->shm_flags = (shmflg & S_IRWXUGO);
+
shp->shm_cprid = current->pid;
shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-17 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-17 18:23 [BK PATCH] LSM setup changes for 2.5.26 Greg KH
2002-07-17 18:23 ` Greg KH
2002-07-17 18:23 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox