diff options
author | Dustin Kirkland <dustin.kirkland@us.ibm.com> | 2005-11-03 12:15:16 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-20 14:08:54 -0500 |
commit | 8c8570fb8feef2bc166bee75a85748b25cda22d9 (patch) | |
tree | ed783d405ea9d5f3d3ccc57fb56c7b7cb2cdfb82 /ipc | |
parent | c8edc80c8b8c397c53f4f659a05b9ea6208029bf (diff) |
[PATCH] Capture selinux subject/object context information.
This patch extends existing audit records with subject/object context
information. Audit records associated with filesystem inodes, ipc, and
tasks now contain SELinux label information in the field "subj" if the
item is performing the action, or in "obj" if the item is the receiver
of an action.
These labels are collected via hooks in SELinux and appended to the
appropriate record in the audit code.
This additional information is required for Common Criteria Labeled
Security Protection Profile (LSPP).
[AV: fixed kmalloc flags use]
[folded leak fixes]
[folded cleanup from akpm (kfree(NULL)]
[folded audit_inode_context() leak fix]
[folded akpm's fix for audit_ipc_perm() definition in case of !CONFIG_AUDIT]
Signed-off-by: Dustin Kirkland <dustin.kirkland@us.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/msg.c | 5 | ||||
-rw-r--r-- | ipc/sem.c | 5 | ||||
-rw-r--r-- | ipc/shm.c | 4 |
3 files changed, 7 insertions, 7 deletions
@@ -429,8 +429,6 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf) | |||
429 | return -EFAULT; | 429 | return -EFAULT; |
430 | if (copy_msqid_from_user (&setbuf, buf, version)) | 430 | if (copy_msqid_from_user (&setbuf, buf, version)) |
431 | return -EFAULT; | 431 | return -EFAULT; |
432 | if ((err = audit_ipc_perms(setbuf.qbytes, setbuf.uid, setbuf.gid, setbuf.mode))) | ||
433 | return err; | ||
434 | break; | 432 | break; |
435 | case IPC_RMID: | 433 | case IPC_RMID: |
436 | break; | 434 | break; |
@@ -461,6 +459,9 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf) | |||
461 | switch (cmd) { | 459 | switch (cmd) { |
462 | case IPC_SET: | 460 | case IPC_SET: |
463 | { | 461 | { |
462 | if ((err = audit_ipc_perms(setbuf.qbytes, setbuf.uid, setbuf.gid, setbuf.mode, ipcp))) | ||
463 | goto out_unlock_up; | ||
464 | |||
464 | err = -EPERM; | 465 | err = -EPERM; |
465 | if (setbuf.qbytes > msg_ctlmnb && !capable(CAP_SYS_RESOURCE)) | 466 | if (setbuf.qbytes > msg_ctlmnb && !capable(CAP_SYS_RESOURCE)) |
466 | goto out_unlock_up; | 467 | goto out_unlock_up; |
@@ -809,8 +809,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun | |||
809 | if(cmd == IPC_SET) { | 809 | if(cmd == IPC_SET) { |
810 | if(copy_semid_from_user (&setbuf, arg.buf, version)) | 810 | if(copy_semid_from_user (&setbuf, arg.buf, version)) |
811 | return -EFAULT; | 811 | return -EFAULT; |
812 | if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode))) | ||
813 | return err; | ||
814 | } | 812 | } |
815 | sma = sem_lock(semid); | 813 | sma = sem_lock(semid); |
816 | if(sma==NULL) | 814 | if(sma==NULL) |
@@ -821,7 +819,6 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun | |||
821 | goto out_unlock; | 819 | goto out_unlock; |
822 | } | 820 | } |
823 | ipcp = &sma->sem_perm; | 821 | ipcp = &sma->sem_perm; |
824 | |||
825 | if (current->euid != ipcp->cuid && | 822 | if (current->euid != ipcp->cuid && |
826 | current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { | 823 | current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) { |
827 | err=-EPERM; | 824 | err=-EPERM; |
@@ -838,6 +835,8 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun | |||
838 | err = 0; | 835 | err = 0; |
839 | break; | 836 | break; |
840 | case IPC_SET: | 837 | case IPC_SET: |
838 | if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode, ipcp))) | ||
839 | goto out_unlock; | ||
841 | ipcp->uid = setbuf.uid; | 840 | ipcp->uid = setbuf.uid; |
842 | ipcp->gid = setbuf.gid; | 841 | ipcp->gid = setbuf.gid; |
843 | ipcp->mode = (ipcp->mode & ~S_IRWXUGO) | 842 | ipcp->mode = (ipcp->mode & ~S_IRWXUGO) |
@@ -620,13 +620,13 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf) | |||
620 | err = -EFAULT; | 620 | err = -EFAULT; |
621 | goto out; | 621 | goto out; |
622 | } | 622 | } |
623 | if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode))) | ||
624 | return err; | ||
625 | down(&shm_ids.sem); | 623 | down(&shm_ids.sem); |
626 | shp = shm_lock(shmid); | 624 | shp = shm_lock(shmid); |
627 | err=-EINVAL; | 625 | err=-EINVAL; |
628 | if(shp==NULL) | 626 | if(shp==NULL) |
629 | goto out_up; | 627 | goto out_up; |
628 | if ((err = audit_ipc_perms(0, setbuf.uid, setbuf.gid, setbuf.mode, &(shp->shm_perm)))) | ||
629 | goto out_unlock_up; | ||
630 | err = shm_checkid(shp,shmid); | 630 | err = shm_checkid(shp,shmid); |
631 | if(err) | 631 | if(err) |
632 | goto out_unlock_up; | 632 | goto out_unlock_up; |