diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-ppc/seccomp.h | 10 | ||||
| -rw-r--r-- | include/asm-ppc/thread_info.h | 7 | ||||
| -rw-r--r-- | include/linux/audit.h | 94 |
3 files changed, 87 insertions, 24 deletions
diff --git a/include/asm-ppc/seccomp.h b/include/asm-ppc/seccomp.h new file mode 100644 index 000000000000..666c4da96d87 --- /dev/null +++ b/include/asm-ppc/seccomp.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef _ASM_SECCOMP_H | ||
| 2 | |||
| 3 | #include <linux/unistd.h> | ||
| 4 | |||
| 5 | #define __NR_seccomp_read __NR_read | ||
| 6 | #define __NR_seccomp_write __NR_write | ||
| 7 | #define __NR_seccomp_exit __NR_exit | ||
| 8 | #define __NR_seccomp_sigreturn __NR_rt_sigreturn | ||
| 9 | |||
| 10 | #endif /* _ASM_SECCOMP_H */ | ||
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h index f7f01524e8a8..e3b5284a6f91 100644 --- a/include/asm-ppc/thread_info.h +++ b/include/asm-ppc/thread_info.h | |||
| @@ -77,12 +77,19 @@ static inline struct thread_info *current_thread_info(void) | |||
| 77 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | 77 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling |
| 78 | TIF_NEED_RESCHED */ | 78 | TIF_NEED_RESCHED */ |
| 79 | #define TIF_MEMDIE 5 | 79 | #define TIF_MEMDIE 5 |
| 80 | #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ | ||
| 81 | #define TIF_SECCOMP 7 /* secure computing */ | ||
| 82 | |||
| 80 | /* as above, but as bit values */ | 83 | /* as above, but as bit values */ |
| 81 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 84 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
| 82 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 85 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
| 83 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 86 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
| 84 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 87 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
| 85 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 88 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
| 89 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | ||
| 90 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | ||
| 91 | |||
| 92 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | ||
| 86 | 93 | ||
| 87 | /* | 94 | /* |
| 88 | * Non racy (local) flags bit numbers | 95 | * Non racy (local) flags bit numbers |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 19f04b049798..bf2ad3ba72eb 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -27,15 +27,52 @@ | |||
| 27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
| 28 | #include <linux/elf.h> | 28 | #include <linux/elf.h> |
| 29 | 29 | ||
| 30 | /* Request and reply types */ | 30 | /* The netlink messages for the audit system is divided into blocks: |
| 31 | #define AUDIT_GET 1000 /* Get status */ | 31 | * 1000 - 1099 are for commanding the audit system |
| 32 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | 32 | * 1100 - 1199 user space trusted application messages |
| 33 | #define AUDIT_LIST 1002 /* List filtering rules */ | 33 | * 1200 - 1299 messages internal to the audit daemon |
| 34 | #define AUDIT_ADD 1003 /* Add filtering rule */ | 34 | * 1300 - 1399 audit event messages |
| 35 | #define AUDIT_DEL 1004 /* Delete filtering rule */ | 35 | * 1400 - 1499 SE Linux use |
| 36 | #define AUDIT_USER 1005 /* Send a message from user-space */ | 36 | * 1500 - 1999 future use |
| 37 | #define AUDIT_LOGIN 1006 /* Define the login id and informaiton */ | 37 | * 2000 is for otherwise unclassified kernel audit messages |
| 38 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | 38 | * |
| 39 | * Messages from 1000-1199 are bi-directional. 1200-1299 are exclusively user | ||
| 40 | * space. Anything over that is kernel --> user space communication. | ||
| 41 | */ | ||
| 42 | #define AUDIT_GET 1000 /* Get status */ | ||
| 43 | #define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | ||
| 44 | #define AUDIT_LIST 1002 /* List syscall filtering rules */ | ||
| 45 | #define AUDIT_ADD 1003 /* Add syscall filtering rule */ | ||
| 46 | #define AUDIT_DEL 1004 /* Delete syscall filtering rule */ | ||
| 47 | #define AUDIT_USER 1005 /* Message from userspace -- deprecated */ | ||
| 48 | #define AUDIT_LOGIN 1006 /* Define the login id and information */ | ||
| 49 | #define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ | ||
| 50 | #define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ | ||
| 51 | #define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ | ||
| 52 | #define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ | ||
| 53 | |||
| 54 | #define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages uninteresting to kernel */ | ||
| 55 | #define AUDIT_LAST_USER_MSG 1199 | ||
| 56 | |||
| 57 | #define AUDIT_DAEMON_START 1200 /* Daemon startup record */ | ||
| 58 | #define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ | ||
| 59 | #define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ | ||
| 60 | #define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ | ||
| 61 | |||
| 62 | #define AUDIT_SYSCALL 1300 /* Syscall event */ | ||
| 63 | #define AUDIT_FS_WATCH 1301 /* Filesystem watch event */ | ||
| 64 | #define AUDIT_PATH 1302 /* Filename path information */ | ||
| 65 | #define AUDIT_IPC 1303 /* IPC record */ | ||
| 66 | #define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ | ||
| 67 | #define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ | ||
| 68 | #define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ | ||
| 69 | #define AUDIT_CWD 1307 /* Current working directory */ | ||
| 70 | |||
| 71 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | ||
| 72 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | ||
| 73 | #define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ | ||
| 74 | |||
| 75 | #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | ||
| 39 | 76 | ||
| 40 | /* Rule flags */ | 77 | /* Rule flags */ |
| 41 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ | 78 | #define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ |
| @@ -132,16 +169,9 @@ | |||
| 132 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) | 169 | #define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE) |
| 133 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | 170 | #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
| 134 | 171 | ||
| 135 | #ifndef __KERNEL__ | ||
| 136 | struct audit_message { | ||
| 137 | struct nlmsghdr nlh; | ||
| 138 | char data[1200]; | ||
| 139 | }; | ||
| 140 | #endif | ||
| 141 | |||
| 142 | struct audit_status { | 172 | struct audit_status { |
| 143 | __u32 mask; /* Bit mask for valid entries */ | 173 | __u32 mask; /* Bit mask for valid entries */ |
| 144 | __u32 enabled; /* 1 = enabled, 0 = disbaled */ | 174 | __u32 enabled; /* 1 = enabled, 0 = disabled */ |
| 145 | __u32 failure; /* Failure-to-log action */ | 175 | __u32 failure; /* Failure-to-log action */ |
| 146 | __u32 pid; /* pid of auditd process */ | 176 | __u32 pid; /* pid of auditd process */ |
| 147 | __u32 rate_limit; /* messages rate limit (per second) */ | 177 | __u32 rate_limit; /* messages rate limit (per second) */ |
| @@ -161,6 +191,11 @@ struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ | |||
| 161 | 191 | ||
| 162 | #ifdef __KERNEL__ | 192 | #ifdef __KERNEL__ |
| 163 | 193 | ||
| 194 | struct audit_sig_info { | ||
| 195 | uid_t uid; | ||
| 196 | pid_t pid; | ||
| 197 | }; | ||
| 198 | |||
| 164 | struct audit_buffer; | 199 | struct audit_buffer; |
| 165 | struct audit_context; | 200 | struct audit_context; |
| 166 | struct inode; | 201 | struct inode; |
| @@ -185,11 +220,16 @@ extern void audit_inode(const char *name, const struct inode *inode); | |||
| 185 | /* Private API (for audit.c only) */ | 220 | /* Private API (for audit.c only) */ |
| 186 | extern int audit_receive_filter(int type, int pid, int uid, int seq, | 221 | extern int audit_receive_filter(int type, int pid, int uid, int seq, |
| 187 | void *data, uid_t loginuid); | 222 | void *data, uid_t loginuid); |
| 188 | extern void audit_get_stamp(struct audit_context *ctx, | 223 | extern unsigned int audit_serial(void); |
| 189 | struct timespec *t, unsigned int *serial); | 224 | extern void auditsc_get_stamp(struct audit_context *ctx, |
| 225 | struct timespec *t, unsigned int *serial); | ||
| 190 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); | 226 | extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); |
| 191 | extern uid_t audit_get_loginuid(struct audit_context *ctx); | 227 | extern uid_t audit_get_loginuid(struct audit_context *ctx); |
| 192 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); | 228 | extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); |
| 229 | extern int audit_socketcall(int nargs, unsigned long *args); | ||
| 230 | extern int audit_sockaddr(int len, void *addr); | ||
| 231 | extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); | ||
| 232 | extern void audit_signal_info(int sig, struct task_struct *t); | ||
| 193 | #else | 233 | #else |
| 194 | #define audit_alloc(t) ({ 0; }) | 234 | #define audit_alloc(t) ({ 0; }) |
| 195 | #define audit_free(t) do { ; } while (0) | 235 | #define audit_free(t) do { ; } while (0) |
| @@ -198,18 +238,24 @@ extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mo | |||
| 198 | #define audit_getname(n) do { ; } while (0) | 238 | #define audit_getname(n) do { ; } while (0) |
| 199 | #define audit_putname(n) do { ; } while (0) | 239 | #define audit_putname(n) do { ; } while (0) |
| 200 | #define audit_inode(n,i) do { ; } while (0) | 240 | #define audit_inode(n,i) do { ; } while (0) |
| 241 | #define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; }) | ||
| 242 | #define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) | ||
| 201 | #define audit_get_loginuid(c) ({ -1; }) | 243 | #define audit_get_loginuid(c) ({ -1; }) |
| 202 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) | 244 | #define audit_ipc_perms(q,u,g,m) ({ 0; }) |
| 245 | #define audit_socketcall(n,a) ({ 0; }) | ||
| 246 | #define audit_sockaddr(len, addr) ({ 0; }) | ||
| 247 | #define audit_avc_path(dentry, mnt) ({ 0; }) | ||
| 248 | #define audit_signal_info(s,t) do { ; } while (0) | ||
| 203 | #endif | 249 | #endif |
| 204 | 250 | ||
| 205 | #ifdef CONFIG_AUDIT | 251 | #ifdef CONFIG_AUDIT |
| 206 | /* These are defined in audit.c */ | 252 | /* These are defined in audit.c */ |
| 207 | /* Public API */ | 253 | /* Public API */ |
| 208 | extern void audit_log(struct audit_context *ctx, | 254 | extern void audit_log(struct audit_context *ctx, int type, |
| 209 | const char *fmt, ...) | 255 | const char *fmt, ...) |
| 210 | __attribute__((format(printf,2,3))); | 256 | __attribute__((format(printf,3,4))); |
| 211 | 257 | ||
| 212 | extern struct audit_buffer *audit_log_start(struct audit_context *ctx); | 258 | extern struct audit_buffer *audit_log_start(struct audit_context *ctx,int type); |
| 213 | extern void audit_log_format(struct audit_buffer *ab, | 259 | extern void audit_log_format(struct audit_buffer *ab, |
| 214 | const char *fmt, ...) | 260 | const char *fmt, ...) |
| 215 | __attribute__((format(printf,2,3))); | 261 | __attribute__((format(printf,2,3))); |
| @@ -229,8 +275,8 @@ extern void audit_send_reply(int pid, int seq, int type, | |||
| 229 | void *payload, int size); | 275 | void *payload, int size); |
| 230 | extern void audit_log_lost(const char *message); | 276 | extern void audit_log_lost(const char *message); |
| 231 | #else | 277 | #else |
| 232 | #define audit_log(t,f,...) do { ; } while (0) | 278 | #define audit_log(c,t,f,...) do { ; } while (0) |
| 233 | #define audit_log_start(t) ({ NULL; }) | 279 | #define audit_log_start(c,t) ({ NULL; }) |
| 234 | #define audit_log_vformat(b,f,a) do { ; } while (0) | 280 | #define audit_log_vformat(b,f,a) do { ; } while (0) |
| 235 | #define audit_log_format(b,f,...) do { ; } while (0) | 281 | #define audit_log_format(b,f,...) do { ; } while (0) |
| 236 | #define audit_log_end(b) do { ; } while (0) | 282 | #define audit_log_end(b) do { ; } while (0) |
