]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/audit.h
audit: Add auditing to ipsec
[mirror_ubuntu-artful-kernel.git] / include / linux / audit.h
index b27d7debc5a1df971dd5778f4a9bfae3237d8376..0e07db6cc0d0eeefc1c58e2f4980016afe713d05 100644 (file)
@@ -75,7 +75,7 @@
 #define AUDIT_DAEMON_CONFIG     1203    /* Daemon config change */
 
 #define AUDIT_SYSCALL          1300    /* Syscall event */
-#define AUDIT_FS_WATCH         1301    /* Filesystem watch event */
+/* #define AUDIT_FS_WATCH      1301     * Deprecated */
 #define AUDIT_PATH             1302    /* Filename path information */
 #define AUDIT_IPC              1303    /* IPC record */
 #define AUDIT_SOCKETCALL       1304    /* sys_socketcall arguments */
@@ -88,6 +88,7 @@
 #define AUDIT_MQ_SENDRECV      1313    /* POSIX MQ send/receive record type */
 #define AUDIT_MQ_NOTIFY                1314    /* POSIX MQ notify record type */
 #define AUDIT_MQ_GETSETATTR    1315    /* POSIX MQ get/set attribute record type */
+#define AUDIT_KERNEL_OTHER     1316    /* For use by 3rd party modules */
 
 #define AUDIT_AVC              1400    /* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR      1401    /* Internal SE Linux Errors */
 #define AUDIT_MAC_POLICY_LOAD  1403    /* Policy file load */
 #define AUDIT_MAC_STATUS       1404    /* Changed enforcing,permissive,off */
 #define AUDIT_MAC_CONFIG_CHANGE        1405    /* Changes to booleans */
+#define AUDIT_MAC_UNLBL_ALLOW  1406    /* NetLabel: allow unlabeled traffic */
+#define AUDIT_MAC_CIPSOV4_ADD  1407    /* NetLabel: add CIPSOv4 DOI entry */
+#define AUDIT_MAC_CIPSOV4_DEL  1408    /* NetLabel: del CIPSOv4 DOI entry */
+#define AUDIT_MAC_MAP_ADD      1409    /* NetLabel: add LSM domain mapping */
+#define AUDIT_MAC_MAP_DEL      1410    /* NetLabel: del LSM domain mapping */
+#define AUDIT_MAC_IPSEC_ADDSA  1411    /* Add a XFRM state */
+#define AUDIT_MAC_IPSEC_DELSA  1412    /* Delete a XFRM state */
+#define AUDIT_MAC_IPSEC_ADDSPD 1413    /* Add a XFRM policy */
+#define AUDIT_MAC_IPSEC_DELSPD 1414    /* Delete a XFRM policy */
 
 #define AUDIT_FIRST_KERN_ANOM_MSG   1700
 #define AUDIT_LAST_KERN_ANOM_MSG    1799
 #define AUDIT_CLASS_DIR_WRITE_32 1
 #define AUDIT_CLASS_CHATTR 2
 #define AUDIT_CLASS_CHATTR_32 3
+#define AUDIT_CLASS_READ 4
+#define AUDIT_CLASS_READ_32 5
+#define AUDIT_CLASS_WRITE 6
+#define AUDIT_CLASS_WRITE_32 7
 
 /* This bitmask is used to validate user input.  It represents all bits that
  * are currently used in an audit field constant understood by the kernel.
 #define AUDIT_EXIT     103
 #define AUDIT_SUCCESS   104    /* exit >= 0; value ignored */
 #define AUDIT_WATCH    105
+#define AUDIT_PERM     106
 
 #define AUDIT_ARG0      200
 #define AUDIT_ARG1      (AUDIT_ARG0+1)
 #define AUDIT_ARCH_V850                (EM_V850|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_X86_64      (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 
