18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/* audit.h -- Auditing support
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
58c2ecf20Sopenharmony_ci * All Rights Reserved.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Written by Rickard E. (Rik) Faith <faith@redhat.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef _LINUX_AUDIT_H_
108c2ecf20Sopenharmony_ci#define _LINUX_AUDIT_H_
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/sched.h>
138c2ecf20Sopenharmony_ci#include <linux/ptrace.h>
148c2ecf20Sopenharmony_ci#include <uapi/linux/audit.h>
158c2ecf20Sopenharmony_ci#include <uapi/linux/netfilter/nf_tables.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define AUDIT_INO_UNSET ((unsigned long)-1)
188c2ecf20Sopenharmony_ci#define AUDIT_DEV_UNSET ((dev_t)-1)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct audit_sig_info {
218c2ecf20Sopenharmony_ci	uid_t		uid;
228c2ecf20Sopenharmony_ci	pid_t		pid;
238c2ecf20Sopenharmony_ci	char		ctx[];
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistruct audit_buffer;
278c2ecf20Sopenharmony_cistruct audit_context;
288c2ecf20Sopenharmony_cistruct inode;
298c2ecf20Sopenharmony_cistruct netlink_skb_parms;
308c2ecf20Sopenharmony_cistruct path;
318c2ecf20Sopenharmony_cistruct linux_binprm;
328c2ecf20Sopenharmony_cistruct mq_attr;
338c2ecf20Sopenharmony_cistruct mqstat;
348c2ecf20Sopenharmony_cistruct audit_watch;
358c2ecf20Sopenharmony_cistruct audit_tree;
368c2ecf20Sopenharmony_cistruct sk_buff;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct audit_krule {
398c2ecf20Sopenharmony_ci	u32			pflags;
408c2ecf20Sopenharmony_ci	u32			flags;
418c2ecf20Sopenharmony_ci	u32			listnr;
428c2ecf20Sopenharmony_ci	u32			action;
438c2ecf20Sopenharmony_ci	u32			mask[AUDIT_BITMASK_SIZE];
448c2ecf20Sopenharmony_ci	u32			buflen; /* for data alloc on list rules */
458c2ecf20Sopenharmony_ci	u32			field_count;
468c2ecf20Sopenharmony_ci	char			*filterkey; /* ties events to rules */
478c2ecf20Sopenharmony_ci	struct audit_field	*fields;
488c2ecf20Sopenharmony_ci	struct audit_field	*arch_f; /* quick access to arch field */
498c2ecf20Sopenharmony_ci	struct audit_field	*inode_f; /* quick access to an inode field */
508c2ecf20Sopenharmony_ci	struct audit_watch	*watch;	/* associated watch */
518c2ecf20Sopenharmony_ci	struct audit_tree	*tree;	/* associated watched tree */
528c2ecf20Sopenharmony_ci	struct audit_fsnotify_mark	*exe;
538c2ecf20Sopenharmony_ci	struct list_head	rlist;	/* entry in audit_{watch,tree}.rules list */
548c2ecf20Sopenharmony_ci	struct list_head	list;	/* for AUDIT_LIST* purposes only */
558c2ecf20Sopenharmony_ci	u64			prio;
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* Flag to indicate legacy AUDIT_LOGINUID unset usage */
598c2ecf20Sopenharmony_ci#define AUDIT_LOGINUID_LEGACY		0x1
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct audit_field {
628c2ecf20Sopenharmony_ci	u32				type;
638c2ecf20Sopenharmony_ci	union {
648c2ecf20Sopenharmony_ci		u32			val;
658c2ecf20Sopenharmony_ci		kuid_t			uid;
668c2ecf20Sopenharmony_ci		kgid_t			gid;
678c2ecf20Sopenharmony_ci		struct {
688c2ecf20Sopenharmony_ci			char		*lsm_str;
698c2ecf20Sopenharmony_ci			void		*lsm_rule;
708c2ecf20Sopenharmony_ci		};
718c2ecf20Sopenharmony_ci	};
728c2ecf20Sopenharmony_ci	u32				op;
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cienum audit_ntp_type {
768c2ecf20Sopenharmony_ci	AUDIT_NTP_OFFSET,
778c2ecf20Sopenharmony_ci	AUDIT_NTP_FREQ,
788c2ecf20Sopenharmony_ci	AUDIT_NTP_STATUS,
798c2ecf20Sopenharmony_ci	AUDIT_NTP_TAI,
808c2ecf20Sopenharmony_ci	AUDIT_NTP_TICK,
818c2ecf20Sopenharmony_ci	AUDIT_NTP_ADJUST,
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	AUDIT_NTP_NVALS /* count */
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#ifdef CONFIG_AUDITSYSCALL
878c2ecf20Sopenharmony_cistruct audit_ntp_val {
888c2ecf20Sopenharmony_ci	long long oldval, newval;
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cistruct audit_ntp_data {
928c2ecf20Sopenharmony_ci	struct audit_ntp_val vals[AUDIT_NTP_NVALS];
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci#else
958c2ecf20Sopenharmony_cistruct audit_ntp_data {};
968c2ecf20Sopenharmony_ci#endif
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_cienum audit_nfcfgop {
998c2ecf20Sopenharmony_ci	AUDIT_XT_OP_REGISTER,
1008c2ecf20Sopenharmony_ci	AUDIT_XT_OP_REPLACE,
1018c2ecf20Sopenharmony_ci	AUDIT_XT_OP_UNREGISTER,
1028c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_TABLE_REGISTER,
1038c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_TABLE_UNREGISTER,
1048c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_CHAIN_REGISTER,
1058c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_CHAIN_UNREGISTER,
1068c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_RULE_REGISTER,
1078c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_RULE_UNREGISTER,
1088c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_SET_REGISTER,
1098c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_SET_UNREGISTER,
1108c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_SETELEM_REGISTER,
1118c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_SETELEM_UNREGISTER,
1128c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_GEN_REGISTER,
1138c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_OBJ_REGISTER,
1148c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_OBJ_UNREGISTER,
1158c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_OBJ_RESET,
1168c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_FLOWTABLE_REGISTER,
1178c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_FLOWTABLE_UNREGISTER,
1188c2ecf20Sopenharmony_ci	AUDIT_NFT_OP_INVALID,
1198c2ecf20Sopenharmony_ci};
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciextern int is_audit_feature_set(int which);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciextern int __init audit_register_class(int class, unsigned *list);
1248c2ecf20Sopenharmony_ciextern int audit_classify_syscall(int abi, unsigned syscall);
1258c2ecf20Sopenharmony_ciextern int audit_classify_arch(int arch);
1268c2ecf20Sopenharmony_ci/* only for compat system calls */
1278c2ecf20Sopenharmony_ciextern unsigned compat_write_class[];
1288c2ecf20Sopenharmony_ciextern unsigned compat_read_class[];
1298c2ecf20Sopenharmony_ciextern unsigned compat_dir_class[];
1308c2ecf20Sopenharmony_ciextern unsigned compat_chattr_class[];
1318c2ecf20Sopenharmony_ciextern unsigned compat_signal_class[];
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ciextern int audit_classify_compat_syscall(int abi, unsigned syscall);
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* audit_names->type values */
1368c2ecf20Sopenharmony_ci#define	AUDIT_TYPE_UNKNOWN	0	/* we don't know yet */
1378c2ecf20Sopenharmony_ci#define	AUDIT_TYPE_NORMAL	1	/* a "normal" audit record */
1388c2ecf20Sopenharmony_ci#define	AUDIT_TYPE_PARENT	2	/* a parent audit record */
1398c2ecf20Sopenharmony_ci#define	AUDIT_TYPE_CHILD_DELETE 3	/* a child being deleted */
1408c2ecf20Sopenharmony_ci#define	AUDIT_TYPE_CHILD_CREATE 4	/* a child being created */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* maximized args number that audit_socketcall can process */
1438c2ecf20Sopenharmony_ci#define AUDITSC_ARGS		6
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/* bit values for ->signal->audit_tty */
1468c2ecf20Sopenharmony_ci#define AUDIT_TTY_ENABLE	BIT(0)
1478c2ecf20Sopenharmony_ci#define AUDIT_TTY_LOG_PASSWD	BIT(1)
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_cistruct filename;
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define AUDIT_OFF	0
1528c2ecf20Sopenharmony_ci#define AUDIT_ON	1
1538c2ecf20Sopenharmony_ci#define AUDIT_LOCKED	2
1548c2ecf20Sopenharmony_ci#ifdef CONFIG_AUDIT
1558c2ecf20Sopenharmony_ci/* These are defined in audit.c */
1568c2ecf20Sopenharmony_ci				/* Public API */
1578c2ecf20Sopenharmony_ciextern __printf(4, 5)
1588c2ecf20Sopenharmony_civoid audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
1598c2ecf20Sopenharmony_ci	       const char *fmt, ...);
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ciextern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type);
1628c2ecf20Sopenharmony_ciextern __printf(2, 3)
1638c2ecf20Sopenharmony_civoid audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
1648c2ecf20Sopenharmony_ciextern void		    audit_log_end(struct audit_buffer *ab);
1658c2ecf20Sopenharmony_ciextern bool		    audit_string_contains_control(const char *string,
1668c2ecf20Sopenharmony_ci							  size_t len);
1678c2ecf20Sopenharmony_ciextern void		    audit_log_n_hex(struct audit_buffer *ab,
1688c2ecf20Sopenharmony_ci					  const unsigned char *buf,
1698c2ecf20Sopenharmony_ci					  size_t len);
1708c2ecf20Sopenharmony_ciextern void		    audit_log_n_string(struct audit_buffer *ab,
1718c2ecf20Sopenharmony_ci					       const char *buf,
1728c2ecf20Sopenharmony_ci					       size_t n);
1738c2ecf20Sopenharmony_ciextern void		    audit_log_n_untrustedstring(struct audit_buffer *ab,
1748c2ecf20Sopenharmony_ci							const char *string,
1758c2ecf20Sopenharmony_ci							size_t n);
1768c2ecf20Sopenharmony_ciextern void		    audit_log_untrustedstring(struct audit_buffer *ab,
1778c2ecf20Sopenharmony_ci						      const char *string);
1788c2ecf20Sopenharmony_ciextern void		    audit_log_d_path(struct audit_buffer *ab,
1798c2ecf20Sopenharmony_ci					     const char *prefix,
1808c2ecf20Sopenharmony_ci					     const struct path *path);
1818c2ecf20Sopenharmony_ciextern void		    audit_log_key(struct audit_buffer *ab,
1828c2ecf20Sopenharmony_ci					  char *key);
1838c2ecf20Sopenharmony_ciextern void		    audit_log_path_denied(int type,
1848c2ecf20Sopenharmony_ci						  const char *operation);
1858c2ecf20Sopenharmony_ciextern void		    audit_log_lost(const char *message);
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ciextern int audit_log_task_context(struct audit_buffer *ab);
1888c2ecf20Sopenharmony_ciextern void audit_log_task_info(struct audit_buffer *ab);
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ciextern int		    audit_update_lsm_rules(void);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci				/* Private API (for audit.c only) */
1938c2ecf20Sopenharmony_ciextern int audit_rule_change(int type, int seq, void *data, size_t datasz);
1948c2ecf20Sopenharmony_ciextern int audit_list_rules_send(struct sk_buff *request_skb, int seq);
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ciextern int audit_set_loginuid(kuid_t loginuid);
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_cistatic inline kuid_t audit_get_loginuid(struct task_struct *tsk)
1998c2ecf20Sopenharmony_ci{
2008c2ecf20Sopenharmony_ci	return tsk->loginuid;
2018c2ecf20Sopenharmony_ci}
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_cistatic inline unsigned int audit_get_sessionid(struct task_struct *tsk)
2048c2ecf20Sopenharmony_ci{
2058c2ecf20Sopenharmony_ci	return tsk->sessionid;
2068c2ecf20Sopenharmony_ci}
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ciextern u32 audit_enabled;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ciextern int audit_signal_info(int sig, struct task_struct *t);
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci#else /* CONFIG_AUDIT */
2138c2ecf20Sopenharmony_cistatic inline __printf(4, 5)
2148c2ecf20Sopenharmony_civoid audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
2158c2ecf20Sopenharmony_ci	       const char *fmt, ...)
2168c2ecf20Sopenharmony_ci{ }
2178c2ecf20Sopenharmony_cistatic inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
2188c2ecf20Sopenharmony_ci						   gfp_t gfp_mask, int type)
2198c2ecf20Sopenharmony_ci{
2208c2ecf20Sopenharmony_ci	return NULL;
2218c2ecf20Sopenharmony_ci}
2228c2ecf20Sopenharmony_cistatic inline __printf(2, 3)
2238c2ecf20Sopenharmony_civoid audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
2248c2ecf20Sopenharmony_ci{ }
2258c2ecf20Sopenharmony_cistatic inline void audit_log_end(struct audit_buffer *ab)
2268c2ecf20Sopenharmony_ci{ }
2278c2ecf20Sopenharmony_cistatic inline void audit_log_n_hex(struct audit_buffer *ab,
2288c2ecf20Sopenharmony_ci				   const unsigned char *buf, size_t len)
2298c2ecf20Sopenharmony_ci{ }
2308c2ecf20Sopenharmony_cistatic inline void audit_log_n_string(struct audit_buffer *ab,
2318c2ecf20Sopenharmony_ci				      const char *buf, size_t n)
2328c2ecf20Sopenharmony_ci{ }
2338c2ecf20Sopenharmony_cistatic inline void  audit_log_n_untrustedstring(struct audit_buffer *ab,
2348c2ecf20Sopenharmony_ci						const char *string, size_t n)
2358c2ecf20Sopenharmony_ci{ }
2368c2ecf20Sopenharmony_cistatic inline void audit_log_untrustedstring(struct audit_buffer *ab,
2378c2ecf20Sopenharmony_ci					     const char *string)
2388c2ecf20Sopenharmony_ci{ }
2398c2ecf20Sopenharmony_cistatic inline void audit_log_d_path(struct audit_buffer *ab,
2408c2ecf20Sopenharmony_ci				    const char *prefix,
2418c2ecf20Sopenharmony_ci				    const struct path *path)
2428c2ecf20Sopenharmony_ci{ }
2438c2ecf20Sopenharmony_cistatic inline void audit_log_key(struct audit_buffer *ab, char *key)
2448c2ecf20Sopenharmony_ci{ }
2458c2ecf20Sopenharmony_cistatic inline void audit_log_path_denied(int type, const char *operation)
2468c2ecf20Sopenharmony_ci{ }
2478c2ecf20Sopenharmony_cistatic inline int audit_log_task_context(struct audit_buffer *ab)
2488c2ecf20Sopenharmony_ci{
2498c2ecf20Sopenharmony_ci	return 0;
2508c2ecf20Sopenharmony_ci}
2518c2ecf20Sopenharmony_cistatic inline void audit_log_task_info(struct audit_buffer *ab)
2528c2ecf20Sopenharmony_ci{ }
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_cistatic inline kuid_t audit_get_loginuid(struct task_struct *tsk)
2558c2ecf20Sopenharmony_ci{
2568c2ecf20Sopenharmony_ci	return INVALID_UID;
2578c2ecf20Sopenharmony_ci}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistatic inline unsigned int audit_get_sessionid(struct task_struct *tsk)
2608c2ecf20Sopenharmony_ci{
2618c2ecf20Sopenharmony_ci	return AUDIT_SID_UNSET;
2628c2ecf20Sopenharmony_ci}
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#define audit_enabled AUDIT_OFF
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_cistatic inline int audit_signal_info(int sig, struct task_struct *t)
2678c2ecf20Sopenharmony_ci{
2688c2ecf20Sopenharmony_ci	return 0;
2698c2ecf20Sopenharmony_ci}
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci#endif /* CONFIG_AUDIT */
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci#ifdef CONFIG_AUDIT_COMPAT_GENERIC
2748c2ecf20Sopenharmony_ci#define audit_is_compat(arch)  (!((arch) & __AUDIT_ARCH_64BIT))
2758c2ecf20Sopenharmony_ci#else
2768c2ecf20Sopenharmony_ci#define audit_is_compat(arch)  false
2778c2ecf20Sopenharmony_ci#endif
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#define AUDIT_INODE_PARENT	1	/* dentry represents the parent */
2808c2ecf20Sopenharmony_ci#define AUDIT_INODE_HIDDEN	2	/* audit record should be hidden */
2818c2ecf20Sopenharmony_ci#define AUDIT_INODE_NOEVAL	4	/* audit record incomplete */
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci#ifdef CONFIG_AUDITSYSCALL
2848c2ecf20Sopenharmony_ci#include <asm/syscall.h> /* for syscall_get_arch() */
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* These are defined in auditsc.c */
2878c2ecf20Sopenharmony_ci				/* Public API */
2888c2ecf20Sopenharmony_ciextern int  audit_alloc(struct task_struct *task);
2898c2ecf20Sopenharmony_ciextern void __audit_free(struct task_struct *task);
2908c2ecf20Sopenharmony_ciextern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
2918c2ecf20Sopenharmony_ci				  unsigned long a2, unsigned long a3);
2928c2ecf20Sopenharmony_ciextern void __audit_syscall_exit(int ret_success, long ret_value);
2938c2ecf20Sopenharmony_ciextern struct filename *__audit_reusename(const __user char *uptr);
2948c2ecf20Sopenharmony_ciextern void __audit_getname(struct filename *name);
2958c2ecf20Sopenharmony_ciextern void __audit_getcwd(void);
2968c2ecf20Sopenharmony_ciextern void __audit_inode(struct filename *name, const struct dentry *dentry,
2978c2ecf20Sopenharmony_ci				unsigned int flags);
2988c2ecf20Sopenharmony_ciextern void __audit_file(const struct file *);
2998c2ecf20Sopenharmony_ciextern void __audit_inode_child(struct inode *parent,
3008c2ecf20Sopenharmony_ci				const struct dentry *dentry,
3018c2ecf20Sopenharmony_ci				const unsigned char type);
3028c2ecf20Sopenharmony_ciextern void audit_seccomp(unsigned long syscall, long signr, int code);
3038c2ecf20Sopenharmony_ciextern void audit_seccomp_actions_logged(const char *names,
3048c2ecf20Sopenharmony_ci					 const char *old_names, int res);
3058c2ecf20Sopenharmony_ciextern void __audit_ptrace(struct task_struct *t);
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_cistatic inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
3088c2ecf20Sopenharmony_ci{
3098c2ecf20Sopenharmony_ci	task->audit_context = ctx;
3108c2ecf20Sopenharmony_ci}
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_cistatic inline struct audit_context *audit_context(void)
3138c2ecf20Sopenharmony_ci{
3148c2ecf20Sopenharmony_ci	return current->audit_context;
3158c2ecf20Sopenharmony_ci}
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistatic inline bool audit_dummy_context(void)
3188c2ecf20Sopenharmony_ci{
3198c2ecf20Sopenharmony_ci	void *p = audit_context();
3208c2ecf20Sopenharmony_ci	return !p || *(int *)p;
3218c2ecf20Sopenharmony_ci}
3228c2ecf20Sopenharmony_cistatic inline void audit_free(struct task_struct *task)
3238c2ecf20Sopenharmony_ci{
3248c2ecf20Sopenharmony_ci	if (unlikely(task->audit_context))
3258c2ecf20Sopenharmony_ci		__audit_free(task);
3268c2ecf20Sopenharmony_ci}
3278c2ecf20Sopenharmony_cistatic inline void audit_syscall_entry(int major, unsigned long a0,
3288c2ecf20Sopenharmony_ci				       unsigned long a1, unsigned long a2,
3298c2ecf20Sopenharmony_ci				       unsigned long a3)
3308c2ecf20Sopenharmony_ci{
3318c2ecf20Sopenharmony_ci	if (unlikely(audit_context()))
3328c2ecf20Sopenharmony_ci		__audit_syscall_entry(major, a0, a1, a2, a3);
3338c2ecf20Sopenharmony_ci}
3348c2ecf20Sopenharmony_cistatic inline void audit_syscall_exit(void *pt_regs)
3358c2ecf20Sopenharmony_ci{
3368c2ecf20Sopenharmony_ci	if (unlikely(audit_context())) {
3378c2ecf20Sopenharmony_ci		int success = is_syscall_success(pt_regs);
3388c2ecf20Sopenharmony_ci		long return_code = regs_return_value(pt_regs);
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci		__audit_syscall_exit(success, return_code);
3418c2ecf20Sopenharmony_ci	}
3428c2ecf20Sopenharmony_ci}
3438c2ecf20Sopenharmony_cistatic inline struct filename *audit_reusename(const __user char *name)
3448c2ecf20Sopenharmony_ci{
3458c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3468c2ecf20Sopenharmony_ci		return __audit_reusename(name);
3478c2ecf20Sopenharmony_ci	return NULL;
3488c2ecf20Sopenharmony_ci}
3498c2ecf20Sopenharmony_cistatic inline void audit_getname(struct filename *name)
3508c2ecf20Sopenharmony_ci{
3518c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3528c2ecf20Sopenharmony_ci		__audit_getname(name);
3538c2ecf20Sopenharmony_ci}
3548c2ecf20Sopenharmony_cistatic inline void audit_getcwd(void)
3558c2ecf20Sopenharmony_ci{
3568c2ecf20Sopenharmony_ci	if (unlikely(audit_context()))
3578c2ecf20Sopenharmony_ci		__audit_getcwd();
3588c2ecf20Sopenharmony_ci}
3598c2ecf20Sopenharmony_cistatic inline void audit_inode(struct filename *name,
3608c2ecf20Sopenharmony_ci				const struct dentry *dentry,
3618c2ecf20Sopenharmony_ci				unsigned int aflags) {
3628c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3638c2ecf20Sopenharmony_ci		__audit_inode(name, dentry, aflags);
3648c2ecf20Sopenharmony_ci}
3658c2ecf20Sopenharmony_cistatic inline void audit_file(struct file *file)
3668c2ecf20Sopenharmony_ci{
3678c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3688c2ecf20Sopenharmony_ci		__audit_file(file);
3698c2ecf20Sopenharmony_ci}
3708c2ecf20Sopenharmony_cistatic inline void audit_inode_parent_hidden(struct filename *name,
3718c2ecf20Sopenharmony_ci						const struct dentry *dentry)
3728c2ecf20Sopenharmony_ci{
3738c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3748c2ecf20Sopenharmony_ci		__audit_inode(name, dentry,
3758c2ecf20Sopenharmony_ci				AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
3768c2ecf20Sopenharmony_ci}
3778c2ecf20Sopenharmony_cistatic inline void audit_inode_child(struct inode *parent,
3788c2ecf20Sopenharmony_ci				     const struct dentry *dentry,
3798c2ecf20Sopenharmony_ci				     const unsigned char type) {
3808c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3818c2ecf20Sopenharmony_ci		__audit_inode_child(parent, dentry, type);
3828c2ecf20Sopenharmony_ci}
3838c2ecf20Sopenharmony_civoid audit_core_dumps(long signr);
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_cistatic inline void audit_ptrace(struct task_struct *t)
3868c2ecf20Sopenharmony_ci{
3878c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
3888c2ecf20Sopenharmony_ci		__audit_ptrace(t);
3898c2ecf20Sopenharmony_ci}
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci				/* Private API (for audit.c only) */
3928c2ecf20Sopenharmony_ciextern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
3938c2ecf20Sopenharmony_ciextern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
3948c2ecf20Sopenharmony_ciextern void __audit_bprm(struct linux_binprm *bprm);
3958c2ecf20Sopenharmony_ciextern int __audit_socketcall(int nargs, unsigned long *args);
3968c2ecf20Sopenharmony_ciextern int __audit_sockaddr(int len, void *addr);
3978c2ecf20Sopenharmony_ciextern void __audit_fd_pair(int fd1, int fd2);
3988c2ecf20Sopenharmony_ciextern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
3998c2ecf20Sopenharmony_ciextern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout);
4008c2ecf20Sopenharmony_ciextern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
4018c2ecf20Sopenharmony_ciextern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
4028c2ecf20Sopenharmony_ciextern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
4038c2ecf20Sopenharmony_ci				  const struct cred *new,
4048c2ecf20Sopenharmony_ci				  const struct cred *old);
4058c2ecf20Sopenharmony_ciextern void __audit_log_capset(const struct cred *new, const struct cred *old);
4068c2ecf20Sopenharmony_ciextern void __audit_mmap_fd(int fd, int flags);
4078c2ecf20Sopenharmony_ciextern void __audit_log_kern_module(char *name);
4088c2ecf20Sopenharmony_ciextern void __audit_fanotify(unsigned int response);
4098c2ecf20Sopenharmony_ciextern void __audit_tk_injoffset(struct timespec64 offset);
4108c2ecf20Sopenharmony_ciextern void __audit_ntp_log(const struct audit_ntp_data *ad);
4118c2ecf20Sopenharmony_ciextern void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
4128c2ecf20Sopenharmony_ci			      enum audit_nfcfgop op, gfp_t gfp);
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_cistatic inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
4158c2ecf20Sopenharmony_ci{
4168c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4178c2ecf20Sopenharmony_ci		__audit_ipc_obj(ipcp);
4188c2ecf20Sopenharmony_ci}
4198c2ecf20Sopenharmony_cistatic inline void audit_fd_pair(int fd1, int fd2)
4208c2ecf20Sopenharmony_ci{
4218c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4228c2ecf20Sopenharmony_ci		__audit_fd_pair(fd1, fd2);
4238c2ecf20Sopenharmony_ci}
4248c2ecf20Sopenharmony_cistatic inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
4258c2ecf20Sopenharmony_ci{
4268c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4278c2ecf20Sopenharmony_ci		__audit_ipc_set_perm(qbytes, uid, gid, mode);
4288c2ecf20Sopenharmony_ci}
4298c2ecf20Sopenharmony_cistatic inline void audit_bprm(struct linux_binprm *bprm)
4308c2ecf20Sopenharmony_ci{
4318c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4328c2ecf20Sopenharmony_ci		__audit_bprm(bprm);
4338c2ecf20Sopenharmony_ci}
4348c2ecf20Sopenharmony_cistatic inline int audit_socketcall(int nargs, unsigned long *args)
4358c2ecf20Sopenharmony_ci{
4368c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4378c2ecf20Sopenharmony_ci		return __audit_socketcall(nargs, args);
4388c2ecf20Sopenharmony_ci	return 0;
4398c2ecf20Sopenharmony_ci}
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_cistatic inline int audit_socketcall_compat(int nargs, u32 *args)
4428c2ecf20Sopenharmony_ci{
4438c2ecf20Sopenharmony_ci	unsigned long a[AUDITSC_ARGS];
4448c2ecf20Sopenharmony_ci	int i;
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci	if (audit_dummy_context())
4478c2ecf20Sopenharmony_ci		return 0;
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci	for (i = 0; i < nargs; i++)
4508c2ecf20Sopenharmony_ci		a[i] = (unsigned long)args[i];
4518c2ecf20Sopenharmony_ci	return __audit_socketcall(nargs, a);
4528c2ecf20Sopenharmony_ci}
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_cistatic inline int audit_sockaddr(int len, void *addr)
4558c2ecf20Sopenharmony_ci{
4568c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4578c2ecf20Sopenharmony_ci		return __audit_sockaddr(len, addr);
4588c2ecf20Sopenharmony_ci	return 0;
4598c2ecf20Sopenharmony_ci}
4608c2ecf20Sopenharmony_cistatic inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
4618c2ecf20Sopenharmony_ci{
4628c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4638c2ecf20Sopenharmony_ci		__audit_mq_open(oflag, mode, attr);
4648c2ecf20Sopenharmony_ci}
4658c2ecf20Sopenharmony_cistatic inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout)
4668c2ecf20Sopenharmony_ci{
4678c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4688c2ecf20Sopenharmony_ci		__audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
4698c2ecf20Sopenharmony_ci}
4708c2ecf20Sopenharmony_cistatic inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
4718c2ecf20Sopenharmony_ci{
4728c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4738c2ecf20Sopenharmony_ci		__audit_mq_notify(mqdes, notification);
4748c2ecf20Sopenharmony_ci}
4758c2ecf20Sopenharmony_cistatic inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
4768c2ecf20Sopenharmony_ci{
4778c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4788c2ecf20Sopenharmony_ci		__audit_mq_getsetattr(mqdes, mqstat);
4798c2ecf20Sopenharmony_ci}
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_cistatic inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
4828c2ecf20Sopenharmony_ci				       const struct cred *new,
4838c2ecf20Sopenharmony_ci				       const struct cred *old)
4848c2ecf20Sopenharmony_ci{
4858c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4868c2ecf20Sopenharmony_ci		return __audit_log_bprm_fcaps(bprm, new, old);
4878c2ecf20Sopenharmony_ci	return 0;
4888c2ecf20Sopenharmony_ci}
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cistatic inline void audit_log_capset(const struct cred *new,
4918c2ecf20Sopenharmony_ci				   const struct cred *old)
4928c2ecf20Sopenharmony_ci{
4938c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
4948c2ecf20Sopenharmony_ci		__audit_log_capset(new, old);
4958c2ecf20Sopenharmony_ci}
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_cistatic inline void audit_mmap_fd(int fd, int flags)
4988c2ecf20Sopenharmony_ci{
4998c2ecf20Sopenharmony_ci	if (unlikely(!audit_dummy_context()))
5008c2ecf20Sopenharmony_ci		__audit_mmap_fd(fd, flags);
5018c2ecf20Sopenharmony_ci}
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_cistatic inline void audit_log_kern_module(char *name)
5048c2ecf20Sopenharmony_ci{
5058c2ecf20Sopenharmony_ci	if (!audit_dummy_context())
5068c2ecf20Sopenharmony_ci		__audit_log_kern_module(name);
5078c2ecf20Sopenharmony_ci}
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_cistatic inline void audit_fanotify(unsigned int response)
5108c2ecf20Sopenharmony_ci{
5118c2ecf20Sopenharmony_ci	if (!audit_dummy_context())
5128c2ecf20Sopenharmony_ci		__audit_fanotify(response);
5138c2ecf20Sopenharmony_ci}
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_cistatic inline void audit_tk_injoffset(struct timespec64 offset)
5168c2ecf20Sopenharmony_ci{
5178c2ecf20Sopenharmony_ci	/* ignore no-op events */
5188c2ecf20Sopenharmony_ci	if (offset.tv_sec == 0 && offset.tv_nsec == 0)
5198c2ecf20Sopenharmony_ci		return;
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	if (!audit_dummy_context())
5228c2ecf20Sopenharmony_ci		__audit_tk_injoffset(offset);
5238c2ecf20Sopenharmony_ci}
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_cistatic inline void audit_ntp_init(struct audit_ntp_data *ad)
5268c2ecf20Sopenharmony_ci{
5278c2ecf20Sopenharmony_ci	memset(ad, 0, sizeof(*ad));
5288c2ecf20Sopenharmony_ci}
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_cistatic inline void audit_ntp_set_old(struct audit_ntp_data *ad,
5318c2ecf20Sopenharmony_ci				     enum audit_ntp_type type, long long val)
5328c2ecf20Sopenharmony_ci{
5338c2ecf20Sopenharmony_ci	ad->vals[type].oldval = val;
5348c2ecf20Sopenharmony_ci}
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_cistatic inline void audit_ntp_set_new(struct audit_ntp_data *ad,
5378c2ecf20Sopenharmony_ci				     enum audit_ntp_type type, long long val)
5388c2ecf20Sopenharmony_ci{
5398c2ecf20Sopenharmony_ci	ad->vals[type].newval = val;
5408c2ecf20Sopenharmony_ci}
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_cistatic inline void audit_ntp_log(const struct audit_ntp_data *ad)
5438c2ecf20Sopenharmony_ci{
5448c2ecf20Sopenharmony_ci	if (!audit_dummy_context())
5458c2ecf20Sopenharmony_ci		__audit_ntp_log(ad);
5468c2ecf20Sopenharmony_ci}
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_cistatic inline void audit_log_nfcfg(const char *name, u8 af,
5498c2ecf20Sopenharmony_ci				   unsigned int nentries,
5508c2ecf20Sopenharmony_ci				   enum audit_nfcfgop op, gfp_t gfp)
5518c2ecf20Sopenharmony_ci{
5528c2ecf20Sopenharmony_ci	if (audit_enabled)
5538c2ecf20Sopenharmony_ci		__audit_log_nfcfg(name, af, nentries, op, gfp);
5548c2ecf20Sopenharmony_ci}
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ciextern int audit_n_rules;
5578c2ecf20Sopenharmony_ciextern int audit_signals;
5588c2ecf20Sopenharmony_ci#else /* CONFIG_AUDITSYSCALL */
5598c2ecf20Sopenharmony_cistatic inline int audit_alloc(struct task_struct *task)
5608c2ecf20Sopenharmony_ci{
5618c2ecf20Sopenharmony_ci	return 0;
5628c2ecf20Sopenharmony_ci}
5638c2ecf20Sopenharmony_cistatic inline void audit_free(struct task_struct *task)
5648c2ecf20Sopenharmony_ci{ }
5658c2ecf20Sopenharmony_cistatic inline void audit_syscall_entry(int major, unsigned long a0,
5668c2ecf20Sopenharmony_ci				       unsigned long a1, unsigned long a2,
5678c2ecf20Sopenharmony_ci				       unsigned long a3)
5688c2ecf20Sopenharmony_ci{ }
5698c2ecf20Sopenharmony_cistatic inline void audit_syscall_exit(void *pt_regs)
5708c2ecf20Sopenharmony_ci{ }
5718c2ecf20Sopenharmony_cistatic inline bool audit_dummy_context(void)
5728c2ecf20Sopenharmony_ci{
5738c2ecf20Sopenharmony_ci	return true;
5748c2ecf20Sopenharmony_ci}
5758c2ecf20Sopenharmony_cistatic inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
5768c2ecf20Sopenharmony_ci{ }
5778c2ecf20Sopenharmony_cistatic inline struct audit_context *audit_context(void)
5788c2ecf20Sopenharmony_ci{
5798c2ecf20Sopenharmony_ci	return NULL;
5808c2ecf20Sopenharmony_ci}
5818c2ecf20Sopenharmony_cistatic inline struct filename *audit_reusename(const __user char *name)
5828c2ecf20Sopenharmony_ci{
5838c2ecf20Sopenharmony_ci	return NULL;
5848c2ecf20Sopenharmony_ci}
5858c2ecf20Sopenharmony_cistatic inline void audit_getname(struct filename *name)
5868c2ecf20Sopenharmony_ci{ }
5878c2ecf20Sopenharmony_cistatic inline void audit_getcwd(void)
5888c2ecf20Sopenharmony_ci{ }
5898c2ecf20Sopenharmony_cistatic inline void audit_inode(struct filename *name,
5908c2ecf20Sopenharmony_ci				const struct dentry *dentry,
5918c2ecf20Sopenharmony_ci				unsigned int aflags)
5928c2ecf20Sopenharmony_ci{ }
5938c2ecf20Sopenharmony_cistatic inline void audit_file(struct file *file)
5948c2ecf20Sopenharmony_ci{
5958c2ecf20Sopenharmony_ci}
5968c2ecf20Sopenharmony_cistatic inline void audit_inode_parent_hidden(struct filename *name,
5978c2ecf20Sopenharmony_ci				const struct dentry *dentry)
5988c2ecf20Sopenharmony_ci{ }
5998c2ecf20Sopenharmony_cistatic inline void audit_inode_child(struct inode *parent,
6008c2ecf20Sopenharmony_ci				     const struct dentry *dentry,
6018c2ecf20Sopenharmony_ci				     const unsigned char type)
6028c2ecf20Sopenharmony_ci{ }
6038c2ecf20Sopenharmony_cistatic inline void audit_core_dumps(long signr)
6048c2ecf20Sopenharmony_ci{ }
6058c2ecf20Sopenharmony_cistatic inline void audit_seccomp(unsigned long syscall, long signr, int code)
6068c2ecf20Sopenharmony_ci{ }
6078c2ecf20Sopenharmony_cistatic inline void audit_seccomp_actions_logged(const char *names,
6088c2ecf20Sopenharmony_ci						const char *old_names, int res)
6098c2ecf20Sopenharmony_ci{ }
6108c2ecf20Sopenharmony_cistatic inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
6118c2ecf20Sopenharmony_ci{ }
6128c2ecf20Sopenharmony_cistatic inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
6138c2ecf20Sopenharmony_ci					gid_t gid, umode_t mode)
6148c2ecf20Sopenharmony_ci{ }
6158c2ecf20Sopenharmony_cistatic inline void audit_bprm(struct linux_binprm *bprm)
6168c2ecf20Sopenharmony_ci{ }
6178c2ecf20Sopenharmony_cistatic inline int audit_socketcall(int nargs, unsigned long *args)
6188c2ecf20Sopenharmony_ci{
6198c2ecf20Sopenharmony_ci	return 0;
6208c2ecf20Sopenharmony_ci}
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_cistatic inline int audit_socketcall_compat(int nargs, u32 *args)
6238c2ecf20Sopenharmony_ci{
6248c2ecf20Sopenharmony_ci	return 0;
6258c2ecf20Sopenharmony_ci}
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_cistatic inline void audit_fd_pair(int fd1, int fd2)
6288c2ecf20Sopenharmony_ci{ }
6298c2ecf20Sopenharmony_cistatic inline int audit_sockaddr(int len, void *addr)
6308c2ecf20Sopenharmony_ci{
6318c2ecf20Sopenharmony_ci	return 0;
6328c2ecf20Sopenharmony_ci}
6338c2ecf20Sopenharmony_cistatic inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
6348c2ecf20Sopenharmony_ci{ }
6358c2ecf20Sopenharmony_cistatic inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
6368c2ecf20Sopenharmony_ci				     unsigned int msg_prio,
6378c2ecf20Sopenharmony_ci				     const struct timespec64 *abs_timeout)
6388c2ecf20Sopenharmony_ci{ }
6398c2ecf20Sopenharmony_cistatic inline void audit_mq_notify(mqd_t mqdes,
6408c2ecf20Sopenharmony_ci				   const struct sigevent *notification)
6418c2ecf20Sopenharmony_ci{ }
6428c2ecf20Sopenharmony_cistatic inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
6438c2ecf20Sopenharmony_ci{ }
6448c2ecf20Sopenharmony_cistatic inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
6458c2ecf20Sopenharmony_ci				       const struct cred *new,
6468c2ecf20Sopenharmony_ci				       const struct cred *old)
6478c2ecf20Sopenharmony_ci{
6488c2ecf20Sopenharmony_ci	return 0;
6498c2ecf20Sopenharmony_ci}
6508c2ecf20Sopenharmony_cistatic inline void audit_log_capset(const struct cred *new,
6518c2ecf20Sopenharmony_ci				    const struct cred *old)
6528c2ecf20Sopenharmony_ci{ }
6538c2ecf20Sopenharmony_cistatic inline void audit_mmap_fd(int fd, int flags)
6548c2ecf20Sopenharmony_ci{ }
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_cistatic inline void audit_log_kern_module(char *name)
6578c2ecf20Sopenharmony_ci{
6588c2ecf20Sopenharmony_ci}
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_cistatic inline void audit_fanotify(unsigned int response)
6618c2ecf20Sopenharmony_ci{ }
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_cistatic inline void audit_tk_injoffset(struct timespec64 offset)
6648c2ecf20Sopenharmony_ci{ }
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_cistatic inline void audit_ntp_init(struct audit_ntp_data *ad)
6678c2ecf20Sopenharmony_ci{ }
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_cistatic inline void audit_ntp_set_old(struct audit_ntp_data *ad,
6708c2ecf20Sopenharmony_ci				     enum audit_ntp_type type, long long val)
6718c2ecf20Sopenharmony_ci{ }
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_cistatic inline void audit_ntp_set_new(struct audit_ntp_data *ad,
6748c2ecf20Sopenharmony_ci				     enum audit_ntp_type type, long long val)
6758c2ecf20Sopenharmony_ci{ }
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_cistatic inline void audit_ntp_log(const struct audit_ntp_data *ad)
6788c2ecf20Sopenharmony_ci{ }
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_cistatic inline void audit_ptrace(struct task_struct *t)
6818c2ecf20Sopenharmony_ci{ }
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_cistatic inline void audit_log_nfcfg(const char *name, u8 af,
6848c2ecf20Sopenharmony_ci				   unsigned int nentries,
6858c2ecf20Sopenharmony_ci				   enum audit_nfcfgop op, gfp_t gfp)
6868c2ecf20Sopenharmony_ci{ }
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_ci#define audit_n_rules 0
6898c2ecf20Sopenharmony_ci#define audit_signals 0
6908c2ecf20Sopenharmony_ci#endif /* CONFIG_AUDITSYSCALL */
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistatic inline bool audit_loginuid_set(struct task_struct *tsk)
6938c2ecf20Sopenharmony_ci{
6948c2ecf20Sopenharmony_ci	return uid_valid(audit_get_loginuid(tsk));
6958c2ecf20Sopenharmony_ci}
6968c2ecf20Sopenharmony_ci
6978c2ecf20Sopenharmony_ci#endif
698