mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
[PATCH] Rework of IPC auditing
1) The audit_ipc_perms() function has been split into two different
functions:
- audit_ipc_obj()
- audit_ipc_set_perm()
There's a key shift here... The audit_ipc_obj() collects the uid, gid,
mode, and SElinux context label of the current ipc object. This
audit_ipc_obj() hook is now found in several places. Most notably, it
is hooked in ipcperms(), which is called in various places around the
ipc code permforming a MAC check. Additionally there are several places
where *checkid() is used to validate that an operation is being
performed on a valid object while not necessarily having a nearby
ipcperms() call. In these locations, audit_ipc_obj() is called to
ensure that the information is captured by the audit system.
The audit_set_new_perm() function is called any time the permissions on
the ipc object changes. In this case, the NEW permissions are recorded
(and note that an audit_ipc_obj() call exists just a few lines before
each instance).
2) Support for an AUDIT_IPC_SET_PERM audit message type. This allows
for separate auxiliary audit records for normal operations on an IPC
object and permissions changes. Note that the same struct
audit_aux_data_ipcctl is used and populated, however there are separate
audit_log_format statements based on the type of the message. Finally,
the AUDIT_IPC block of code in audit_free_aux() was extended to handle
aux messages of this new type. No more mem leaks I hope ;-)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
+6
-1
@@ -10,6 +10,8 @@
|
||||
* Manfred Spraul <manfred@colorfullife.com>
|
||||
* Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary().
|
||||
* Mingming Cao <cmm@us.ibm.com>
|
||||
* Mar 2006 - support for audit of ipc object properties
|
||||
* Dustin Kirkland <dustin.kirkland@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
@@ -27,6 +29,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/audit.h>
|
||||
|
||||
#include <asm/unistd.h>
|
||||
|
||||
@@ -464,8 +467,10 @@ void ipc_rcu_putref(void *ptr)
|
||||
|
||||
int ipcperms (struct kern_ipc_perm *ipcp, short flag)
|
||||
{ /* flag will most probably be 0 or S_...UGO from <linux/stat.h> */
|
||||
int requested_mode, granted_mode;
|
||||
int requested_mode, granted_mode, err;
|
||||
|
||||
if (unlikely((err = audit_ipc_obj(ipcp))))
|
||||
return err;
|
||||
requested_mode = (flag >> 6) | (flag >> 3) | flag;
|
||||
granted_mode = ipcp->mode;
|
||||
if (current->euid == ipcp->cuid || current->euid == ipcp->uid)
|
||||
|
||||
Reference in New Issue
Block a user