diff options
Diffstat (limited to 'include/linux/audit.h')
-rw-r--r-- | include/linux/audit.h | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 5a6d718adf34..b20b03852f21 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -84,8 +84,13 @@ extern int audit_classify_arch(int arch); | |||
84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ | 84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | 85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ |
86 | 86 | ||
87 | /* maximized args number that audit_socketcall can process */ | ||
88 | #define AUDITSC_ARGS 6 | ||
89 | |||
87 | struct filename; | 90 | struct filename; |
88 | 91 | ||
92 | extern void audit_log_session_info(struct audit_buffer *ab); | ||
93 | |||
89 | #ifdef CONFIG_AUDITSYSCALL | 94 | #ifdef CONFIG_AUDITSYSCALL |
90 | /* These are defined in auditsc.c */ | 95 | /* These are defined in auditsc.c */ |
91 | /* Public API */ | 96 | /* Public API */ |
@@ -120,7 +125,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0, | |||
120 | unsigned long a1, unsigned long a2, | 125 | unsigned long a1, unsigned long a2, |
121 | unsigned long a3) | 126 | unsigned long a3) |
122 | { | 127 | { |
123 | if (unlikely(!audit_dummy_context())) | 128 | if (unlikely(current->audit_context)) |
124 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); | 129 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); |
125 | } | 130 | } |
126 | static inline void audit_syscall_exit(void *pt_regs) | 131 | static inline void audit_syscall_exit(void *pt_regs) |
@@ -185,12 +190,10 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
185 | return tsk->sessionid; | 190 | return tsk->sessionid; |
186 | } | 191 | } |
187 | 192 | ||
188 | extern void audit_log_task_context(struct audit_buffer *ab); | ||
189 | extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk); | ||
190 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 193 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
191 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 194 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
192 | extern int __audit_bprm(struct linux_binprm *bprm); | 195 | extern int __audit_bprm(struct linux_binprm *bprm); |
193 | extern void __audit_socketcall(int nargs, unsigned long *args); | 196 | extern int __audit_socketcall(int nargs, unsigned long *args); |
194 | extern int __audit_sockaddr(int len, void *addr); | 197 | extern int __audit_sockaddr(int len, void *addr); |
195 | extern void __audit_fd_pair(int fd1, int fd2); | 198 | extern void __audit_fd_pair(int fd1, int fd2); |
196 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); | 199 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
@@ -224,10 +227,11 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
224 | return __audit_bprm(bprm); | 227 | return __audit_bprm(bprm); |
225 | return 0; | 228 | return 0; |
226 | } | 229 | } |
227 | static inline void audit_socketcall(int nargs, unsigned long *args) | 230 | static inline int audit_socketcall(int nargs, unsigned long *args) |
228 | { | 231 | { |
229 | if (unlikely(!audit_dummy_context())) | 232 | if (unlikely(!audit_dummy_context())) |
230 | __audit_socketcall(nargs, args); | 233 | return __audit_socketcall(nargs, args); |
234 | return 0; | ||
231 | } | 235 | } |
232 | static inline int audit_sockaddr(int len, void *addr) | 236 | static inline int audit_sockaddr(int len, void *addr) |
233 | { | 237 | { |
@@ -340,11 +344,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
340 | { | 344 | { |
341 | return -1; | 345 | return -1; |
342 | } | 346 | } |
343 | static inline void audit_log_task_context(struct audit_buffer *ab) | ||
344 | { } | ||
345 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
346 | struct task_struct *tsk) | ||
347 | { } | ||
348 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) | 347 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
349 | { } | 348 | { } |
350 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, | 349 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, |
@@ -354,8 +353,10 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
354 | { | 353 | { |
355 | return 0; | 354 | return 0; |
356 | } | 355 | } |
357 | static inline void audit_socketcall(int nargs, unsigned long *args) | 356 | static inline int audit_socketcall(int nargs, unsigned long *args) |
358 | { } | 357 | { |
358 | return 0; | ||
359 | } | ||
359 | static inline void audit_fd_pair(int fd1, int fd2) | 360 | static inline void audit_fd_pair(int fd1, int fd2) |
360 | { } | 361 | { } |
361 | static inline int audit_sockaddr(int len, void *addr) | 362 | static inline int audit_sockaddr(int len, void *addr) |
@@ -390,6 +391,11 @@ static inline void audit_ptrace(struct task_struct *t) | |||
390 | #define audit_signals 0 | 391 | #define audit_signals 0 |
391 | #endif /* CONFIG_AUDITSYSCALL */ | 392 | #endif /* CONFIG_AUDITSYSCALL */ |
392 | 393 | ||
394 | static inline bool audit_loginuid_set(struct task_struct *tsk) | ||
395 | { | ||
396 | return uid_valid(audit_get_loginuid(tsk)); | ||
397 | } | ||
398 | |||
393 | #ifdef CONFIG_AUDIT | 399 | #ifdef CONFIG_AUDIT |
394 | /* These are defined in audit.c */ | 400 | /* These are defined in audit.c */ |
395 | /* Public API */ | 401 | /* Public API */ |
@@ -429,14 +435,17 @@ static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | |||
429 | { } | 435 | { } |
430 | #endif | 436 | #endif |
431 | 437 | ||
438 | extern int audit_log_task_context(struct audit_buffer *ab); | ||
439 | extern void audit_log_task_info(struct audit_buffer *ab, | ||
440 | struct task_struct *tsk); | ||
441 | |||
432 | extern int audit_update_lsm_rules(void); | 442 | extern int audit_update_lsm_rules(void); |
433 | 443 | ||
434 | /* Private API (for audit.c only) */ | 444 | /* Private API (for audit.c only) */ |
435 | extern int audit_filter_user(void); | 445 | extern int audit_filter_user(int type); |
436 | extern int audit_filter_type(int type); | 446 | extern int audit_filter_type(int type); |
437 | extern int audit_receive_filter(int type, int pid, int seq, | 447 | extern int audit_receive_filter(int type, int pid, int seq, |
438 | void *data, size_t datasz, kuid_t loginuid, | 448 | void *data, size_t datasz); |
439 | u32 sessionid, u32 sid); | ||
440 | extern int audit_enabled; | 449 | extern int audit_enabled; |
441 | #else /* CONFIG_AUDIT */ | 450 | #else /* CONFIG_AUDIT */ |
442 | static inline __printf(4, 5) | 451 | static inline __printf(4, 5) |
@@ -476,6 +485,13 @@ static inline void audit_log_link_denied(const char *string, | |||
476 | { } | 485 | { } |
477 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | 486 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) |
478 | { } | 487 | { } |
488 | static inline int audit_log_task_context(struct audit_buffer *ab) | ||
489 | { | ||
490 | return 0; | ||
491 | } | ||
492 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
493 | struct task_struct *tsk) | ||
494 | { } | ||
479 | #define audit_enabled 0 | 495 | #define audit_enabled 0 |
480 | #endif /* CONFIG_AUDIT */ | 496 | #endif /* CONFIG_AUDIT */ |
481 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) | 497 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) |