+#define AUDIT_PERM_EXEC                1
+#define AUDIT_PERM_WRITE       2
+#define AUDIT_PERM_READ                4
+#define AUDIT_PERM_ATTR                8
+
 struct audit_status {
        __u32           mask;           /* Bit mask for valid entries */
        __u32           enabled;        /* 1 = enabled, 0 = disabled */
@@ -314,6 +334,7 @@ struct mqstat;
 #define AUDITSC_FAILURE 2
 #define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
 extern int __init audit_register_class(int class, unsigned *list);
+extern int audit_classify_syscall(int abi, unsigned syscall);
 #ifdef CONFIG_AUDITSYSCALL
 /* These are defined in auditsc.c */
                                /* Public API */
@@ -327,21 +348,31 @@ extern void __audit_getname(const char *name);
 extern void audit_putname(const char *name);
 extern void __audit_inode(const char *name, const struct inode *inode);
 extern void __audit_inode_child(const char *dname, const struct inode *inode,
-                               unsigned long pino);
+                               const struct inode *parent);
+extern void __audit_inode_update(const struct inode *inode);
+static inline int audit_dummy_context(void)
+{
+       void *p = current->audit_context;
+       return !p || *(int *)p;
+}
 static inline void audit_getname(const char *name)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                __audit_getname(name);
 }
 static inline void audit_inode(const char *name, const struct inode *inode) {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                __audit_inode(name, inode);
 }
 static inline void audit_inode_child(const char *dname, 
-                                    const struct inode *inode, 
-                                    unsigned long pino) {
-       if (unlikely(current->audit_context))
-               __audit_inode_child(dname, inode, pino);
+                                    const struct inode *inode,
+                                    const struct inode *parent) {
+       if (unlikely(!audit_dummy_context()))
+               __audit_inode_child(dname, inode, parent);
+}
+static inline void audit_inode_update(const struct inode *inode) {
+       if (unlikely(!audit_dummy_context()))
+               __audit_inode_update(inode);
 }
 
                                /* Private API (for audit.c only) */
@@ -350,6 +381,7 @@ extern void auditsc_get_stamp(struct audit_context *ctx,
                              struct timespec *t, unsigned int *serial);
 extern int  audit_set_loginuid(struct task_struct *task, uid_t loginuid);
 extern uid_t audit_get_loginuid(struct audit_context *ctx);
+extern void audit_log_task_context(struct audit_buffer *ab);
 extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
 extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
 extern int audit_bprm(struct linux_binprm *bprm);
@@ -365,59 +397,64 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
 
 static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_ipc_obj(ipcp);
        return 0;
 }
 static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_ipc_set_perm(qbytes, uid, gid, mode);
        return 0;
 }
 static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_open(oflag, mode, u_attr);
        return 0;
 }
 static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
        return 0;
 }
 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)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
        return 0;
 }
 static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_notify(mqdes, u_notification);
        return 0;
 }
 static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_getsetattr(mqdes, mqstat);
        return 0;
 }
+extern int audit_n_rules;
 #else
 #define audit_alloc(t) ({ 0; })
 #define audit_free(t) do { ; } while (0)
 #define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
 #define audit_syscall_exit(f,r) do { ; } while (0)
+#define audit_dummy_context() 1
 #define audit_getname(n) do { ; } while (0)
 #define audit_putname(n) do { ; } while (0)
 #define __audit_inode(n,i) do { ; } while (0)
 #define __audit_inode_child(d,i,p) do { ; } while (0)
+#define __audit_inode_update(i) do { ; } while (0)
 #define audit_inode(n,i) do { ; } while (0)
 #define audit_inode_child(d,i,p) do { ; } while (0)
+#define audit_inode_update(i) do { ; } while (0)
 #define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
 #define audit_get_loginuid(c) ({ -1; })
+#define audit_log_task_context(b) do { ; } while (0)
 #define audit_ipc_obj(i) ({ 0; })
 #define audit_ipc_set_perm(q,u,g,m) ({ 0; })
 #define audit_bprm(p) ({ 0; })
@@ -430,6 +467,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
 #define audit_mq_timedreceive(d,l,p,t) ({ 0; })
 #define audit_mq_notify(d,n) ({ 0; })
 #define audit_mq_getsetattr(d,s) ({ 0; })
+#define audit_n_rules 0
 #endif
 
 #ifdef CONFIG_AUDIT