File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,9 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
196196}
197197
198198extern u32 audit_enabled ;
199+
200+ extern int audit_signal_info (int sig , struct task_struct * t );
201+
199202#else /* CONFIG_AUDIT */
200203static inline __printf (4 , 5 )
201204void audit_log (struct audit_context * ctx , gfp_t gfp_mask , int type ,
@@ -249,6 +252,12 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
249252}
250253
251254#define audit_enabled AUDIT_OFF
255+
256+ static inline int audit_signal_info (int sig , struct task_struct * t )
257+ {
258+ return 0 ;
259+ }
260+
252261#endif /* CONFIG_AUDIT */
253262
254263#ifdef CONFIG_AUDIT_COMPAT_GENERIC
Original file line number Diff line number Diff line change @@ -2273,6 +2273,33 @@ int audit_set_loginuid(kuid_t loginuid)
22732273 return rc ;
22742274}
22752275
2276+ /**
2277+ * audit_signal_info - record signal info for shutting down audit subsystem
2278+ * @sig: signal value
2279+ * @t: task being signaled
2280+ *
2281+ * If the audit subsystem is being terminated, record the task (pid)
2282+ * and uid that is doing that.
2283+ */
2284+ int audit_signal_info (int sig , struct task_struct * t )
2285+ {
2286+ kuid_t uid = current_uid (), auid ;
2287+
2288+ if (auditd_test_task (t ) &&
2289+ (sig == SIGTERM || sig == SIGHUP ||
2290+ sig == SIGUSR1 || sig == SIGUSR2 )) {
2291+ audit_sig_pid = task_tgid_nr (current );
2292+ auid = audit_get_loginuid (current );
2293+ if (uid_valid (auid ))
2294+ audit_sig_uid = auid ;
2295+ else
2296+ audit_sig_uid = uid ;
2297+ security_task_getsecid (current , & audit_sig_sid );
2298+ }
2299+
2300+ return audit_signal_info_syscall (t );
2301+ }
2302+
22762303/**
22772304 * audit_log_end - end one audit record
22782305 * @ab: the audit_buffer
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ extern const char *audit_tree_path(struct audit_tree *tree);
299299extern void audit_put_tree (struct audit_tree * tree );
300300extern void audit_kill_trees (struct audit_context * context );
301301
302- extern int audit_signal_info ( int sig , struct task_struct * t );
302+ extern int audit_signal_info_syscall ( struct task_struct * t );
303303extern void audit_filter_inodes (struct task_struct * tsk ,
304304 struct audit_context * ctx );
305305extern struct list_head * audit_killed_trees (void );
@@ -330,7 +330,11 @@ extern struct list_head *audit_killed_trees(void);
330330#define audit_tree_path (rule ) "" /* never called */
331331#define audit_kill_trees (context ) BUG()
332332
333- #define audit_signal_info (s , t ) AUDIT_DISABLED
333+ static inline int audit_signal_info_syscall (struct task_struct * t )
334+ {
335+ return 0 ;
336+ }
337+
334338#define audit_filter_inodes (t , c ) AUDIT_DISABLED
335339#endif /* CONFIG_AUDITSYSCALL */
336340
Original file line number Diff line number Diff line change @@ -2360,30 +2360,17 @@ void __audit_ptrace(struct task_struct *t)
23602360}
23612361
23622362/**
2363- * audit_signal_info - record signal info for shutting down audit subsystem
2364- * @sig: signal value
2363+ * audit_signal_info_syscall - record signal info for syscalls
23652364 * @t: task being signaled
23662365 *
23672366 * If the audit subsystem is being terminated, record the task (pid)
23682367 * and uid that is doing that.
23692368 */
2370- int audit_signal_info ( int sig , struct task_struct * t )
2369+ int audit_signal_info_syscall ( struct task_struct * t )
23712370{
23722371 struct audit_aux_data_pids * axp ;
23732372 struct audit_context * ctx = audit_context ();
2374- kuid_t uid = current_uid (), auid , t_uid = task_uid (t );
2375-
2376- if (auditd_test_task (t ) &&
2377- (sig == SIGTERM || sig == SIGHUP ||
2378- sig == SIGUSR1 || sig == SIGUSR2 )) {
2379- audit_sig_pid = task_tgid_nr (current );
2380- auid = audit_get_loginuid (current );
2381- if (uid_valid (auid ))
2382- audit_sig_uid = auid ;
2383- else
2384- audit_sig_uid = uid ;
2385- security_task_getsecid (current , & audit_sig_sid );
2386- }
2373+ kuid_t t_uid = task_uid (t );
23872374
23882375 if (!audit_signals || audit_dummy_context ())
23892376 return 0 ;
Original file line number Diff line number Diff line change 4444#include <linux/posix-timers.h>
4545#include <linux/livepatch.h>
4646#include <linux/cgroup.h>
47+ #include <linux/audit.h>
4748
4849#define CREATE_TRACE_POINTS
4950#include <trace/events/signal.h>
5354#include <asm/unistd.h>
5455#include <asm/siginfo.h>
5556#include <asm/cacheflush.h>
56- #include "audit.h" /* audit_signal_info() */
5757
5858/*
5959 * SLAB caches for signal bits.
You can’t perform that action at this time.
0 commit comments