Merge tag 'soundwire-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
[linux-2.6-block.git] / include / linux / audit.h
CommitLineData
1a59d1b8 1/* SPDX-License-Identifier: GPL-2.0-or-later */
85c8721f 2/* audit.h -- Auditing support
1da177e4
LT
3 *
4 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
5 * All Rights Reserved.
6 *
1da177e4 7 * Written by Rickard E. (Rik) Faith <faith@redhat.com>
1da177e4 8 */
1da177e4
LT
9#ifndef _LINUX_AUDIT_H_
10#define _LINUX_AUDIT_H_
11
f001e47f 12#include <linux/sched.h>
c0a3a20b 13#include <linux/ptrace.h>
42f355ef 14#include <linux/audit_arch.h>
607ca46e 15#include <uapi/linux/audit.h>
8e6cf365 16#include <uapi/linux/netfilter/nf_tables.h>
032bffd4 17#include <uapi/linux/fanotify.h>
1da177e4 18
84cb777e
RGB
19#define AUDIT_INO_UNSET ((unsigned long)-1)
20#define AUDIT_DEV_UNSET ((dev_t)-1)
21
c2f0c7c3
SG
22struct audit_sig_info {
23 uid_t uid;
24 pid_t pid;
0090c1ed 25 char ctx[];
c2f0c7c3
SG
26};
27
1da177e4
LT
28struct audit_buffer;
29struct audit_context;
30struct inode;
5bb289b5 31struct netlink_skb_parms;
37721e1b 32struct path;
473ae30b 33struct linux_binprm;
20ca73bc
GW
34struct mq_attr;
35struct mqstat;
9d57a7f9
AD
36struct audit_watch;
37struct audit_tree;
099dd235 38struct sk_buff;
e034d49e 39struct kern_ipc_perm;
9d57a7f9
AD
40
41struct audit_krule {
041d7b98 42 u32 pflags;
9d57a7f9
AD
43 u32 flags;
44 u32 listnr;
45 u32 action;
46 u32 mask[AUDIT_BITMASK_SIZE];
47 u32 buflen; /* for data alloc on list rules */
48 u32 field_count;
49 char *filterkey; /* ties events to rules */
50 struct audit_field *fields;
51 struct audit_field *arch_f; /* quick access to arch field */
52 struct audit_field *inode_f; /* quick access to an inode field */
53 struct audit_watch *watch; /* associated watch */
54 struct audit_tree *tree; /* associated watched tree */
34d99af5 55 struct audit_fsnotify_mark *exe;
9d57a7f9 56 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
e45aa212 57 struct list_head list; /* for AUDIT_LIST* purposes only */
0590b933 58 u64 prio;
9d57a7f9
AD
59};
60
041d7b98
RGB
61/* Flag to indicate legacy AUDIT_LOGINUID unset usage */
62#define AUDIT_LOGINUID_LEGACY 0x1
63
9d57a7f9
AD
64struct audit_field {
65 u32 type;
219ca394
RGB
66 union {
67 u32 val;
68 kuid_t uid;
69 kgid_t gid;
70 struct {
71 char *lsm_str;
72 void *lsm_rule;
73 };
74 };
9d57a7f9 75 u32 op;
9d57a7f9 76};
1da177e4 77
7e8eda73
OM
78enum audit_ntp_type {
79 AUDIT_NTP_OFFSET,
80 AUDIT_NTP_FREQ,
81 AUDIT_NTP_STATUS,
82 AUDIT_NTP_TAI,
83 AUDIT_NTP_TICK,
84 AUDIT_NTP_ADJUST,
85
86 AUDIT_NTP_NVALS /* count */
87};
88
89#ifdef CONFIG_AUDITSYSCALL
90struct audit_ntp_val {
91 long long oldval, newval;
92};
93
94struct audit_ntp_data {
95 struct audit_ntp_val vals[AUDIT_NTP_NVALS];
96};
97#else
98struct audit_ntp_data {};
99#endif
100
c4dad0aa
RGB
101enum audit_nfcfgop {
102 AUDIT_XT_OP_REGISTER,
103 AUDIT_XT_OP_REPLACE,
a45d8853 104 AUDIT_XT_OP_UNREGISTER,
8e6cf365
RGB
105 AUDIT_NFT_OP_TABLE_REGISTER,
106 AUDIT_NFT_OP_TABLE_UNREGISTER,
107 AUDIT_NFT_OP_CHAIN_REGISTER,
108 AUDIT_NFT_OP_CHAIN_UNREGISTER,
109 AUDIT_NFT_OP_RULE_REGISTER,
110 AUDIT_NFT_OP_RULE_UNREGISTER,
111 AUDIT_NFT_OP_SET_REGISTER,
112 AUDIT_NFT_OP_SET_UNREGISTER,
113 AUDIT_NFT_OP_SETELEM_REGISTER,
114 AUDIT_NFT_OP_SETELEM_UNREGISTER,
115 AUDIT_NFT_OP_GEN_REGISTER,
116 AUDIT_NFT_OP_OBJ_REGISTER,
117 AUDIT_NFT_OP_OBJ_UNREGISTER,
118 AUDIT_NFT_OP_OBJ_RESET,
119 AUDIT_NFT_OP_FLOWTABLE_REGISTER,
120 AUDIT_NFT_OP_FLOWTABLE_UNREGISTER,
7e9be112 121 AUDIT_NFT_OP_SETELEM_RESET,
ea078ae9 122 AUDIT_NFT_OP_RULE_RESET,
8e6cf365 123 AUDIT_NFT_OP_INVALID,
c4dad0aa
RGB
124};
125
b915543b 126extern int __init audit_register_class(int class, unsigned *list);
55669bfa 127extern int audit_classify_syscall(int abi, unsigned syscall);
e54dc243 128extern int audit_classify_arch(int arch);
4b588411
AT
129/* only for compat system calls */
130extern unsigned compat_write_class[];
131extern unsigned compat_read_class[];
132extern unsigned compat_dir_class[];
133extern unsigned compat_chattr_class[];
134extern unsigned compat_signal_class[];
135
78e2e802
JL
136/* audit_names->type values */
137#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
138#define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */
bfcec708 139#define AUDIT_TYPE_PARENT 2 /* a parent audit record */
4fa6b5ec
JL
140#define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */
141#define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */
78e2e802 142
2950fa9d
CG
143/* maximized args number that audit_socketcall can process */
144#define AUDITSC_ARGS 6
145
2e28d38a
PH
146/* bit values for ->signal->audit_tty */
147#define AUDIT_TTY_ENABLE BIT(0)
148#define AUDIT_TTY_LOG_PASSWD BIT(1)
149
91a27b2a
JL
150struct filename;
151
f7859590
RGB
152#define AUDIT_OFF 0
153#define AUDIT_ON 1
154#define AUDIT_LOCKED 2
96368701
PM
155#ifdef CONFIG_AUDIT
156/* These are defined in audit.c */
157 /* Public API */
158extern __printf(4, 5)
159void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
160 const char *fmt, ...);
161
162extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type);
163extern __printf(2, 3)
164void audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
165extern void audit_log_end(struct audit_buffer *ab);
166extern bool audit_string_contains_control(const char *string,
167 size_t len);
168extern void audit_log_n_hex(struct audit_buffer *ab,
169 const unsigned char *buf,
170 size_t len);
171extern void audit_log_n_string(struct audit_buffer *ab,
172 const char *buf,
173 size_t n);
174extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
175 const char *string,
176 size_t n);
177extern void audit_log_untrustedstring(struct audit_buffer *ab,
178 const char *string);
179extern void audit_log_d_path(struct audit_buffer *ab,
180 const char *prefix,
181 const struct path *path);
182extern void audit_log_key(struct audit_buffer *ab,
183 char *key);
245d7369
KC
184extern void audit_log_path_denied(int type,
185 const char *operation);
96368701 186extern void audit_log_lost(const char *message);
96368701
PM
187
188extern int audit_log_task_context(struct audit_buffer *ab);
2a1fe215 189extern void audit_log_task_info(struct audit_buffer *ab);
96368701
PM
190
191extern int audit_update_lsm_rules(void);
192
193 /* Private API (for audit.c only) */
45a0642b 194extern int audit_rule_change(int type, int seq, void *data, size_t datasz);
96368701
PM
195extern int audit_list_rules_send(struct sk_buff *request_skb, int seq);
196
4b7d248b
RGB
197extern int audit_set_loginuid(kuid_t loginuid);
198
199static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
200{
201 return tsk->loginuid;
202}
203
204static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
205{
206 return tsk->sessionid;
207}
208
96368701 209extern u32 audit_enabled;
b48345aa
RGB
210
211extern int audit_signal_info(int sig, struct task_struct *t);
212
96368701
PM
213#else /* CONFIG_AUDIT */
214static inline __printf(4, 5)
215void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
216 const char *fmt, ...)
217{ }
218static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
219 gfp_t gfp_mask, int type)
220{
221 return NULL;
222}
223static inline __printf(2, 3)
224void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
225{ }
226static inline void audit_log_end(struct audit_buffer *ab)
227{ }
228static inline void audit_log_n_hex(struct audit_buffer *ab,
229 const unsigned char *buf, size_t len)
230{ }
231static inline void audit_log_n_string(struct audit_buffer *ab,
232 const char *buf, size_t n)
233{ }
234static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
235 const char *string, size_t n)
236{ }
237static inline void audit_log_untrustedstring(struct audit_buffer *ab,
238 const char *string)
239{ }
240static inline void audit_log_d_path(struct audit_buffer *ab,
241 const char *prefix,
242 const struct path *path)
243{ }
244static inline void audit_log_key(struct audit_buffer *ab, char *key)
245{ }
245d7369 246static inline void audit_log_path_denied(int type, const char *operation)
96368701 247{ }
96368701
PM
248static inline int audit_log_task_context(struct audit_buffer *ab)
249{
250 return 0;
251}
2a1fe215 252static inline void audit_log_task_info(struct audit_buffer *ab)
96368701 253{ }
4b7d248b
RGB
254
255static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
256{
257 return INVALID_UID;
258}
259
260static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
261{
262 return AUDIT_SID_UNSET;
263}
264
f7859590 265#define audit_enabled AUDIT_OFF
b48345aa
RGB
266
267static inline int audit_signal_info(int sig, struct task_struct *t)
268{
269 return 0;
270}
271
96368701
PM
272#endif /* CONFIG_AUDIT */
273
312103d6 274#ifdef CONFIG_AUDIT_COMPAT_GENERIC
356750e3
EP
275#define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
276#else
277#define audit_is_compat(arch) false
278#endif
279
c9b07eab
AV
280#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
281#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
282#define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */
283
1da177e4 284#ifdef CONFIG_AUDITSYSCALL
a9ebe0b9
EP
285#include <asm/syscall.h> /* for syscall_get_arch() */
286
1da177e4
LT
287/* These are defined in auditsc.c */
288 /* Public API */
289extern int audit_alloc(struct task_struct *task);
a4ff8dba 290extern void __audit_free(struct task_struct *task);
5bd2182d
PM
291extern void __audit_uring_entry(u8 op);
292extern void __audit_uring_exit(int success, long code);
b4f0d375 293extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
b05d8447 294 unsigned long a2, unsigned long a3);
d7e7528b 295extern void __audit_syscall_exit(int ret_success, long ret_value);
7ac86265 296extern struct filename *__audit_reusename(const __user char *uptr);
91a27b2a 297extern void __audit_getname(struct filename *name);
adb5c247 298extern void __audit_inode(struct filename *name, const struct dentry *dentry,
79f6530c 299 unsigned int flags);
9f45f5bf 300extern void __audit_file(const struct file *);
d6335d77 301extern void __audit_inode_child(struct inode *parent,
4fa6b5ec
JL
302 const struct dentry *dentry,
303 const unsigned char type);
326bee02 304extern void audit_seccomp(unsigned long syscall, long signr, int code);
ea6eca77
TH
305extern void audit_seccomp_actions_logged(const char *names,
306 const char *old_names, int res);
a5cb013d
AV
307extern void __audit_ptrace(struct task_struct *t);
308
c0b0ae8a
RGB
309static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
310{
311 task->audit_context = ctx;
312}
313
cdfb6b34
RGB
314static inline struct audit_context *audit_context(void)
315{
316 return current->audit_context;
317}
318
36734810 319static inline bool audit_dummy_context(void)
d51374ad 320{
cdfb6b34 321 void *p = audit_context();
d51374ad
AV
322 return !p || *(int *)p;
323}
a4ff8dba
EP
324static inline void audit_free(struct task_struct *task)
325{
326 if (unlikely(task->audit_context))
327 __audit_free(task);
328}
5bd2182d
PM
329static inline void audit_uring_entry(u8 op)
330{
331 /*
332 * We intentionally check audit_context() before audit_enabled as most
333 * Linux systems (as of ~2021) rely on systemd which forces audit to
334 * be enabled regardless of the user's audit configuration.
335 */
336 if (unlikely(audit_context() && audit_enabled))
337 __audit_uring_entry(op);
338}
339static inline void audit_uring_exit(int success, long code)
340{
69e9cd66 341 if (unlikely(audit_context()))
5bd2182d
PM
342 __audit_uring_exit(success, code);
343}
91397401 344static inline void audit_syscall_entry(int major, unsigned long a0,
b05d8447
EP
345 unsigned long a1, unsigned long a2,
346 unsigned long a3)
347{
cdfb6b34 348 if (unlikely(audit_context()))
b4f0d375 349 __audit_syscall_entry(major, a0, a1, a2, a3);
b05d8447 350}
d7e7528b
EP
351static inline void audit_syscall_exit(void *pt_regs)
352{
cdfb6b34 353 if (unlikely(audit_context())) {
d7e7528b 354 int success = is_syscall_success(pt_regs);
06bdadd7 355 long return_code = regs_return_value(pt_regs);
d7e7528b
EP
356
357 __audit_syscall_exit(success, return_code);
358 }
359}
7ac86265
JL
360static inline struct filename *audit_reusename(const __user char *name)
361{
362 if (unlikely(!audit_dummy_context()))
363 return __audit_reusename(name);
364 return NULL;
365}
91a27b2a 366static inline void audit_getname(struct filename *name)
d8945bb5 367{
5ac3a9c2 368 if (unlikely(!audit_dummy_context()))
d8945bb5
AV
369 __audit_getname(name);
370}
79f6530c
JL
371static inline void audit_inode(struct filename *name,
372 const struct dentry *dentry,
c9b07eab
AV
373 unsigned int aflags) {
374 if (unlikely(!audit_dummy_context()))
57d46577 375 __audit_inode(name, dentry, aflags);
79f6530c 376}
9f45f5bf
AV
377static inline void audit_file(struct file *file)
378{
379 if (unlikely(!audit_dummy_context()))
380 __audit_file(file);
381}
79f6530c
JL
382static inline void audit_inode_parent_hidden(struct filename *name,
383 const struct dentry *dentry)
384{
5ac3a9c2 385 if (unlikely(!audit_dummy_context()))
79f6530c
JL
386 __audit_inode(name, dentry,
387 AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
73241ccc 388}
d6335d77 389static inline void audit_inode_child(struct inode *parent,
4fa6b5ec
JL
390 const struct dentry *dentry,
391 const unsigned char type) {
5ac3a9c2 392 if (unlikely(!audit_dummy_context()))
4fa6b5ec 393 __audit_inode_child(parent, dentry, type);
73241ccc 394}
0a4ff8c2 395void audit_core_dumps(long signr);
1da177e4 396
a5cb013d
AV
397static inline void audit_ptrace(struct task_struct *t)
398{
399 if (unlikely(!audit_dummy_context()))
400 __audit_ptrace(t);
401}
402
1da177e4 403 /* Private API (for audit.c only) */
a33e6751 404extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
2570ebbd 405extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
d9cfea91 406extern void __audit_bprm(struct linux_binprm *bprm);
2950fa9d 407extern int __audit_socketcall(int nargs, unsigned long *args);
07c49417 408extern int __audit_sockaddr(int len, void *addr);
157cf649 409extern void __audit_fd_pair(int fd1, int fd2);
df0a4283 410extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
b9047726 411extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout);
20114f71 412extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
7392906e 413extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
d84f4f99
DH
414extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
415 const struct cred *new,
416 const struct cred *old);
ca24a23e 417extern void __audit_log_capset(const struct cred *new, const struct cred *old);
120a795d 418extern void __audit_mmap_fd(int fd, int flags);
571e5c0e 419extern void __audit_openat2_how(struct open_how *how);
ca86cad7 420extern void __audit_log_kern_module(char *name);
032bffd4 421extern void __audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar);
2d87a067 422extern void __audit_tk_injoffset(struct timespec64 offset);
7e8eda73 423extern void __audit_ntp_log(const struct audit_ntp_data *ad);
c4dad0aa 424extern void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
14224039 425 enum audit_nfcfgop op, gfp_t gfp);
d8945bb5 426
a33e6751 427static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
d8945bb5 428{
5ac3a9c2 429 if (unlikely(!audit_dummy_context()))
a33e6751 430 __audit_ipc_obj(ipcp);
db349509 431}
157cf649 432static inline void audit_fd_pair(int fd1, int fd2)
d8945bb5 433{
5ac3a9c2 434 if (unlikely(!audit_dummy_context()))
157cf649 435 __audit_fd_pair(fd1, fd2);
d8945bb5 436}
2570ebbd 437static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
20ca73bc 438{
5ac3a9c2 439 if (unlikely(!audit_dummy_context()))
e816f370 440 __audit_ipc_set_perm(qbytes, uid, gid, mode);
20ca73bc 441}
9410d228 442static inline void audit_bprm(struct linux_binprm *bprm)
07c49417
EP
443{
444 if (unlikely(!audit_dummy_context()))
d9cfea91 445 __audit_bprm(bprm);
07c49417 446}
2950fa9d 447static inline int audit_socketcall(int nargs, unsigned long *args)
07c49417
EP
448{
449 if (unlikely(!audit_dummy_context()))
2950fa9d
CG
450 return __audit_socketcall(nargs, args);
451 return 0;
07c49417 452}
62bc306e
RGB
453
454static inline int audit_socketcall_compat(int nargs, u32 *args)
455{
456 unsigned long a[AUDITSC_ARGS];
457 int i;
458
459 if (audit_dummy_context())
460 return 0;
461
462 for (i = 0; i < nargs; i++)
463 a[i] = (unsigned long)args[i];
464 return __audit_socketcall(nargs, a);
465}
466
07c49417
EP
467static inline int audit_sockaddr(int len, void *addr)
468{
469 if (unlikely(!audit_dummy_context()))
470 return __audit_sockaddr(len, addr);
471 return 0;
472}
df0a4283 473static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
20ca73bc 474{
5ac3a9c2 475 if (unlikely(!audit_dummy_context()))
564f6993 476 __audit_mq_open(oflag, mode, attr);
20ca73bc 477}
b9047726 478static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout)
20ca73bc 479{
5ac3a9c2 480 if (unlikely(!audit_dummy_context()))
c32c8af4 481 __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
20ca73bc 482}
20114f71 483static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
20ca73bc 484{
5ac3a9c2 485 if (unlikely(!audit_dummy_context()))
20114f71 486 __audit_mq_notify(mqdes, notification);
20ca73bc 487}
7392906e 488static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
20ca73bc 489{
5ac3a9c2 490 if (unlikely(!audit_dummy_context()))
7392906e 491 __audit_mq_getsetattr(mqdes, mqstat);
20ca73bc 492}
3fc689e9 493
d84f4f99
DH
494static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
495 const struct cred *new,
496 const struct cred *old)
3fc689e9
EP
497{
498 if (unlikely(!audit_dummy_context()))
d84f4f99
DH
499 return __audit_log_bprm_fcaps(bprm, new, old);
500 return 0;
3fc689e9
EP
501}
502
ca24a23e 503static inline void audit_log_capset(const struct cred *new,
d84f4f99 504 const struct cred *old)
e68b75a0
EP
505{
506 if (unlikely(!audit_dummy_context()))
ca24a23e 507 __audit_log_capset(new, old);
e68b75a0
EP
508}
509
120a795d
AV
510static inline void audit_mmap_fd(int fd, int flags)
511{
512 if (unlikely(!audit_dummy_context()))
513 __audit_mmap_fd(fd, flags);
514}
515
571e5c0e
RGB
516static inline void audit_openat2_how(struct open_how *how)
517{
518 if (unlikely(!audit_dummy_context()))
519 __audit_openat2_how(how);
520}
521
ca86cad7
RGB
522static inline void audit_log_kern_module(char *name)
523{
524 if (!audit_dummy_context())
525 __audit_log_kern_module(name);
526}
527
032bffd4 528static inline void audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar)
de8cd83e
SG
529{
530 if (!audit_dummy_context())
032bffd4 531 __audit_fanotify(response, friar);
de8cd83e
SG
532}
533
2d87a067
OM
534static inline void audit_tk_injoffset(struct timespec64 offset)
535{
536 /* ignore no-op events */
537 if (offset.tv_sec == 0 && offset.tv_nsec == 0)
538 return;
539
540 if (!audit_dummy_context())
541 __audit_tk_injoffset(offset);
542}
543
7e8eda73
OM
544static inline void audit_ntp_init(struct audit_ntp_data *ad)
545{
546 memset(ad, 0, sizeof(*ad));
547}
548
549static inline void audit_ntp_set_old(struct audit_ntp_data *ad,
550 enum audit_ntp_type type, long long val)
551{
552 ad->vals[type].oldval = val;
553}
554
555static inline void audit_ntp_set_new(struct audit_ntp_data *ad,
556 enum audit_ntp_type type, long long val)
557{
558 ad->vals[type].newval = val;
559}
560
561static inline void audit_ntp_log(const struct audit_ntp_data *ad)
562{
563 if (!audit_dummy_context())
564 __audit_ntp_log(ad);
565}
566
c4dad0aa
RGB
567static inline void audit_log_nfcfg(const char *name, u8 af,
568 unsigned int nentries,
14224039 569 enum audit_nfcfgop op, gfp_t gfp)
c4dad0aa
RGB
570{
571 if (audit_enabled)
14224039 572 __audit_log_nfcfg(name, af, nentries, op, gfp);
c4dad0aa
RGB
573}
574
471a5c7c 575extern int audit_n_rules;
e54dc243 576extern int audit_signals;
d7e7528b 577#else /* CONFIG_AUDITSYSCALL */
9321d526
KC
578static inline int audit_alloc(struct task_struct *task)
579{
580 return 0;
581}
582static inline void audit_free(struct task_struct *task)
583{ }
5bd2182d
PM
584static inline void audit_uring_entry(u8 op)
585{ }
586static inline void audit_uring_exit(int success, long code)
587{ }
91397401 588static inline void audit_syscall_entry(int major, unsigned long a0,
9321d526
KC
589 unsigned long a1, unsigned long a2,
590 unsigned long a3)
591{ }
592static inline void audit_syscall_exit(void *pt_regs)
593{ }
36734810 594static inline bool audit_dummy_context(void)
9321d526 595{
36734810 596 return true;
9321d526 597}
c0b0ae8a
RGB
598static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
599{ }
cdfb6b34
RGB
600static inline struct audit_context *audit_context(void)
601{
602 return NULL;
603}
7ac86265
JL
604static inline struct filename *audit_reusename(const __user char *name)
605{
606 return NULL;
607}
91a27b2a 608static inline void audit_getname(struct filename *name)
9321d526 609{ }
adb5c247
JL
610static inline void audit_inode(struct filename *name,
611 const struct dentry *dentry,
c9b07eab 612 unsigned int aflags)
9321d526 613{ }
9f45f5bf
AV
614static inline void audit_file(struct file *file)
615{
616}
79f6530c
JL
617static inline void audit_inode_parent_hidden(struct filename *name,
618 const struct dentry *dentry)
619{ }
d6335d77 620static inline void audit_inode_child(struct inode *parent,
4fa6b5ec
JL
621 const struct dentry *dentry,
622 const unsigned char type)
9321d526
KC
623{ }
624static inline void audit_core_dumps(long signr)
625{ }
9321d526
KC
626static inline void audit_seccomp(unsigned long syscall, long signr, int code)
627{ }
ea6eca77
TH
628static inline void audit_seccomp_actions_logged(const char *names,
629 const char *old_names, int res)
630{ }
9321d526
KC
631static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
632{ }
633static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
634 gid_t gid, umode_t mode)
635{ }
9410d228
RGB
636static inline void audit_bprm(struct linux_binprm *bprm)
637{ }
2950fa9d
CG
638static inline int audit_socketcall(int nargs, unsigned long *args)
639{
640 return 0;
641}
62bc306e
RGB
642
643static inline int audit_socketcall_compat(int nargs, u32 *args)
644{
645 return 0;
646}
647
9321d526
KC
648static inline void audit_fd_pair(int fd1, int fd2)
649{ }
650static inline int audit_sockaddr(int len, void *addr)
651{
652 return 0;
653}
654static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
655{ }
656static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
657 unsigned int msg_prio,
b9047726 658 const struct timespec64 *abs_timeout)
9321d526
KC
659{ }
660static inline void audit_mq_notify(mqd_t mqdes,
661 const struct sigevent *notification)
662{ }
663static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
664{ }
665static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
666 const struct cred *new,
667 const struct cred *old)
668{
669 return 0;
670}
ca24a23e
EB
671static inline void audit_log_capset(const struct cred *new,
672 const struct cred *old)
9321d526
KC
673{ }
674static inline void audit_mmap_fd(int fd, int flags)
675{ }
ca86cad7 676
571e5c0e
RGB
677static inline void audit_openat2_how(struct open_how *how)
678{ }
679
ca86cad7
RGB
680static inline void audit_log_kern_module(char *name)
681{
682}
683
032bffd4 684static inline void audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar)
de8cd83e
SG
685{ }
686
2d87a067
OM
687static inline void audit_tk_injoffset(struct timespec64 offset)
688{ }
689
7e8eda73
OM
690static inline void audit_ntp_init(struct audit_ntp_data *ad)
691{ }
692
693static inline void audit_ntp_set_old(struct audit_ntp_data *ad,
694 enum audit_ntp_type type, long long val)
695{ }
696
697static inline void audit_ntp_set_new(struct audit_ntp_data *ad,
698 enum audit_ntp_type type, long long val)
699{ }
700
701static inline void audit_ntp_log(const struct audit_ntp_data *ad)
702{ }
703
9321d526
KC
704static inline void audit_ptrace(struct task_struct *t)
705{ }
c4dad0aa
RGB
706
707static inline void audit_log_nfcfg(const char *name, u8 af,
708 unsigned int nentries,
14224039 709 enum audit_nfcfgop op, gfp_t gfp)
c4dad0aa
RGB
710{ }
711
471a5c7c 712#define audit_n_rules 0
e54dc243 713#define audit_signals 0
d7e7528b 714#endif /* CONFIG_AUDITSYSCALL */
1da177e4 715
780a7654
EB
716static inline bool audit_loginuid_set(struct task_struct *tsk)
717{
718 return uid_valid(audit_get_loginuid(tsk));
719}
720
1da177e4 721#endif