Skip to contentSkip to conversation

audit: Move audit_log_task declaration under CONFIG_AUDITSYSCALL

PATCH In review Jiri Olsa 2 participants 2 messages Nov 21, 2019

Subsystems (3)
lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 audit: Move audit_log_task declaration under CONFIG_AUDITSYSCALL

The 0-DAY found that audit_log_task is not declared under CONFIG_AUDITSYSCALL which causes compilation error when it is not defined:

kernel/bpf/syscall.o: In function `bpf_audit_prog.isra.30':

Quoted 1 line
Quoted 1 line

syscall.c:(.text+0x860): undefined reference to `audit_log_task'

Adding the audit_log_task declaration and stub within CONFIG_AUDITSYSCALL ifdef.

Fixes 91e6015b082b ("bpf: Emit audit messages upon successful prog load and unload")
---
 include/linux/audit.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
include/linux/audit.h +5 -3
index edd006f4597d..18925d924c73 100644
@@ -159,7 +159,6 @@ extern void		    audit_log_key(struct audit_buffer *ab,
 extern void		    audit_log_link_denied(const char *operation);
 extern void		    audit_log_lost(const char *message);
 
-extern void audit_log_task(struct audit_buffer *ab);
 extern int audit_log_task_context(struct audit_buffer *ab);
 extern void audit_log_task_info(struct audit_buffer *ab);
 
@@ -220,8 +219,6 @@ static inline void audit_log_key(struct audit_buffer *ab, char *key)
 { }
 static inline void audit_log_link_denied(const char *string)
 { }
-static inline void audit_log_task(struct audit_buffer *ab)
-{ }
 static inline int audit_log_task_context(struct audit_buffer *ab)
 {
 	return 0;
@@ -361,6 +358,8 @@ static inline void audit_ptrace(struct task_struct *t)
 		__audit_ptrace(t);
 }
 
+extern void audit_log_task(struct audit_buffer *ab);
+
 				/* Private API (for audit.c only) */
 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);
@@ -648,6 +647,9 @@ static inline void audit_ntp_log(const struct audit_ntp_data *ad)
 
 static inline void audit_ptrace(struct task_struct *t)
 { }
+
+static inline void audit_log_task(struct audit_buffer *ab)
+{ }
 #define audit_n_rules 0
 #define audit_signals 0
 #endif /* CONFIG_AUDITSYSCALL */
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jiri Olsa

The 0-DAY found that audit_log_task is not declared under CONFIG_AUDITSYSCALL which causes compilation error when it is not defined:

kernel/bpf/syscall.o: In function `bpf_audit_prog.isra.30':

Quoted 8 lines
Quoted 1 line
Quoted 1 line

syscall.c:(.text+0x860): undefined reference to `audit_log_task'

Adding the audit_log_task declaration and stub within CONFIG_AUDITSYSCALL ifdef.

Fixes 91e6015b082b ("bpf: Emit audit messages upon successful prog load and unload")