@@ -1509,8 +1509,7 @@ void __audit_free(struct task_struct *tsk)
15091509void __audit_syscall_entry (int major , unsigned long a1 , unsigned long a2 ,
15101510 unsigned long a3 , unsigned long a4 )
15111511{
1512- struct task_struct * tsk = current ;
1513- struct audit_context * context = tsk -> audit_context ;
1512+ struct audit_context * context = audit_context ();
15141513 enum audit_state state ;
15151514
15161515 if (!audit_enabled || !context )
@@ -1525,7 +1524,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2,
15251524 context -> dummy = !audit_n_rules ;
15261525 if (!context -> dummy && state == AUDIT_BUILD_CONTEXT ) {
15271526 context -> prio = 0 ;
1528- if (auditd_test_task (tsk ))
1527+ if (auditd_test_task (current ))
15291528 return ;
15301529 }
15311530
@@ -1563,12 +1562,12 @@ void __audit_syscall_exit(int success, long return_code)
15631562 else
15641563 success = AUDITSC_FAILURE ;
15651564
1566- context = audit_take_context (tsk , success , return_code );
1565+ context = audit_take_context (current , success , return_code );
15671566 if (!context )
15681567 return ;
15691568
15701569 if (context -> in_syscall && context -> current_state == AUDIT_RECORD_CONTEXT )
1571- audit_log_exit (context , tsk );
1570+ audit_log_exit (context , current );
15721571
15731572 context -> in_syscall = 0 ;
15741573 context -> prio = context -> state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0 ;
@@ -1602,7 +1601,7 @@ static inline void handle_one(const struct inode *inode)
16021601 int count ;
16031602 if (likely (!inode -> i_fsnotify_marks ))
16041603 return ;
1605- context = current -> audit_context ;
1604+ context = audit_context () ;
16061605 p = context -> trees ;
16071606 count = context -> tree_count ;
16081607 rcu_read_lock ();
@@ -1633,7 +1632,7 @@ static void handle_path(const struct dentry *dentry)
16331632 unsigned long seq ;
16341633 int count ;
16351634
1636- context = current -> audit_context ;
1635+ context = audit_context () ;
16371636 p = context -> trees ;
16381637 count = context -> tree_count ;
16391638retry :
@@ -1715,7 +1714,7 @@ static struct audit_names *audit_alloc_name(struct audit_context *context,
17151714struct filename *
17161715__audit_reusename (const __user char * uptr )
17171716{
1718- struct audit_context * context = current -> audit_context ;
1717+ struct audit_context * context = audit_context () ;
17191718 struct audit_names * n ;
17201719
17211720 list_for_each_entry (n , & context -> names_list , list ) {
@@ -1738,7 +1737,7 @@ __audit_reusename(const __user char *uptr)
17381737 */
17391738void __audit_getname (struct filename * name )
17401739{
1741- struct audit_context * context = current -> audit_context ;
1740+ struct audit_context * context = audit_context () ;
17421741 struct audit_names * n ;
17431742
17441743 if (!context -> in_syscall )
@@ -1766,7 +1765,7 @@ void __audit_getname(struct filename *name)
17661765void __audit_inode (struct filename * name , const struct dentry * dentry ,
17671766 unsigned int flags )
17681767{
1769- struct audit_context * context = current -> audit_context ;
1768+ struct audit_context * context = audit_context () ;
17701769 struct inode * inode = d_backing_inode (dentry );
17711770 struct audit_names * n ;
17721771 bool parent = flags & AUDIT_INODE_PARENT ;
@@ -1865,7 +1864,7 @@ void __audit_inode_child(struct inode *parent,
18651864 const struct dentry * dentry ,
18661865 const unsigned char type )
18671866{
1868- struct audit_context * context = current -> audit_context ;
1867+ struct audit_context * context = audit_context () ;
18691868 struct inode * inode = d_backing_inode (dentry );
18701869 const char * dname = dentry -> d_name .name ;
18711870 struct audit_names * n , * found_parent = NULL , * found_child = NULL ;
@@ -2084,7 +2083,7 @@ int audit_set_loginuid(kuid_t loginuid)
20842083 */
20852084void __audit_mq_open (int oflag , umode_t mode , struct mq_attr * attr )
20862085{
2087- struct audit_context * context = current -> audit_context ;
2086+ struct audit_context * context = audit_context () ;
20882087
20892088 if (attr )
20902089 memcpy (& context -> mq_open .attr , attr , sizeof (struct mq_attr ));
@@ -2108,7 +2107,7 @@ void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
21082107void __audit_mq_sendrecv (mqd_t mqdes , size_t msg_len , unsigned int msg_prio ,
21092108 const struct timespec64 * abs_timeout )
21102109{
2111- struct audit_context * context = current -> audit_context ;
2110+ struct audit_context * context = audit_context () ;
21122111 struct timespec64 * p = & context -> mq_sendrecv .abs_timeout ;
21132112
21142113 if (abs_timeout )
@@ -2132,7 +2131,7 @@ void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio,
21322131
21332132void __audit_mq_notify (mqd_t mqdes , const struct sigevent * notification )
21342133{
2135- struct audit_context * context = current -> audit_context ;
2134+ struct audit_context * context = audit_context () ;
21362135
21372136 if (notification )
21382137 context -> mq_notify .sigev_signo = notification -> sigev_signo ;
@@ -2151,7 +2150,7 @@ void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
21512150 */
21522151void __audit_mq_getsetattr (mqd_t mqdes , struct mq_attr * mqstat )
21532152{
2154- struct audit_context * context = current -> audit_context ;
2153+ struct audit_context * context = audit_context () ;
21552154 context -> mq_getsetattr .mqdes = mqdes ;
21562155 context -> mq_getsetattr .mqstat = * mqstat ;
21572156 context -> type = AUDIT_MQ_GETSETATTR ;
@@ -2164,7 +2163,7 @@ void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
21642163 */
21652164void __audit_ipc_obj (struct kern_ipc_perm * ipcp )
21662165{
2167- struct audit_context * context = current -> audit_context ;
2166+ struct audit_context * context = audit_context () ;
21682167 context -> ipc .uid = ipcp -> uid ;
21692168 context -> ipc .gid = ipcp -> gid ;
21702169 context -> ipc .mode = ipcp -> mode ;
@@ -2184,7 +2183,7 @@ void __audit_ipc_obj(struct kern_ipc_perm *ipcp)
21842183 */
21852184void __audit_ipc_set_perm (unsigned long qbytes , uid_t uid , gid_t gid , umode_t mode )
21862185{
2187- struct audit_context * context = current -> audit_context ;
2186+ struct audit_context * context = audit_context () ;
21882187
21892188 context -> ipc .qbytes = qbytes ;
21902189 context -> ipc .perm_uid = uid ;
@@ -2195,7 +2194,7 @@ void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mo
21952194
21962195void __audit_bprm (struct linux_binprm * bprm )
21972196{
2198- struct audit_context * context = current -> audit_context ;
2197+ struct audit_context * context = audit_context () ;
21992198
22002199 context -> type = AUDIT_EXECVE ;
22012200 context -> execve .argc = bprm -> argc ;
@@ -2210,7 +2209,7 @@ void __audit_bprm(struct linux_binprm *bprm)
22102209 */
22112210int __audit_socketcall (int nargs , unsigned long * args )
22122211{
2213- struct audit_context * context = current -> audit_context ;
2212+ struct audit_context * context = audit_context () ;
22142213
22152214 if (nargs <= 0 || nargs > AUDITSC_ARGS || !args )
22162215 return - EINVAL ;
@@ -2228,7 +2227,7 @@ int __audit_socketcall(int nargs, unsigned long *args)
22282227 */
22292228void __audit_fd_pair (int fd1 , int fd2 )
22302229{
2231- struct audit_context * context = current -> audit_context ;
2230+ struct audit_context * context = audit_context () ;
22322231 context -> fds [0 ] = fd1 ;
22332232 context -> fds [1 ] = fd2 ;
22342233}
@@ -2242,7 +2241,7 @@ void __audit_fd_pair(int fd1, int fd2)
22422241 */
22432242int __audit_sockaddr (int len , void * a )
22442243{
2245- struct audit_context * context = current -> audit_context ;
2244+ struct audit_context * context = audit_context () ;
22462245
22472246 if (!context -> sockaddr ) {
22482247 void * p = kmalloc (sizeof (struct sockaddr_storage ), GFP_KERNEL );
@@ -2258,7 +2257,7 @@ int __audit_sockaddr(int len, void *a)
22582257
22592258void __audit_ptrace (struct task_struct * t )
22602259{
2261- struct audit_context * context = current -> audit_context ;
2260+ struct audit_context * context = audit_context () ;
22622261
22632262 context -> target_pid = task_tgid_nr (t );
22642263 context -> target_auid = audit_get_loginuid (t );
@@ -2279,19 +2278,18 @@ void __audit_ptrace(struct task_struct *t)
22792278int audit_signal_info (int sig , struct task_struct * t )
22802279{
22812280 struct audit_aux_data_pids * axp ;
2282- struct task_struct * tsk = current ;
2283- struct audit_context * ctx = tsk -> audit_context ;
2281+ struct audit_context * ctx = audit_context ();
22842282 kuid_t uid = current_uid (), t_uid = task_uid (t );
22852283
22862284 if (auditd_test_task (t ) &&
22872285 (sig == SIGTERM || sig == SIGHUP ||
22882286 sig == SIGUSR1 || sig == SIGUSR2 )) {
2289- audit_sig_pid = task_tgid_nr (tsk );
2290- if (uid_valid (tsk -> loginuid ))
2291- audit_sig_uid = tsk -> loginuid ;
2287+ audit_sig_pid = task_tgid_nr (current );
2288+ if (uid_valid (current -> loginuid ))
2289+ audit_sig_uid = current -> loginuid ;
22922290 else
22932291 audit_sig_uid = uid ;
2294- security_task_getsecid (tsk , & audit_sig_sid );
2292+ security_task_getsecid (current , & audit_sig_sid );
22952293 }
22962294
22972295 if (!audit_signals || audit_dummy_context ())
@@ -2347,7 +2345,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
23472345 const struct cred * new , const struct cred * old )
23482346{
23492347 struct audit_aux_data_bprm_fcaps * ax ;
2350- struct audit_context * context = current -> audit_context ;
2348+ struct audit_context * context = audit_context () ;
23512349 struct cpu_vfs_cap_data vcaps ;
23522350
23532351 ax = kmalloc (sizeof (* ax ), GFP_KERNEL );
@@ -2387,7 +2385,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
23872385 */
23882386void __audit_log_capset (const struct cred * new , const struct cred * old )
23892387{
2390- struct audit_context * context = current -> audit_context ;
2388+ struct audit_context * context = audit_context () ;
23912389 context -> capset .pid = task_tgid_nr (current );
23922390 context -> capset .cap .effective = new -> cap_effective ;
23932391 context -> capset .cap .inheritable = new -> cap_effective ;
@@ -2398,15 +2396,15 @@ void __audit_log_capset(const struct cred *new, const struct cred *old)
23982396
23992397void __audit_mmap_fd (int fd , int flags )
24002398{
2401- struct audit_context * context = current -> audit_context ;
2399+ struct audit_context * context = audit_context () ;
24022400 context -> mmap .fd = fd ;
24032401 context -> mmap .flags = flags ;
24042402 context -> type = AUDIT_MMAP ;
24052403}
24062404
24072405void __audit_log_kern_module (char * name )
24082406{
2409- struct audit_context * context = current -> audit_context ;
2407+ struct audit_context * context = audit_context () ;
24102408
24112409 context -> module .name = kmalloc (strlen (name ) + 1 , GFP_KERNEL );
24122410 strcpy (context -> module .name , name );
@@ -2415,7 +2413,7 @@ void __audit_log_kern_module(char *name)
24152413
24162414void __audit_fanotify (unsigned int response )
24172415{
2418- audit_log (current -> audit_context , GFP_KERNEL ,
2416+ audit_log (audit_context () , GFP_KERNEL ,
24192417 AUDIT_FANOTIFY , "resp=%u" , response );
24202418}
24212419
@@ -2514,7 +2512,7 @@ void audit_seccomp_actions_logged(const char *names, const char *old_names,
25142512
25152513struct list_head * audit_killed_trees (void )
25162514{
2517- struct audit_context * ctx = current -> audit_context ;
2515+ struct audit_context * ctx = audit_context () ;
25182516 if (likely (!ctx || !ctx -> in_syscall ))
25192517 return NULL ;
25202518 return & ctx -> killed_trees ;
0 commit comments