diff options
author | George C. Wilson <ltcgcw@us.ibm.com> | 2006-05-24 17:09:55 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-06-20 05:25:26 -0400 |
commit | 20ca73bc792be9625af184cbec36e1372611d1c3 (patch) | |
tree | 98a1232ad3c9baa14676b2b48fab79a3df4a20b0 /include/linux | |
parent | 8ba8e0fbe6321961f6ba04e2fd7215b37d935c83 (diff) |
[PATCH] Audit of POSIX Message Queue Syscalls v.2
This patch adds audit support to POSIX message queues. It applies cleanly to
the lspp.b15 branch of Al Viro's git tree. There are new auxiliary data
structures, and collection and emission routines in kernel/auditsc.c. New hooks
in ipc/mqueue.c collect arguments from the syscalls.
I tested the patch by building the examples from the POSIX MQ library tarball.
Build them -lrt, not against the old MQ library in the tarball. Here's the URL:
http://www.geocities.com/wronski12/posix_ipc/libmqueue-4.41.tar.gz
Do auditctl -a exit,always -S for mq_open, mq_timedsend, mq_timedreceive,
mq_notify, mq_getsetattr. mq_unlink has no new hooks. Please see the
corresponding userspace patch to get correct output from auditd for the new
record types.
[fixes folded]
Signed-off-by: George Wilson <ltcgcw@us.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/audit.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 4b62743b2e6d..7c8780b150e6 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -85,6 +85,10 @@ | |||
85 | #define AUDIT_CWD 1307 /* Current working directory */ | 85 | #define AUDIT_CWD 1307 /* Current working directory */ |
86 | #define AUDIT_EXECVE 1309 /* execve arguments */ | 86 | #define AUDIT_EXECVE 1309 /* execve arguments */ |
87 | #define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ | 87 | #define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ |
88 | #define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */ | ||
89 | #define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ | ||
90 | #define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ | ||
91 | #define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ | ||
88 | 92 | ||
89 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | 93 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ |
90 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | 94 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ |
@@ -287,6 +291,8 @@ struct audit_context; | |||
287 | struct inode; | 291 | struct inode; |
288 | struct netlink_skb_parms; | 292 | struct netlink_skb_parms; |
289 | struct linux_binprm; | 293 | struct linux_binprm; |
294 | struct mq_attr; | ||
295 | struct mqstat; | ||
290 | 296 | ||
291 | #define AUDITSC_INVALID 0 | 297 | #define AUDITSC_INVALID 0 |
292 | #define AUDITSC_SUCCESS 1 | 298 | #define AUDITSC_SUCCESS 1 |
@@ -336,6 +342,11 @@ extern int audit_socketcall(int nargs, unsigned long *args); | |||
336 | extern int audit_sockaddr(int len, void *addr); | 342 | extern int audit_sockaddr(int len, void *addr); |
337 | extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); | 343 | extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); |
338 | extern int audit_set_macxattr(const char *name); | 344 | extern int audit_set_macxattr(const char *name); |
345 | extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); | ||
346 | extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); | ||
347 | extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); | ||
348 | extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); | ||
349 | extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); | ||
339 | 350 | ||
340 | static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) | 351 | static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) |
341 | { | 352 | { |
@@ -349,6 +360,36 @@ static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, | |||
349 | return __audit_ipc_set_perm(qbytes, uid, gid, mode); | 360 | return __audit_ipc_set_perm(qbytes, uid, gid, mode); |
350 | return 0; | 361 | return 0; |
351 | } | 362 | } |
363 | static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) | ||
364 | { | ||
365 | if (unlikely(current->audit_context)) | ||
366 | return __audit_mq_open(oflag, mode, u_attr); | ||
367 | return 0; | ||
368 | } | ||
369 | static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) | ||
370 | { | ||
371 | if (unlikely(current->audit_context)) | ||
372 | return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); | ||
373 | return 0; | ||
374 | } | ||
375 | static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) | ||
376 | { | ||
377 | if (unlikely(current->audit_context)) | ||
378 | return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); | ||
379 | return 0; | ||
380 | } | ||
381 | static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) | ||
382 | { | ||
383 | if (unlikely(current->audit_context)) | ||
384 | return __audit_mq_notify(mqdes, u_notification); | ||
385 | return 0; | ||
386 | } | ||
387 | static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) | ||
388 | { | ||
389 | if (unlikely(current->audit_context)) | ||
390 | return __audit_mq_getsetattr(mqdes, mqstat); | ||
391 | return 0; | ||
392 | } | ||
352 | #else | 393 | #else |
353 | #define audit_alloc(t) ({ 0; }) | 394 | #define audit_alloc(t) ({ 0; }) |
354 | #define audit_free(t) do { ; } while (0) | 395 | #define audit_free(t) do { ; } while (0) |
@@ -369,6 +410,11 @@ static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, | |||
369 | #define audit_sockaddr(len, addr) ({ 0; }) | 410 | #define audit_sockaddr(len, addr) ({ 0; }) |
370 | #define audit_avc_path(dentry, mnt) ({ 0; }) | 411 | #define audit_avc_path(dentry, mnt) ({ 0; }) |
371 | #define audit_set_macxattr(n) do { ; } while (0) | 412 | #define audit_set_macxattr(n) do { ; } while (0) |
413 | #define audit_mq_open(o,m,a) ({ 0; }) | ||
414 | #define audit_mq_timedsend(d,l,p,t) ({ 0; }) | ||
415 | #define audit_mq_timedreceive(d,l,p,t) ({ 0; }) | ||
416 | #define audit_mq_notify(d,n) ({ 0; }) | ||
417 | #define audit_mq_getsetattr(d,s) ({ 0; }) | ||
372 | #endif | 418 | #endif |
373 | 419 | ||
374 | #ifdef CONFIG_AUDIT | 420 | #ifdef CONFIG_AUDIT |