diff options
| author | Stephen D. Smalley <sds@tislabs.com> | 2002-10-08 00:10:38 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-10-08 00:10:38 -0700 |
| commit | f9274840e891fe6567548cf3eda1ad9d7eda87ed (patch) | |
| tree | 09e178ec97a6748bb6be6363334428dbe87c3a4d /include/linux | |
| parent | c4f59ba523fd5ff36982f13fb7efad82cec51718 (diff) | |
[PATCH] Base set of LSM hooks for SysV IPC
The patch below adds the base set of LSM hooks for System V IPC to the
2.5.41 kernel. These hooks permit a security module to label
semaphore sets, message queues, and shared memory segments and to
perform security checks on these objects that parallel the existing
IPC access checks. Additional LSM hooks for labeling and controlling
individual messages sent on a single message queue and for providing
fine-grained distinctions among IPC operations will be submitted
separately after this base set of LSM IPC hooks has been accepted.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ipc.h | 1 | ||||
| -rw-r--r-- | include/linux/security.h | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 4366dfad0ec1..b23c2b69a40d 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -63,6 +63,7 @@ struct kern_ipc_perm gid_t cgid; mode_t mode; unsigned long seq; + void *security; }; #endif /* __KERNEL__ */ diff --git a/include/linux/security.h b/include/linux/security.h index 34fd73a0fed2..072fbe94dd8b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -572,6 +572,50 @@ struct swap_info_struct; * is being reparented to the init task. * @p contains the task_struct for the kernel thread. * + * Security hooks affecting all System V IPC operations. + * + * @ipc_permission: + * Check permissions for access to IPC + * @ipcp contains the kernel IPC permission structure + * @flag contains the desired (requested) permission set + * Return 0 if permission is granted. + * + * Security hooks for System V IPC Message Queues + * + * @msg_queue_alloc_security: + * Allocate and attach a security structure to the + * msq->q_perm.security field. The security field is initialized to + * NULL when the structure is first created. + * @msq contains the message queue structure to be modified. + * Return 0 if operation was successful and permission is granted. + * @msg_queue_free_security: + * Deallocate security structure for this message queue. + * @msq contains the message queue structure to be modified. + * + * Security hooks for System V Shared Memory Segments + * + * @shm_alloc_security: + * Allocate and attach a security structure to the shp->shm_perm.security + * field. The security field is initialized to NULL when the structure is + * first created. + * @shp contains the shared memory structure to be modified. + * Return 0 if operation was successful and permission is granted. + * @shm_free_security: + * Deallocate the security struct for this memory segment. + * @shp contains the shared memory structure to be modified. + * + * Security hooks for System V Semaphores + * + * @sem_alloc_security: + * Allocate and attach a security structure to the sma->sem_perm.security + * field. The security field is initialized to NULL when the structure is + * first created. + * @sma contains the semaphore structure + * Return 0 if operation was successful and permission is granted. + * @sem_free_security: + * deallocate security struct for this semaphore + * @sma contains the semaphore structure. + * * @ptrace: * Check permission before allowing the @parent process to trace the * @child process. @@ -786,6 +830,17 @@ struct security_operations { void (*task_kmod_set_label) (void); void (*task_reparent_to_init) (struct task_struct * p); + int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); + + int (*msg_queue_alloc_security) (struct msg_queue * msq); + void (*msg_queue_free_security) (struct msg_queue * msq); + + int (*shm_alloc_security) (struct shmid_kernel * shp); + void (*shm_free_security) (struct shmid_kernel * shp); + + int (*sem_alloc_security) (struct sem_array * sma); + void (*sem_free_security) (struct sem_array * sma); + /* allow module stacking */ int (*register_security) (const char *name, struct security_operations *ops); |
