audit: fix event coverage of AUDIT_ANOM_LINK
PATCH RESEND 1/1 audit: fix event coverage of AUDIT_ANOM_LINK
The userspace audit tools didn't like the existing formatting of the AUDIT_ANOM_LINK event. It needed to be expanded to emit an AUDIT_PATH event as well, so this implements the change. The bulk of the patch is moving code out of auditsc.c into audit.c and audit.h for general use. It expands audit_log_name to include an optional "struct path" argument for the simple case of just needing to report a pathname. This also makes audit_log_task_info available when syscall auditing is not enabled, since it is needed in either case for process details.
---
v2:
- make task_info report non-optional (otherwise userspace can't correlate)
--- include/linux/audit.h | 16 ++- kernel/audit.c | 244 ++++++++++++++++++++++++++++++++-- kernel/audit.h | 159 ++++++++++++++++++++++ kernel/auditsc.c | 353 +------------------------------------------------ 4 files changed, 405 insertions(+), 367 deletions(-)
include/linux/audit.h +9 -7
@@ -185,8 +185,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk)return tsk->sessionid; } -extern void audit_log_task_context (struct audit_buffer *ab); -extern void audit_log_task_info (struct audit_buffer *ab,struct task_struct *tsk);extern void __audit_ipc_obj (struct kern_ipc_perm *ipcp);extern void __audit_ipc_set_perm (unsigned long qbytes,uid_t uid,gid_t gid,umode_t mode);extern int __audit_bprm (struct linux_binprm *bprm);
@@ -340,11 +338,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk) {return -1 ; } -static inline void audit_log_task_context (struct audit_buffer *ab) -{ } -static inline void audit_log_task_info (struct audit_buffer *ab, -struct task_struct *tsk) -{ }static inline void audit_ipc_obj (struct kern_ipc_perm *ipcp) { } static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
@@ -429,6 +422,10 @@ static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) { }#endif +extern void audit_log_task_context (struct audit_buffer *ab); +extern void audit_log_task_info (struct audit_buffer *ab, +struct task_struct *tsk); +extern int audit_update_lsm_rules (void );/* Private API (for audit.c only) */
@@ -476,6 +473,11 @@ static inline void audit_log_link_denied(const char *string, { }static inline void audit_log_secctx (struct audit_buffer *ab,u32 secid) { } +static inline void audit_log_task_context (struct audit_buffer *ab) +{ } +static inline void audit_log_task_info (struct audit_buffer *ab, +struct task_struct *tsk) +{ }#define audit_enabled 0#endif /* CONFIG_AUDIT */ static inline void audit_log_string (struct audit_buffer *ab,const char *buf)
kernel/audit.c +236 -8
267 lines not on this page · raw message
kernel/audit.h +159 -0
179 lines not on this page · raw message
kernel/auditsc.c +1 -352
401 lines not on this page · raw message
Signature · 6 lines
1.7.9.5 -- Kees Cook Chrome OS Security