xref: /linux-6.15/include/linux/security.h (revision 223981db)
1 /*
2  * Linux Security plug
3  *
4  * Copyright (C) 2001 WireX Communications, Inc <[email protected]>
5  * Copyright (C) 2001 Greg Kroah-Hartman <[email protected]>
6  * Copyright (C) 2001 Networks Associates Technology, Inc <[email protected]>
7  * Copyright (C) 2001 James Morris <[email protected]>
8  * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
9  * Copyright (C) 2016 Mellanox Techonologies
10  *
11  *	This program is free software; you can redistribute it and/or modify
12  *	it under the terms of the GNU General Public License as published by
13  *	the Free Software Foundation; either version 2 of the License, or
14  *	(at your option) any later version.
15  *
16  *	Due to this file being licensed under the GPL there is controversy over
17  *	whether this permits you to write a module that #includes this file
18  *	without placing your module under the GPL.  Please consult a lawyer for
19  *	advice before doing this.
20  *
21  */
22 
23 #ifndef __LINUX_SECURITY_H
24 #define __LINUX_SECURITY_H
25 
26 #include <linux/kernel_read_file.h>
27 #include <linux/key.h>
28 #include <linux/capability.h>
29 #include <linux/fs.h>
30 #include <linux/slab.h>
31 #include <linux/err.h>
32 #include <linux/string.h>
33 #include <linux/mm.h>
34 #include <linux/sockptr.h>
35 #include <uapi/linux/lsm.h>
36 
37 struct linux_binprm;
38 struct cred;
39 struct rlimit;
40 struct kernel_siginfo;
41 struct sembuf;
42 struct kern_ipc_perm;
43 struct audit_context;
44 struct super_block;
45 struct inode;
46 struct dentry;
47 struct file;
48 struct vfsmount;
49 struct path;
50 struct qstr;
51 struct iattr;
52 struct fown_struct;
53 struct file_operations;
54 struct msg_msg;
55 struct xattr;
56 struct kernfs_node;
57 struct xfrm_sec_ctx;
58 struct mm_struct;
59 struct fs_context;
60 struct fs_parameter;
61 enum fs_value_type;
62 struct watch;
63 struct watch_notification;
64 struct lsm_ctx;
65 
66 /* Default (no) options for the capable function */
67 #define CAP_OPT_NONE 0x0
68 /* If capable should audit the security request */
69 #define CAP_OPT_NOAUDIT BIT(1)
70 /* If capable is being called by a setid function */
71 #define CAP_OPT_INSETID BIT(2)
72 
73 /* LSM Agnostic defines for security_sb_set_mnt_opts() flags */
74 #define SECURITY_LSM_NATIVE_LABELS	1
75 
76 struct ctl_table;
77 struct audit_krule;
78 struct user_namespace;
79 struct timezone;
80 
81 enum lsm_event {
82 	LSM_POLICY_CHANGE,
83 };
84 
85 /*
86  * These are reasons that can be passed to the security_locked_down()
87  * LSM hook. Lockdown reasons that protect kernel integrity (ie, the
88  * ability for userland to modify kernel code) are placed before
89  * LOCKDOWN_INTEGRITY_MAX.  Lockdown reasons that protect kernel
90  * confidentiality (ie, the ability for userland to extract
91  * information from the running kernel that would otherwise be
92  * restricted) are placed before LOCKDOWN_CONFIDENTIALITY_MAX.
93  *
94  * LSM authors should note that the semantics of any given lockdown
95  * reason are not guaranteed to be stable - the same reason may block
96  * one set of features in one kernel release, and a slightly different
97  * set of features in a later kernel release. LSMs that seek to expose
98  * lockdown policy at any level of granularity other than "none",
99  * "integrity" or "confidentiality" are responsible for either
100  * ensuring that they expose a consistent level of functionality to
101  * userland, or ensuring that userland is aware that this is
102  * potentially a moving target. It is easy to misuse this information
103  * in a way that could break userspace. Please be careful not to do
104  * so.
105  *
106  * If you add to this, remember to extend lockdown_reasons in
107  * security/lockdown/lockdown.c.
108  */
109 enum lockdown_reason {
110 	LOCKDOWN_NONE,
111 	LOCKDOWN_MODULE_SIGNATURE,
112 	LOCKDOWN_DEV_MEM,
113 	LOCKDOWN_EFI_TEST,
114 	LOCKDOWN_KEXEC,
115 	LOCKDOWN_HIBERNATION,
116 	LOCKDOWN_PCI_ACCESS,
117 	LOCKDOWN_IOPORT,
118 	LOCKDOWN_MSR,
119 	LOCKDOWN_ACPI_TABLES,
120 	LOCKDOWN_DEVICE_TREE,
121 	LOCKDOWN_PCMCIA_CIS,
122 	LOCKDOWN_TIOCSSERIAL,
123 	LOCKDOWN_MODULE_PARAMETERS,
124 	LOCKDOWN_MMIOTRACE,
125 	LOCKDOWN_DEBUGFS,
126 	LOCKDOWN_XMON_WR,
127 	LOCKDOWN_BPF_WRITE_USER,
128 	LOCKDOWN_DBG_WRITE_KERNEL,
129 	LOCKDOWN_RTAS_ERROR_INJECTION,
130 	LOCKDOWN_INTEGRITY_MAX,
131 	LOCKDOWN_KCORE,
132 	LOCKDOWN_KPROBES,
133 	LOCKDOWN_BPF_READ_KERNEL,
134 	LOCKDOWN_DBG_READ_KERNEL,
135 	LOCKDOWN_PERF,
136 	LOCKDOWN_TRACEFS,
137 	LOCKDOWN_XMON_RW,
138 	LOCKDOWN_XFRM_SECRET,
139 	LOCKDOWN_CONFIDENTIALITY_MAX,
140 };
141 
142 extern const char *const lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1];
143 extern u32 lsm_active_cnt;
144 extern const struct lsm_id *lsm_idlist[];
145 
146 /* These functions are in security/commoncap.c */
147 extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
148 		       int cap, unsigned int opts);
149 extern int cap_settime(const struct timespec64 *ts, const struct timezone *tz);
150 extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
151 extern int cap_ptrace_traceme(struct task_struct *parent);
152 extern int cap_capget(const struct task_struct *target, kernel_cap_t *effective,
153 		      kernel_cap_t *inheritable, kernel_cap_t *permitted);
154 extern int cap_capset(struct cred *new, const struct cred *old,
155 		      const kernel_cap_t *effective,
156 		      const kernel_cap_t *inheritable,
157 		      const kernel_cap_t *permitted);
158 extern int cap_bprm_creds_from_file(struct linux_binprm *bprm, const struct file *file);
159 int cap_inode_setxattr(struct dentry *dentry, const char *name,
160 		       const void *value, size_t size, int flags);
161 int cap_inode_removexattr(struct mnt_idmap *idmap,
162 			  struct dentry *dentry, const char *name);
163 int cap_inode_need_killpriv(struct dentry *dentry);
164 int cap_inode_killpriv(struct mnt_idmap *idmap, struct dentry *dentry);
165 int cap_inode_getsecurity(struct mnt_idmap *idmap,
166 			  struct inode *inode, const char *name, void **buffer,
167 			  bool alloc);
168 extern int cap_mmap_addr(unsigned long addr);
169 extern int cap_mmap_file(struct file *file, unsigned long reqprot,
170 			 unsigned long prot, unsigned long flags);
171 extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
172 extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
173 			  unsigned long arg4, unsigned long arg5);
174 extern int cap_task_setscheduler(struct task_struct *p);
175 extern int cap_task_setioprio(struct task_struct *p, int ioprio);
176 extern int cap_task_setnice(struct task_struct *p, int nice);
177 extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
178 
179 struct msghdr;
180 struct sk_buff;
181 struct sock;
182 struct sockaddr;
183 struct socket;
184 struct flowi_common;
185 struct dst_entry;
186 struct xfrm_selector;
187 struct xfrm_policy;
188 struct xfrm_state;
189 struct xfrm_user_sec_ctx;
190 struct seq_file;
191 struct sctp_association;
192 
193 #ifdef CONFIG_MMU
194 extern unsigned long mmap_min_addr;
195 extern unsigned long dac_mmap_min_addr;
196 #else
197 #define mmap_min_addr		0UL
198 #define dac_mmap_min_addr	0UL
199 #endif
200 
201 /*
202  * Values used in the task_security_ops calls
203  */
204 /* setuid or setgid, id0 == uid or gid */
205 #define LSM_SETID_ID	1
206 
207 /* setreuid or setregid, id0 == real, id1 == eff */
208 #define LSM_SETID_RE	2
209 
210 /* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */
211 #define LSM_SETID_RES	4
212 
213 /* setfsuid or setfsgid, id0 == fsuid or fsgid */
214 #define LSM_SETID_FS	8
215 
216 /* Flags for security_task_prlimit(). */
217 #define LSM_PRLIMIT_READ  1
218 #define LSM_PRLIMIT_WRITE 2
219 
220 /* forward declares to avoid warnings */
221 struct sched_param;
222 struct request_sock;
223 
224 /* bprm->unsafe reasons */
225 #define LSM_UNSAFE_SHARE	1
226 #define LSM_UNSAFE_PTRACE	2
227 #define LSM_UNSAFE_NO_NEW_PRIVS	4
228 
229 #ifdef CONFIG_MMU
230 extern int mmap_min_addr_handler(struct ctl_table *table, int write,
231 				 void *buffer, size_t *lenp, loff_t *ppos);
232 #endif
233 
234 /* security_inode_init_security callback function to write xattrs */
235 typedef int (*initxattrs) (struct inode *inode,
236 			   const struct xattr *xattr_array, void *fs_data);
237 
238 
239 /* Keep the kernel_load_data_id enum in sync with kernel_read_file_id */
240 #define __data_id_enumify(ENUM, dummy) LOADING_ ## ENUM,
241 #define __data_id_stringify(dummy, str) #str,
242 
243 enum kernel_load_data_id {
244 	__kernel_read_file_id(__data_id_enumify)
245 };
246 
247 static const char * const kernel_load_data_str[] = {
248 	__kernel_read_file_id(__data_id_stringify)
249 };
250 
251 static inline const char *kernel_load_data_id_str(enum kernel_load_data_id id)
252 {
253 	if ((unsigned)id >= LOADING_MAX_ID)
254 		return kernel_load_data_str[LOADING_UNKNOWN];
255 
256 	return kernel_load_data_str[id];
257 }
258 
259 #ifdef CONFIG_SECURITY
260 
261 int call_blocking_lsm_notifier(enum lsm_event event, void *data);
262 int register_blocking_lsm_notifier(struct notifier_block *nb);
263 int unregister_blocking_lsm_notifier(struct notifier_block *nb);
264 
265 /* prototypes */
266 extern int security_init(void);
267 extern int early_security_init(void);
268 extern u64 lsm_name_to_attr(const char *name);
269 
270 /* Security operations */
271 int security_binder_set_context_mgr(const struct cred *mgr);
272 int security_binder_transaction(const struct cred *from,
273 				const struct cred *to);
274 int security_binder_transfer_binder(const struct cred *from,
275 				    const struct cred *to);
276 int security_binder_transfer_file(const struct cred *from,
277 				  const struct cred *to, const struct file *file);
278 int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
279 int security_ptrace_traceme(struct task_struct *parent);
280 int security_capget(const struct task_struct *target,
281 		    kernel_cap_t *effective,
282 		    kernel_cap_t *inheritable,
283 		    kernel_cap_t *permitted);
284 int security_capset(struct cred *new, const struct cred *old,
285 		    const kernel_cap_t *effective,
286 		    const kernel_cap_t *inheritable,
287 		    const kernel_cap_t *permitted);
288 int security_capable(const struct cred *cred,
289 		       struct user_namespace *ns,
290 		       int cap,
291 		       unsigned int opts);
292 int security_quotactl(int cmds, int type, int id, const struct super_block *sb);
293 int security_quota_on(struct dentry *dentry);
294 int security_syslog(int type);
295 int security_settime64(const struct timespec64 *ts, const struct timezone *tz);
296 int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
297 int security_bprm_creds_for_exec(struct linux_binprm *bprm);
298 int security_bprm_creds_from_file(struct linux_binprm *bprm, const struct file *file);
299 int security_bprm_check(struct linux_binprm *bprm);
300 void security_bprm_committing_creds(const struct linux_binprm *bprm);
301 void security_bprm_committed_creds(const struct linux_binprm *bprm);
302 int security_fs_context_submount(struct fs_context *fc, struct super_block *reference);
303 int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);
304 int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);
305 int security_sb_alloc(struct super_block *sb);
306 void security_sb_delete(struct super_block *sb);
307 void security_sb_free(struct super_block *sb);
308 void security_free_mnt_opts(void **mnt_opts);
309 int security_sb_eat_lsm_opts(char *options, void **mnt_opts);
310 int security_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts);
311 int security_sb_remount(struct super_block *sb, void *mnt_opts);
312 int security_sb_kern_mount(const struct super_block *sb);
313 int security_sb_show_options(struct seq_file *m, struct super_block *sb);
314 int security_sb_statfs(struct dentry *dentry);
315 int security_sb_mount(const char *dev_name, const struct path *path,
316 		      const char *type, unsigned long flags, void *data);
317 int security_sb_umount(struct vfsmount *mnt, int flags);
318 int security_sb_pivotroot(const struct path *old_path, const struct path *new_path);
319 int security_sb_set_mnt_opts(struct super_block *sb,
320 				void *mnt_opts,
321 				unsigned long kern_flags,
322 				unsigned long *set_kern_flags);
323 int security_sb_clone_mnt_opts(const struct super_block *oldsb,
324 				struct super_block *newsb,
325 				unsigned long kern_flags,
326 				unsigned long *set_kern_flags);
327 int security_move_mount(const struct path *from_path, const struct path *to_path);
328 int security_dentry_init_security(struct dentry *dentry, int mode,
329 				  const struct qstr *name,
330 				  const char **xattr_name, void **ctx,
331 				  u32 *ctxlen);
332 int security_dentry_create_files_as(struct dentry *dentry, int mode,
333 					struct qstr *name,
334 					const struct cred *old,
335 					struct cred *new);
336 int security_path_notify(const struct path *path, u64 mask,
337 					unsigned int obj_type);
338 int security_inode_alloc(struct inode *inode);
339 void security_inode_free(struct inode *inode);
340 int security_inode_init_security(struct inode *inode, struct inode *dir,
341 				 const struct qstr *qstr,
342 				 initxattrs initxattrs, void *fs_data);
343 int security_inode_init_security_anon(struct inode *inode,
344 				      const struct qstr *name,
345 				      const struct inode *context_inode);
346 int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
347 int security_inode_link(struct dentry *old_dentry, struct inode *dir,
348 			 struct dentry *new_dentry);
349 int security_inode_unlink(struct inode *dir, struct dentry *dentry);
350 int security_inode_symlink(struct inode *dir, struct dentry *dentry,
351 			   const char *old_name);
352 int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
353 int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
354 int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
355 int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
356 			  struct inode *new_dir, struct dentry *new_dentry,
357 			  unsigned int flags);
358 int security_inode_readlink(struct dentry *dentry);
359 int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
360 			       bool rcu);
361 int security_inode_permission(struct inode *inode, int mask);
362 int security_inode_setattr(struct mnt_idmap *idmap,
363 			   struct dentry *dentry, struct iattr *attr);
364 int security_inode_getattr(const struct path *path);
365 int security_inode_setxattr(struct mnt_idmap *idmap,
366 			    struct dentry *dentry, const char *name,
367 			    const void *value, size_t size, int flags);
368 int security_inode_set_acl(struct mnt_idmap *idmap,
369 			   struct dentry *dentry, const char *acl_name,
370 			   struct posix_acl *kacl);
371 int security_inode_get_acl(struct mnt_idmap *idmap,
372 			   struct dentry *dentry, const char *acl_name);
373 int security_inode_remove_acl(struct mnt_idmap *idmap,
374 			      struct dentry *dentry, const char *acl_name);
375 void security_inode_post_setxattr(struct dentry *dentry, const char *name,
376 				  const void *value, size_t size, int flags);
377 int security_inode_getxattr(struct dentry *dentry, const char *name);
378 int security_inode_listxattr(struct dentry *dentry);
379 int security_inode_removexattr(struct mnt_idmap *idmap,
380 			       struct dentry *dentry, const char *name);
381 int security_inode_need_killpriv(struct dentry *dentry);
382 int security_inode_killpriv(struct mnt_idmap *idmap, struct dentry *dentry);
383 int security_inode_getsecurity(struct mnt_idmap *idmap,
384 			       struct inode *inode, const char *name,
385 			       void **buffer, bool alloc);
386 int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
387 int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
388 void security_inode_getsecid(struct inode *inode, u32 *secid);
389 int security_inode_copy_up(struct dentry *src, struct cred **new);
390 int security_inode_copy_up_xattr(const char *name);
391 int security_kernfs_init_security(struct kernfs_node *kn_dir,
392 				  struct kernfs_node *kn);
393 int security_file_permission(struct file *file, int mask);
394 int security_file_alloc(struct file *file);
395 void security_file_free(struct file *file);
396 int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
397 int security_mmap_file(struct file *file, unsigned long prot,
398 			unsigned long flags);
399 int security_mmap_addr(unsigned long addr);
400 int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
401 			   unsigned long prot);
402 int security_file_lock(struct file *file, unsigned int cmd);
403 int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
404 void security_file_set_fowner(struct file *file);
405 int security_file_send_sigiotask(struct task_struct *tsk,
406 				 struct fown_struct *fown, int sig);
407 int security_file_receive(struct file *file);
408 int security_file_open(struct file *file);
409 int security_file_truncate(struct file *file);
410 int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
411 void security_task_free(struct task_struct *task);
412 int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
413 void security_cred_free(struct cred *cred);
414 int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
415 void security_transfer_creds(struct cred *new, const struct cred *old);
416 void security_cred_getsecid(const struct cred *c, u32 *secid);
417 int security_kernel_act_as(struct cred *new, u32 secid);
418 int security_kernel_create_files_as(struct cred *new, struct inode *inode);
419 int security_kernel_module_request(char *kmod_name);
420 int security_kernel_load_data(enum kernel_load_data_id id, bool contents);
421 int security_kernel_post_load_data(char *buf, loff_t size,
422 				   enum kernel_load_data_id id,
423 				   char *description);
424 int security_kernel_read_file(struct file *file, enum kernel_read_file_id id,
425 			      bool contents);
426 int security_kernel_post_read_file(struct file *file, char *buf, loff_t size,
427 				   enum kernel_read_file_id id);
428 int security_task_fix_setuid(struct cred *new, const struct cred *old,
429 			     int flags);
430 int security_task_fix_setgid(struct cred *new, const struct cred *old,
431 			     int flags);
432 int security_task_fix_setgroups(struct cred *new, const struct cred *old);
433 int security_task_setpgid(struct task_struct *p, pid_t pgid);
434 int security_task_getpgid(struct task_struct *p);
435 int security_task_getsid(struct task_struct *p);
436 void security_current_getsecid_subj(u32 *secid);
437 void security_task_getsecid_obj(struct task_struct *p, u32 *secid);
438 int security_task_setnice(struct task_struct *p, int nice);
439 int security_task_setioprio(struct task_struct *p, int ioprio);
440 int security_task_getioprio(struct task_struct *p);
441 int security_task_prlimit(const struct cred *cred, const struct cred *tcred,
442 			  unsigned int flags);
443 int security_task_setrlimit(struct task_struct *p, unsigned int resource,
444 		struct rlimit *new_rlim);
445 int security_task_setscheduler(struct task_struct *p);
446 int security_task_getscheduler(struct task_struct *p);
447 int security_task_movememory(struct task_struct *p);
448 int security_task_kill(struct task_struct *p, struct kernel_siginfo *info,
449 			int sig, const struct cred *cred);
450 int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
451 			unsigned long arg4, unsigned long arg5);
452 void security_task_to_inode(struct task_struct *p, struct inode *inode);
453 int security_create_user_ns(const struct cred *cred);
454 int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
455 void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
456 int security_msg_msg_alloc(struct msg_msg *msg);
457 void security_msg_msg_free(struct msg_msg *msg);
458 int security_msg_queue_alloc(struct kern_ipc_perm *msq);
459 void security_msg_queue_free(struct kern_ipc_perm *msq);
460 int security_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg);
461 int security_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd);
462 int security_msg_queue_msgsnd(struct kern_ipc_perm *msq,
463 			      struct msg_msg *msg, int msqflg);
464 int security_msg_queue_msgrcv(struct kern_ipc_perm *msq, struct msg_msg *msg,
465 			      struct task_struct *target, long type, int mode);
466 int security_shm_alloc(struct kern_ipc_perm *shp);
467 void security_shm_free(struct kern_ipc_perm *shp);
468 int security_shm_associate(struct kern_ipc_perm *shp, int shmflg);
469 int security_shm_shmctl(struct kern_ipc_perm *shp, int cmd);
470 int security_shm_shmat(struct kern_ipc_perm *shp, char __user *shmaddr, int shmflg);
471 int security_sem_alloc(struct kern_ipc_perm *sma);
472 void security_sem_free(struct kern_ipc_perm *sma);
473 int security_sem_associate(struct kern_ipc_perm *sma, int semflg);
474 int security_sem_semctl(struct kern_ipc_perm *sma, int cmd);
475 int security_sem_semop(struct kern_ipc_perm *sma, struct sembuf *sops,
476 			unsigned nsops, int alter);
477 void security_d_instantiate(struct dentry *dentry, struct inode *inode);
478 int security_getselfattr(unsigned int attr, struct lsm_ctx __user *ctx,
479 			 size_t __user *size, u32 flags);
480 int security_setselfattr(unsigned int attr, struct lsm_ctx __user *ctx,
481 			 size_t size, u32 flags);
482 int security_getprocattr(struct task_struct *p, int lsmid, const char *name,
483 			 char **value);
484 int security_setprocattr(int lsmid, const char *name, void *value, size_t size);
485 int security_netlink_send(struct sock *sk, struct sk_buff *skb);
486 int security_ismaclabel(const char *name);
487 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
488 int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
489 void security_release_secctx(char *secdata, u32 seclen);
490 void security_inode_invalidate_secctx(struct inode *inode);
491 int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
492 int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
493 int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
494 int security_locked_down(enum lockdown_reason what);
495 int lsm_fill_user_ctx(struct lsm_ctx __user *ctx, void *context,
496 		      size_t context_size, u64 id, u64 flags);
497 #else /* CONFIG_SECURITY */
498 
499 static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data)
500 {
501 	return 0;
502 }
503 
504 static inline int register_blocking_lsm_notifier(struct notifier_block *nb)
505 {
506 	return 0;
507 }
508 
509 static inline  int unregister_blocking_lsm_notifier(struct notifier_block *nb)
510 {
511 	return 0;
512 }
513 
514 static inline u64 lsm_name_to_attr(const char *name)
515 {
516 	return LSM_ATTR_UNDEF;
517 }
518 
519 static inline void security_free_mnt_opts(void **mnt_opts)
520 {
521 }
522 
523 /*
524  * This is the default capabilities functionality.  Most of these functions
525  * are just stubbed out, but a few must call the proper capable code.
526  */
527 
528 static inline int security_init(void)
529 {
530 	return 0;
531 }
532 
533 static inline int early_security_init(void)
534 {
535 	return 0;
536 }
537 
538 static inline int security_binder_set_context_mgr(const struct cred *mgr)
539 {
540 	return 0;
541 }
542 
543 static inline int security_binder_transaction(const struct cred *from,
544 					      const struct cred *to)
545 {
546 	return 0;
547 }
548 
549 static inline int security_binder_transfer_binder(const struct cred *from,
550 						  const struct cred *to)
551 {
552 	return 0;
553 }
554 
555 static inline int security_binder_transfer_file(const struct cred *from,
556 						const struct cred *to,
557 						const struct file *file)
558 {
559 	return 0;
560 }
561 
562 static inline int security_ptrace_access_check(struct task_struct *child,
563 					     unsigned int mode)
564 {
565 	return cap_ptrace_access_check(child, mode);
566 }
567 
568 static inline int security_ptrace_traceme(struct task_struct *parent)
569 {
570 	return cap_ptrace_traceme(parent);
571 }
572 
573 static inline int security_capget(const struct task_struct *target,
574 				   kernel_cap_t *effective,
575 				   kernel_cap_t *inheritable,
576 				   kernel_cap_t *permitted)
577 {
578 	return cap_capget(target, effective, inheritable, permitted);
579 }
580 
581 static inline int security_capset(struct cred *new,
582 				   const struct cred *old,
583 				   const kernel_cap_t *effective,
584 				   const kernel_cap_t *inheritable,
585 				   const kernel_cap_t *permitted)
586 {
587 	return cap_capset(new, old, effective, inheritable, permitted);
588 }
589 
590 static inline int security_capable(const struct cred *cred,
591 				   struct user_namespace *ns,
592 				   int cap,
593 				   unsigned int opts)
594 {
595 	return cap_capable(cred, ns, cap, opts);
596 }
597 
598 static inline int security_quotactl(int cmds, int type, int id,
599 				     const struct super_block *sb)
600 {
601 	return 0;
602 }
603 
604 static inline int security_quota_on(struct dentry *dentry)
605 {
606 	return 0;
607 }
608 
609 static inline int security_syslog(int type)
610 {
611 	return 0;
612 }
613 
614 static inline int security_settime64(const struct timespec64 *ts,
615 				     const struct timezone *tz)
616 {
617 	return cap_settime(ts, tz);
618 }
619 
620 static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
621 {
622 	return __vm_enough_memory(mm, pages, cap_vm_enough_memory(mm, pages));
623 }
624 
625 static inline int security_bprm_creds_for_exec(struct linux_binprm *bprm)
626 {
627 	return 0;
628 }
629 
630 static inline int security_bprm_creds_from_file(struct linux_binprm *bprm,
631 						const struct file *file)
632 {
633 	return cap_bprm_creds_from_file(bprm, file);
634 }
635 
636 static inline int security_bprm_check(struct linux_binprm *bprm)
637 {
638 	return 0;
639 }
640 
641 static inline void security_bprm_committing_creds(const struct linux_binprm *bprm)
642 {
643 }
644 
645 static inline void security_bprm_committed_creds(const struct linux_binprm *bprm)
646 {
647 }
648 
649 static inline int security_fs_context_submount(struct fs_context *fc,
650 					   struct super_block *reference)
651 {
652 	return 0;
653 }
654 static inline int security_fs_context_dup(struct fs_context *fc,
655 					  struct fs_context *src_fc)
656 {
657 	return 0;
658 }
659 static inline int security_fs_context_parse_param(struct fs_context *fc,
660 						  struct fs_parameter *param)
661 {
662 	return -ENOPARAM;
663 }
664 
665 static inline int security_sb_alloc(struct super_block *sb)
666 {
667 	return 0;
668 }
669 
670 static inline void security_sb_delete(struct super_block *sb)
671 { }
672 
673 static inline void security_sb_free(struct super_block *sb)
674 { }
675 
676 static inline int security_sb_eat_lsm_opts(char *options,
677 					   void **mnt_opts)
678 {
679 	return 0;
680 }
681 
682 static inline int security_sb_remount(struct super_block *sb,
683 				      void *mnt_opts)
684 {
685 	return 0;
686 }
687 
688 static inline int security_sb_mnt_opts_compat(struct super_block *sb,
689 					      void *mnt_opts)
690 {
691 	return 0;
692 }
693 
694 
695 static inline int security_sb_kern_mount(struct super_block *sb)
696 {
697 	return 0;
698 }
699 
700 static inline int security_sb_show_options(struct seq_file *m,
701 					   struct super_block *sb)
702 {
703 	return 0;
704 }
705 
706 static inline int security_sb_statfs(struct dentry *dentry)
707 {
708 	return 0;
709 }
710 
711 static inline int security_sb_mount(const char *dev_name, const struct path *path,
712 				    const char *type, unsigned long flags,
713 				    void *data)
714 {
715 	return 0;
716 }
717 
718 static inline int security_sb_umount(struct vfsmount *mnt, int flags)
719 {
720 	return 0;
721 }
722 
723 static inline int security_sb_pivotroot(const struct path *old_path,
724 					const struct path *new_path)
725 {
726 	return 0;
727 }
728 
729 static inline int security_sb_set_mnt_opts(struct super_block *sb,
730 					   void *mnt_opts,
731 					   unsigned long kern_flags,
732 					   unsigned long *set_kern_flags)
733 {
734 	return 0;
735 }
736 
737 static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb,
738 					      struct super_block *newsb,
739 					      unsigned long kern_flags,
740 					      unsigned long *set_kern_flags)
741 {
742 	return 0;
743 }
744 
745 static inline int security_move_mount(const struct path *from_path,
746 				      const struct path *to_path)
747 {
748 	return 0;
749 }
750 
751 static inline int security_path_notify(const struct path *path, u64 mask,
752 				unsigned int obj_type)
753 {
754 	return 0;
755 }
756 
757 static inline int security_inode_alloc(struct inode *inode)
758 {
759 	return 0;
760 }
761 
762 static inline void security_inode_free(struct inode *inode)
763 { }
764 
765 static inline int security_dentry_init_security(struct dentry *dentry,
766 						 int mode,
767 						 const struct qstr *name,
768 						 const char **xattr_name,
769 						 void **ctx,
770 						 u32 *ctxlen)
771 {
772 	return -EOPNOTSUPP;
773 }
774 
775 static inline int security_dentry_create_files_as(struct dentry *dentry,
776 						  int mode, struct qstr *name,
777 						  const struct cred *old,
778 						  struct cred *new)
779 {
780 	return 0;
781 }
782 
783 
784 static inline int security_inode_init_security(struct inode *inode,
785 						struct inode *dir,
786 						const struct qstr *qstr,
787 						const initxattrs xattrs,
788 						void *fs_data)
789 {
790 	return 0;
791 }
792 
793 static inline int security_inode_init_security_anon(struct inode *inode,
794 						    const struct qstr *name,
795 						    const struct inode *context_inode)
796 {
797 	return 0;
798 }
799 
800 static inline int security_inode_create(struct inode *dir,
801 					 struct dentry *dentry,
802 					 umode_t mode)
803 {
804 	return 0;
805 }
806 
807 static inline int security_inode_link(struct dentry *old_dentry,
808 				       struct inode *dir,
809 				       struct dentry *new_dentry)
810 {
811 	return 0;
812 }
813 
814 static inline int security_inode_unlink(struct inode *dir,
815 					 struct dentry *dentry)
816 {
817 	return 0;
818 }
819 
820 static inline int security_inode_symlink(struct inode *dir,
821 					  struct dentry *dentry,
822 					  const char *old_name)
823 {
824 	return 0;
825 }
826 
827 static inline int security_inode_mkdir(struct inode *dir,
828 					struct dentry *dentry,
829 					int mode)
830 {
831 	return 0;
832 }
833 
834 static inline int security_inode_rmdir(struct inode *dir,
835 					struct dentry *dentry)
836 {
837 	return 0;
838 }
839 
840 static inline int security_inode_mknod(struct inode *dir,
841 					struct dentry *dentry,
842 					int mode, dev_t dev)
843 {
844 	return 0;
845 }
846 
847 static inline int security_inode_rename(struct inode *old_dir,
848 					 struct dentry *old_dentry,
849 					 struct inode *new_dir,
850 					 struct dentry *new_dentry,
851 					 unsigned int flags)
852 {
853 	return 0;
854 }
855 
856 static inline int security_inode_readlink(struct dentry *dentry)
857 {
858 	return 0;
859 }
860 
861 static inline int security_inode_follow_link(struct dentry *dentry,
862 					     struct inode *inode,
863 					     bool rcu)
864 {
865 	return 0;
866 }
867 
868 static inline int security_inode_permission(struct inode *inode, int mask)
869 {
870 	return 0;
871 }
872 
873 static inline int security_inode_setattr(struct mnt_idmap *idmap,
874 					 struct dentry *dentry,
875 					 struct iattr *attr)
876 {
877 	return 0;
878 }
879 
880 static inline int security_inode_getattr(const struct path *path)
881 {
882 	return 0;
883 }
884 
885 static inline int security_inode_setxattr(struct mnt_idmap *idmap,
886 		struct dentry *dentry, const char *name, const void *value,
887 		size_t size, int flags)
888 {
889 	return cap_inode_setxattr(dentry, name, value, size, flags);
890 }
891 
892 static inline int security_inode_set_acl(struct mnt_idmap *idmap,
893 					 struct dentry *dentry,
894 					 const char *acl_name,
895 					 struct posix_acl *kacl)
896 {
897 	return 0;
898 }
899 
900 static inline int security_inode_get_acl(struct mnt_idmap *idmap,
901 					 struct dentry *dentry,
902 					 const char *acl_name)
903 {
904 	return 0;
905 }
906 
907 static inline int security_inode_remove_acl(struct mnt_idmap *idmap,
908 					    struct dentry *dentry,
909 					    const char *acl_name)
910 {
911 	return 0;
912 }
913 
914 static inline void security_inode_post_setxattr(struct dentry *dentry,
915 		const char *name, const void *value, size_t size, int flags)
916 { }
917 
918 static inline int security_inode_getxattr(struct dentry *dentry,
919 			const char *name)
920 {
921 	return 0;
922 }
923 
924 static inline int security_inode_listxattr(struct dentry *dentry)
925 {
926 	return 0;
927 }
928 
929 static inline int security_inode_removexattr(struct mnt_idmap *idmap,
930 					     struct dentry *dentry,
931 					     const char *name)
932 {
933 	return cap_inode_removexattr(idmap, dentry, name);
934 }
935 
936 static inline int security_inode_need_killpriv(struct dentry *dentry)
937 {
938 	return cap_inode_need_killpriv(dentry);
939 }
940 
941 static inline int security_inode_killpriv(struct mnt_idmap *idmap,
942 					  struct dentry *dentry)
943 {
944 	return cap_inode_killpriv(idmap, dentry);
945 }
946 
947 static inline int security_inode_getsecurity(struct mnt_idmap *idmap,
948 					     struct inode *inode,
949 					     const char *name, void **buffer,
950 					     bool alloc)
951 {
952 	return cap_inode_getsecurity(idmap, inode, name, buffer, alloc);
953 }
954 
955 static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
956 {
957 	return -EOPNOTSUPP;
958 }
959 
960 static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
961 {
962 	return 0;
963 }
964 
965 static inline void security_inode_getsecid(struct inode *inode, u32 *secid)
966 {
967 	*secid = 0;
968 }
969 
970 static inline int security_inode_copy_up(struct dentry *src, struct cred **new)
971 {
972 	return 0;
973 }
974 
975 static inline int security_kernfs_init_security(struct kernfs_node *kn_dir,
976 						struct kernfs_node *kn)
977 {
978 	return 0;
979 }
980 
981 static inline int security_inode_copy_up_xattr(const char *name)
982 {
983 	return -EOPNOTSUPP;
984 }
985 
986 static inline int security_file_permission(struct file *file, int mask)
987 {
988 	return 0;
989 }
990 
991 static inline int security_file_alloc(struct file *file)
992 {
993 	return 0;
994 }
995 
996 static inline void security_file_free(struct file *file)
997 { }
998 
999 static inline int security_file_ioctl(struct file *file, unsigned int cmd,
1000 				      unsigned long arg)
1001 {
1002 	return 0;
1003 }
1004 
1005 static inline int security_mmap_file(struct file *file, unsigned long prot,
1006 				     unsigned long flags)
1007 {
1008 	return 0;
1009 }
1010 
1011 static inline int security_mmap_addr(unsigned long addr)
1012 {
1013 	return cap_mmap_addr(addr);
1014 }
1015 
1016 static inline int security_file_mprotect(struct vm_area_struct *vma,
1017 					 unsigned long reqprot,
1018 					 unsigned long prot)
1019 {
1020 	return 0;
1021 }
1022 
1023 static inline int security_file_lock(struct file *file, unsigned int cmd)
1024 {
1025 	return 0;
1026 }
1027 
1028 static inline int security_file_fcntl(struct file *file, unsigned int cmd,
1029 				      unsigned long arg)
1030 {
1031 	return 0;
1032 }
1033 
1034 static inline void security_file_set_fowner(struct file *file)
1035 {
1036 	return;
1037 }
1038 
1039 static inline int security_file_send_sigiotask(struct task_struct *tsk,
1040 					       struct fown_struct *fown,
1041 					       int sig)
1042 {
1043 	return 0;
1044 }
1045 
1046 static inline int security_file_receive(struct file *file)
1047 {
1048 	return 0;
1049 }
1050 
1051 static inline int security_file_open(struct file *file)
1052 {
1053 	return 0;
1054 }
1055 
1056 static inline int security_file_truncate(struct file *file)
1057 {
1058 	return 0;
1059 }
1060 
1061 static inline int security_task_alloc(struct task_struct *task,
1062 				      unsigned long clone_flags)
1063 {
1064 	return 0;
1065 }
1066 
1067 static inline void security_task_free(struct task_struct *task)
1068 { }
1069 
1070 static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
1071 {
1072 	return 0;
1073 }
1074 
1075 static inline void security_cred_free(struct cred *cred)
1076 { }
1077 
1078 static inline int security_prepare_creds(struct cred *new,
1079 					 const struct cred *old,
1080 					 gfp_t gfp)
1081 {
1082 	return 0;
1083 }
1084 
1085 static inline void security_transfer_creds(struct cred *new,
1086 					   const struct cred *old)
1087 {
1088 }
1089 
1090 static inline void security_cred_getsecid(const struct cred *c, u32 *secid)
1091 {
1092 	*secid = 0;
1093 }
1094 
1095 static inline int security_kernel_act_as(struct cred *cred, u32 secid)
1096 {
1097 	return 0;
1098 }
1099 
1100 static inline int security_kernel_create_files_as(struct cred *cred,
1101 						  struct inode *inode)
1102 {
1103 	return 0;
1104 }
1105 
1106 static inline int security_kernel_module_request(char *kmod_name)
1107 {
1108 	return 0;
1109 }
1110 
1111 static inline int security_kernel_load_data(enum kernel_load_data_id id, bool contents)
1112 {
1113 	return 0;
1114 }
1115 
1116 static inline int security_kernel_post_load_data(char *buf, loff_t size,
1117 						 enum kernel_load_data_id id,
1118 						 char *description)
1119 {
1120 	return 0;
1121 }
1122 
1123 static inline int security_kernel_read_file(struct file *file,
1124 					    enum kernel_read_file_id id,
1125 					    bool contents)
1126 {
1127 	return 0;
1128 }
1129 
1130 static inline int security_kernel_post_read_file(struct file *file,
1131 						 char *buf, loff_t size,
1132 						 enum kernel_read_file_id id)
1133 {
1134 	return 0;
1135 }
1136 
1137 static inline int security_task_fix_setuid(struct cred *new,
1138 					   const struct cred *old,
1139 					   int flags)
1140 {
1141 	return cap_task_fix_setuid(new, old, flags);
1142 }
1143 
1144 static inline int security_task_fix_setgid(struct cred *new,
1145 					   const struct cred *old,
1146 					   int flags)
1147 {
1148 	return 0;
1149 }
1150 
1151 static inline int security_task_fix_setgroups(struct cred *new,
1152 					   const struct cred *old)
1153 {
1154 	return 0;
1155 }
1156 
1157 static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
1158 {
1159 	return 0;
1160 }
1161 
1162 static inline int security_task_getpgid(struct task_struct *p)
1163 {
1164 	return 0;
1165 }
1166 
1167 static inline int security_task_getsid(struct task_struct *p)
1168 {
1169 	return 0;
1170 }
1171 
1172 static inline void security_current_getsecid_subj(u32 *secid)
1173 {
1174 	*secid = 0;
1175 }
1176 
1177 static inline void security_task_getsecid_obj(struct task_struct *p, u32 *secid)
1178 {
1179 	*secid = 0;
1180 }
1181 
1182 static inline int security_task_setnice(struct task_struct *p, int nice)
1183 {
1184 	return cap_task_setnice(p, nice);
1185 }
1186 
1187 static inline int security_task_setioprio(struct task_struct *p, int ioprio)
1188 {
1189 	return cap_task_setioprio(p, ioprio);
1190 }
1191 
1192 static inline int security_task_getioprio(struct task_struct *p)
1193 {
1194 	return 0;
1195 }
1196 
1197 static inline int security_task_prlimit(const struct cred *cred,
1198 					const struct cred *tcred,
1199 					unsigned int flags)
1200 {
1201 	return 0;
1202 }
1203 
1204 static inline int security_task_setrlimit(struct task_struct *p,
1205 					  unsigned int resource,
1206 					  struct rlimit *new_rlim)
1207 {
1208 	return 0;
1209 }
1210 
1211 static inline int security_task_setscheduler(struct task_struct *p)
1212 {
1213 	return cap_task_setscheduler(p);
1214 }
1215 
1216 static inline int security_task_getscheduler(struct task_struct *p)
1217 {
1218 	return 0;
1219 }
1220 
1221 static inline int security_task_movememory(struct task_struct *p)
1222 {
1223 	return 0;
1224 }
1225 
1226 static inline int security_task_kill(struct task_struct *p,
1227 				     struct kernel_siginfo *info, int sig,
1228 				     const struct cred *cred)
1229 {
1230 	return 0;
1231 }
1232 
1233 static inline int security_task_prctl(int option, unsigned long arg2,
1234 				      unsigned long arg3,
1235 				      unsigned long arg4,
1236 				      unsigned long arg5)
1237 {
1238 	return cap_task_prctl(option, arg2, arg3, arg4, arg5);
1239 }
1240 
1241 static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
1242 { }
1243 
1244 static inline int security_create_user_ns(const struct cred *cred)
1245 {
1246 	return 0;
1247 }
1248 
1249 static inline int security_ipc_permission(struct kern_ipc_perm *ipcp,
1250 					  short flag)
1251 {
1252 	return 0;
1253 }
1254 
1255 static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
1256 {
1257 	*secid = 0;
1258 }
1259 
1260 static inline int security_msg_msg_alloc(struct msg_msg *msg)
1261 {
1262 	return 0;
1263 }
1264 
1265 static inline void security_msg_msg_free(struct msg_msg *msg)
1266 { }
1267 
1268 static inline int security_msg_queue_alloc(struct kern_ipc_perm *msq)
1269 {
1270 	return 0;
1271 }
1272 
1273 static inline void security_msg_queue_free(struct kern_ipc_perm *msq)
1274 { }
1275 
1276 static inline int security_msg_queue_associate(struct kern_ipc_perm *msq,
1277 					       int msqflg)
1278 {
1279 	return 0;
1280 }
1281 
1282 static inline int security_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd)
1283 {
1284 	return 0;
1285 }
1286 
1287 static inline int security_msg_queue_msgsnd(struct kern_ipc_perm *msq,
1288 					    struct msg_msg *msg, int msqflg)
1289 {
1290 	return 0;
1291 }
1292 
1293 static inline int security_msg_queue_msgrcv(struct kern_ipc_perm *msq,
1294 					    struct msg_msg *msg,
1295 					    struct task_struct *target,
1296 					    long type, int mode)
1297 {
1298 	return 0;
1299 }
1300 
1301 static inline int security_shm_alloc(struct kern_ipc_perm *shp)
1302 {
1303 	return 0;
1304 }
1305 
1306 static inline void security_shm_free(struct kern_ipc_perm *shp)
1307 { }
1308 
1309 static inline int security_shm_associate(struct kern_ipc_perm *shp,
1310 					 int shmflg)
1311 {
1312 	return 0;
1313 }
1314 
1315 static inline int security_shm_shmctl(struct kern_ipc_perm *shp, int cmd)
1316 {
1317 	return 0;
1318 }
1319 
1320 static inline int security_shm_shmat(struct kern_ipc_perm *shp,
1321 				     char __user *shmaddr, int shmflg)
1322 {
1323 	return 0;
1324 }
1325 
1326 static inline int security_sem_alloc(struct kern_ipc_perm *sma)
1327 {
1328 	return 0;
1329 }
1330 
1331 static inline void security_sem_free(struct kern_ipc_perm *sma)
1332 { }
1333 
1334 static inline int security_sem_associate(struct kern_ipc_perm *sma, int semflg)
1335 {
1336 	return 0;
1337 }
1338 
1339 static inline int security_sem_semctl(struct kern_ipc_perm *sma, int cmd)
1340 {
1341 	return 0;
1342 }
1343 
1344 static inline int security_sem_semop(struct kern_ipc_perm *sma,
1345 				     struct sembuf *sops, unsigned nsops,
1346 				     int alter)
1347 {
1348 	return 0;
1349 }
1350 
1351 static inline void security_d_instantiate(struct dentry *dentry,
1352 					  struct inode *inode)
1353 { }
1354 
1355 static inline int security_getselfattr(unsigned int attr,
1356 				       struct lsm_ctx __user *ctx,
1357 				       size_t __user *size, u32 flags)
1358 {
1359 	return -EOPNOTSUPP;
1360 }
1361 
1362 static inline int security_setselfattr(unsigned int attr,
1363 				       struct lsm_ctx __user *ctx,
1364 				       size_t size, u32 flags)
1365 {
1366 	return -EOPNOTSUPP;
1367 }
1368 
1369 static inline int security_getprocattr(struct task_struct *p, int lsmid,
1370 				       const char *name, char **value)
1371 {
1372 	return -EINVAL;
1373 }
1374 
1375 static inline int security_setprocattr(int lsmid, char *name, void *value,
1376 				       size_t size)
1377 {
1378 	return -EINVAL;
1379 }
1380 
1381 static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
1382 {
1383 	return 0;
1384 }
1385 
1386 static inline int security_ismaclabel(const char *name)
1387 {
1388 	return 0;
1389 }
1390 
1391 static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
1392 {
1393 	return -EOPNOTSUPP;
1394 }
1395 
1396 static inline int security_secctx_to_secid(const char *secdata,
1397 					   u32 seclen,
1398 					   u32 *secid)
1399 {
1400 	return -EOPNOTSUPP;
1401 }
1402 
1403 static inline void security_release_secctx(char *secdata, u32 seclen)
1404 {
1405 }
1406 
1407 static inline void security_inode_invalidate_secctx(struct inode *inode)
1408 {
1409 }
1410 
1411 static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen)
1412 {
1413 	return -EOPNOTSUPP;
1414 }
1415 static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
1416 {
1417 	return -EOPNOTSUPP;
1418 }
1419 static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
1420 {
1421 	return -EOPNOTSUPP;
1422 }
1423 static inline int security_locked_down(enum lockdown_reason what)
1424 {
1425 	return 0;
1426 }
1427 static inline int lsm_fill_user_ctx(struct lsm_ctx __user *ctx, void *context,
1428 				    size_t context_size, u64 id, u64 flags)
1429 {
1430 	return -EOPNOTSUPP;
1431 }
1432 #endif	/* CONFIG_SECURITY */
1433 
1434 #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
1435 int security_post_notification(const struct cred *w_cred,
1436 			       const struct cred *cred,
1437 			       struct watch_notification *n);
1438 #else
1439 static inline int security_post_notification(const struct cred *w_cred,
1440 					     const struct cred *cred,
1441 					     struct watch_notification *n)
1442 {
1443 	return 0;
1444 }
1445 #endif
1446 
1447 #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS)
1448 int security_watch_key(struct key *key);
1449 #else
1450 static inline int security_watch_key(struct key *key)
1451 {
1452 	return 0;
1453 }
1454 #endif
1455 
1456 #ifdef CONFIG_SECURITY_NETWORK
1457 
1458 int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
1459 int security_unix_may_send(struct socket *sock,  struct socket *other);
1460 int security_socket_create(int family, int type, int protocol, int kern);
1461 int security_socket_post_create(struct socket *sock, int family,
1462 				int type, int protocol, int kern);
1463 int security_socket_socketpair(struct socket *socka, struct socket *sockb);
1464 int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen);
1465 int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
1466 int security_socket_listen(struct socket *sock, int backlog);
1467 int security_socket_accept(struct socket *sock, struct socket *newsock);
1468 int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
1469 int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
1470 			    int size, int flags);
1471 int security_socket_getsockname(struct socket *sock);
1472 int security_socket_getpeername(struct socket *sock);
1473 int security_socket_getsockopt(struct socket *sock, int level, int optname);
1474 int security_socket_setsockopt(struct socket *sock, int level, int optname);
1475 int security_socket_shutdown(struct socket *sock, int how);
1476 int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb);
1477 int security_socket_getpeersec_stream(struct socket *sock, sockptr_t optval,
1478 				      sockptr_t optlen, unsigned int len);
1479 int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid);
1480 int security_sk_alloc(struct sock *sk, int family, gfp_t priority);
1481 void security_sk_free(struct sock *sk);
1482 void security_sk_clone(const struct sock *sk, struct sock *newsk);
1483 void security_sk_classify_flow(const struct sock *sk,
1484 			       struct flowi_common *flic);
1485 void security_req_classify_flow(const struct request_sock *req,
1486 				struct flowi_common *flic);
1487 void security_sock_graft(struct sock*sk, struct socket *parent);
1488 int security_inet_conn_request(const struct sock *sk,
1489 			struct sk_buff *skb, struct request_sock *req);
1490 void security_inet_csk_clone(struct sock *newsk,
1491 			const struct request_sock *req);
1492 void security_inet_conn_established(struct sock *sk,
1493 			struct sk_buff *skb);
1494 int security_secmark_relabel_packet(u32 secid);
1495 void security_secmark_refcount_inc(void);
1496 void security_secmark_refcount_dec(void);
1497 int security_tun_dev_alloc_security(void **security);
1498 void security_tun_dev_free_security(void *security);
1499 int security_tun_dev_create(void);
1500 int security_tun_dev_attach_queue(void *security);
1501 int security_tun_dev_attach(struct sock *sk, void *security);
1502 int security_tun_dev_open(void *security);
1503 int security_sctp_assoc_request(struct sctp_association *asoc, struct sk_buff *skb);
1504 int security_sctp_bind_connect(struct sock *sk, int optname,
1505 			       struct sockaddr *address, int addrlen);
1506 void security_sctp_sk_clone(struct sctp_association *asoc, struct sock *sk,
1507 			    struct sock *newsk);
1508 int security_sctp_assoc_established(struct sctp_association *asoc,
1509 				    struct sk_buff *skb);
1510 int security_mptcp_add_subflow(struct sock *sk, struct sock *ssk);
1511 
1512 #else	/* CONFIG_SECURITY_NETWORK */
1513 static inline int security_unix_stream_connect(struct sock *sock,
1514 					       struct sock *other,
1515 					       struct sock *newsk)
1516 {
1517 	return 0;
1518 }
1519 
1520 static inline int security_unix_may_send(struct socket *sock,
1521 					 struct socket *other)
1522 {
1523 	return 0;
1524 }
1525 
1526 static inline int security_socket_create(int family, int type,
1527 					 int protocol, int kern)
1528 {
1529 	return 0;
1530 }
1531 
1532 static inline int security_socket_post_create(struct socket *sock,
1533 					      int family,
1534 					      int type,
1535 					      int protocol, int kern)
1536 {
1537 	return 0;
1538 }
1539 
1540 static inline int security_socket_socketpair(struct socket *socka,
1541 					     struct socket *sockb)
1542 {
1543 	return 0;
1544 }
1545 
1546 static inline int security_socket_bind(struct socket *sock,
1547 				       struct sockaddr *address,
1548 				       int addrlen)
1549 {
1550 	return 0;
1551 }
1552 
1553 static inline int security_socket_connect(struct socket *sock,
1554 					  struct sockaddr *address,
1555 					  int addrlen)
1556 {
1557 	return 0;
1558 }
1559 
1560 static inline int security_socket_listen(struct socket *sock, int backlog)
1561 {
1562 	return 0;
1563 }
1564 
1565 static inline int security_socket_accept(struct socket *sock,
1566 					 struct socket *newsock)
1567 {
1568 	return 0;
1569 }
1570 
1571 static inline int security_socket_sendmsg(struct socket *sock,
1572 					  struct msghdr *msg, int size)
1573 {
1574 	return 0;
1575 }
1576 
1577 static inline int security_socket_recvmsg(struct socket *sock,
1578 					  struct msghdr *msg, int size,
1579 					  int flags)
1580 {
1581 	return 0;
1582 }
1583 
1584 static inline int security_socket_getsockname(struct socket *sock)
1585 {
1586 	return 0;
1587 }
1588 
1589 static inline int security_socket_getpeername(struct socket *sock)
1590 {
1591 	return 0;
1592 }
1593 
1594 static inline int security_socket_getsockopt(struct socket *sock,
1595 					     int level, int optname)
1596 {
1597 	return 0;
1598 }
1599 
1600 static inline int security_socket_setsockopt(struct socket *sock,
1601 					     int level, int optname)
1602 {
1603 	return 0;
1604 }
1605 
1606 static inline int security_socket_shutdown(struct socket *sock, int how)
1607 {
1608 	return 0;
1609 }
1610 static inline int security_sock_rcv_skb(struct sock *sk,
1611 					struct sk_buff *skb)
1612 {
1613 	return 0;
1614 }
1615 
1616 static inline int security_socket_getpeersec_stream(struct socket *sock,
1617 						    sockptr_t optval,
1618 						    sockptr_t optlen,
1619 						    unsigned int len)
1620 {
1621 	return -ENOPROTOOPT;
1622 }
1623 
1624 static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
1625 {
1626 	return -ENOPROTOOPT;
1627 }
1628 
1629 static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
1630 {
1631 	return 0;
1632 }
1633 
1634 static inline void security_sk_free(struct sock *sk)
1635 {
1636 }
1637 
1638 static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
1639 {
1640 }
1641 
1642 static inline void security_sk_classify_flow(const struct sock *sk,
1643 					     struct flowi_common *flic)
1644 {
1645 }
1646 
1647 static inline void security_req_classify_flow(const struct request_sock *req,
1648 					      struct flowi_common *flic)
1649 {
1650 }
1651 
1652 static inline void security_sock_graft(struct sock *sk, struct socket *parent)
1653 {
1654 }
1655 
1656 static inline int security_inet_conn_request(const struct sock *sk,
1657 			struct sk_buff *skb, struct request_sock *req)
1658 {
1659 	return 0;
1660 }
1661 
1662 static inline void security_inet_csk_clone(struct sock *newsk,
1663 			const struct request_sock *req)
1664 {
1665 }
1666 
1667 static inline void security_inet_conn_established(struct sock *sk,
1668 			struct sk_buff *skb)
1669 {
1670 }
1671 
1672 static inline int security_secmark_relabel_packet(u32 secid)
1673 {
1674 	return 0;
1675 }
1676 
1677 static inline void security_secmark_refcount_inc(void)
1678 {
1679 }
1680 
1681 static inline void security_secmark_refcount_dec(void)
1682 {
1683 }
1684 
1685 static inline int security_tun_dev_alloc_security(void **security)
1686 {
1687 	return 0;
1688 }
1689 
1690 static inline void security_tun_dev_free_security(void *security)
1691 {
1692 }
1693 
1694 static inline int security_tun_dev_create(void)
1695 {
1696 	return 0;
1697 }
1698 
1699 static inline int security_tun_dev_attach_queue(void *security)
1700 {
1701 	return 0;
1702 }
1703 
1704 static inline int security_tun_dev_attach(struct sock *sk, void *security)
1705 {
1706 	return 0;
1707 }
1708 
1709 static inline int security_tun_dev_open(void *security)
1710 {
1711 	return 0;
1712 }
1713 
1714 static inline int security_sctp_assoc_request(struct sctp_association *asoc,
1715 					      struct sk_buff *skb)
1716 {
1717 	return 0;
1718 }
1719 
1720 static inline int security_sctp_bind_connect(struct sock *sk, int optname,
1721 					     struct sockaddr *address,
1722 					     int addrlen)
1723 {
1724 	return 0;
1725 }
1726 
1727 static inline void security_sctp_sk_clone(struct sctp_association *asoc,
1728 					  struct sock *sk,
1729 					  struct sock *newsk)
1730 {
1731 }
1732 
1733 static inline int security_sctp_assoc_established(struct sctp_association *asoc,
1734 						  struct sk_buff *skb)
1735 {
1736 	return 0;
1737 }
1738 
1739 static inline int security_mptcp_add_subflow(struct sock *sk, struct sock *ssk)
1740 {
1741 	return 0;
1742 }
1743 #endif	/* CONFIG_SECURITY_NETWORK */
1744 
1745 #ifdef CONFIG_SECURITY_INFINIBAND
1746 int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey);
1747 int security_ib_endport_manage_subnet(void *sec, const char *name, u8 port_num);
1748 int security_ib_alloc_security(void **sec);
1749 void security_ib_free_security(void *sec);
1750 #else	/* CONFIG_SECURITY_INFINIBAND */
1751 static inline int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey)
1752 {
1753 	return 0;
1754 }
1755 
1756 static inline int security_ib_endport_manage_subnet(void *sec, const char *dev_name, u8 port_num)
1757 {
1758 	return 0;
1759 }
1760 
1761 static inline int security_ib_alloc_security(void **sec)
1762 {
1763 	return 0;
1764 }
1765 
1766 static inline void security_ib_free_security(void *sec)
1767 {
1768 }
1769 #endif	/* CONFIG_SECURITY_INFINIBAND */
1770 
1771 #ifdef CONFIG_SECURITY_NETWORK_XFRM
1772 
1773 int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
1774 			       struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp);
1775 int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
1776 void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
1777 int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
1778 int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1779 int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
1780 				      struct xfrm_sec_ctx *polsec, u32 secid);
1781 int security_xfrm_state_delete(struct xfrm_state *x);
1782 void security_xfrm_state_free(struct xfrm_state *x);
1783 int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid);
1784 int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
1785 				       struct xfrm_policy *xp,
1786 				       const struct flowi_common *flic);
1787 int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
1788 void security_skb_classify_flow(struct sk_buff *skb, struct flowi_common *flic);
1789 
1790 #else	/* CONFIG_SECURITY_NETWORK_XFRM */
1791 
1792 static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
1793 					     struct xfrm_user_sec_ctx *sec_ctx,
1794 					     gfp_t gfp)
1795 {
1796 	return 0;
1797 }
1798 
1799 static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
1800 {
1801 	return 0;
1802 }
1803 
1804 static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
1805 {
1806 }
1807 
1808 static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
1809 {
1810 	return 0;
1811 }
1812 
1813 static inline int security_xfrm_state_alloc(struct xfrm_state *x,
1814 					struct xfrm_user_sec_ctx *sec_ctx)
1815 {
1816 	return 0;
1817 }
1818 
1819 static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
1820 					struct xfrm_sec_ctx *polsec, u32 secid)
1821 {
1822 	return 0;
1823 }
1824 
1825 static inline void security_xfrm_state_free(struct xfrm_state *x)
1826 {
1827 }
1828 
1829 static inline int security_xfrm_state_delete(struct xfrm_state *x)
1830 {
1831 	return 0;
1832 }
1833 
1834 static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid)
1835 {
1836 	return 0;
1837 }
1838 
1839 static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
1840 						     struct xfrm_policy *xp,
1841 						     const struct flowi_common *flic)
1842 {
1843 	return 1;
1844 }
1845 
1846 static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
1847 {
1848 	return 0;
1849 }
1850 
1851 static inline void security_skb_classify_flow(struct sk_buff *skb,
1852 					      struct flowi_common *flic)
1853 {
1854 }
1855 
1856 #endif	/* CONFIG_SECURITY_NETWORK_XFRM */
1857 
1858 #ifdef CONFIG_SECURITY_PATH
1859 int security_path_unlink(const struct path *dir, struct dentry *dentry);
1860 int security_path_mkdir(const struct path *dir, struct dentry *dentry, umode_t mode);
1861 int security_path_rmdir(const struct path *dir, struct dentry *dentry);
1862 int security_path_mknod(const struct path *dir, struct dentry *dentry, umode_t mode,
1863 			unsigned int dev);
1864 int security_path_truncate(const struct path *path);
1865 int security_path_symlink(const struct path *dir, struct dentry *dentry,
1866 			  const char *old_name);
1867 int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
1868 		       struct dentry *new_dentry);
1869 int security_path_rename(const struct path *old_dir, struct dentry *old_dentry,
1870 			 const struct path *new_dir, struct dentry *new_dentry,
1871 			 unsigned int flags);
1872 int security_path_chmod(const struct path *path, umode_t mode);
1873 int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid);
1874 int security_path_chroot(const struct path *path);
1875 #else	/* CONFIG_SECURITY_PATH */
1876 static inline int security_path_unlink(const struct path *dir, struct dentry *dentry)
1877 {
1878 	return 0;
1879 }
1880 
1881 static inline int security_path_mkdir(const struct path *dir, struct dentry *dentry,
1882 				      umode_t mode)
1883 {
1884 	return 0;
1885 }
1886 
1887 static inline int security_path_rmdir(const struct path *dir, struct dentry *dentry)
1888 {
1889 	return 0;
1890 }
1891 
1892 static inline int security_path_mknod(const struct path *dir, struct dentry *dentry,
1893 				      umode_t mode, unsigned int dev)
1894 {
1895 	return 0;
1896 }
1897 
1898 static inline int security_path_truncate(const struct path *path)
1899 {
1900 	return 0;
1901 }
1902 
1903 static inline int security_path_symlink(const struct path *dir, struct dentry *dentry,
1904 					const char *old_name)
1905 {
1906 	return 0;
1907 }
1908 
1909 static inline int security_path_link(struct dentry *old_dentry,
1910 				     const struct path *new_dir,
1911 				     struct dentry *new_dentry)
1912 {
1913 	return 0;
1914 }
1915 
1916 static inline int security_path_rename(const struct path *old_dir,
1917 				       struct dentry *old_dentry,
1918 				       const struct path *new_dir,
1919 				       struct dentry *new_dentry,
1920 				       unsigned int flags)
1921 {
1922 	return 0;
1923 }
1924 
1925 static inline int security_path_chmod(const struct path *path, umode_t mode)
1926 {
1927 	return 0;
1928 }
1929 
1930 static inline int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
1931 {
1932 	return 0;
1933 }
1934 
1935 static inline int security_path_chroot(const struct path *path)
1936 {
1937 	return 0;
1938 }
1939 #endif	/* CONFIG_SECURITY_PATH */
1940 
1941 #ifdef CONFIG_KEYS
1942 #ifdef CONFIG_SECURITY
1943 
1944 int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
1945 void security_key_free(struct key *key);
1946 int security_key_permission(key_ref_t key_ref, const struct cred *cred,
1947 			    enum key_need_perm need_perm);
1948 int security_key_getsecurity(struct key *key, char **_buffer);
1949 
1950 #else
1951 
1952 static inline int security_key_alloc(struct key *key,
1953 				     const struct cred *cred,
1954 				     unsigned long flags)
1955 {
1956 	return 0;
1957 }
1958 
1959 static inline void security_key_free(struct key *key)
1960 {
1961 }
1962 
1963 static inline int security_key_permission(key_ref_t key_ref,
1964 					  const struct cred *cred,
1965 					  enum key_need_perm need_perm)
1966 {
1967 	return 0;
1968 }
1969 
1970 static inline int security_key_getsecurity(struct key *key, char **_buffer)
1971 {
1972 	*_buffer = NULL;
1973 	return 0;
1974 }
1975 
1976 #endif
1977 #endif /* CONFIG_KEYS */
1978 
1979 #ifdef CONFIG_AUDIT
1980 #ifdef CONFIG_SECURITY
1981 int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
1982 int security_audit_rule_known(struct audit_krule *krule);
1983 int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule);
1984 void security_audit_rule_free(void *lsmrule);
1985 
1986 #else
1987 
1988 static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr,
1989 					   void **lsmrule)
1990 {
1991 	return 0;
1992 }
1993 
1994 static inline int security_audit_rule_known(struct audit_krule *krule)
1995 {
1996 	return 0;
1997 }
1998 
1999 static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
2000 					    void *lsmrule)
2001 {
2002 	return 0;
2003 }
2004 
2005 static inline void security_audit_rule_free(void *lsmrule)
2006 { }
2007 
2008 #endif /* CONFIG_SECURITY */
2009 #endif /* CONFIG_AUDIT */
2010 
2011 #ifdef CONFIG_SECURITYFS
2012 
2013 extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
2014 					     struct dentry *parent, void *data,
2015 					     const struct file_operations *fops);
2016 extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
2017 struct dentry *securityfs_create_symlink(const char *name,
2018 					 struct dentry *parent,
2019 					 const char *target,
2020 					 const struct inode_operations *iops);
2021 extern void securityfs_remove(struct dentry *dentry);
2022 
2023 #else /* CONFIG_SECURITYFS */
2024 
2025 static inline struct dentry *securityfs_create_dir(const char *name,
2026 						   struct dentry *parent)
2027 {
2028 	return ERR_PTR(-ENODEV);
2029 }
2030 
2031 static inline struct dentry *securityfs_create_file(const char *name,
2032 						    umode_t mode,
2033 						    struct dentry *parent,
2034 						    void *data,
2035 						    const struct file_operations *fops)
2036 {
2037 	return ERR_PTR(-ENODEV);
2038 }
2039 
2040 static inline struct dentry *securityfs_create_symlink(const char *name,
2041 					struct dentry *parent,
2042 					const char *target,
2043 					const struct inode_operations *iops)
2044 {
2045 	return ERR_PTR(-ENODEV);
2046 }
2047 
2048 static inline void securityfs_remove(struct dentry *dentry)
2049 {}
2050 
2051 #endif
2052 
2053 #ifdef CONFIG_BPF_SYSCALL
2054 union bpf_attr;
2055 struct bpf_map;
2056 struct bpf_prog;
2057 struct bpf_prog_aux;
2058 #ifdef CONFIG_SECURITY
2059 extern int security_bpf(int cmd, union bpf_attr *attr, unsigned int size);
2060 extern int security_bpf_map(struct bpf_map *map, fmode_t fmode);
2061 extern int security_bpf_prog(struct bpf_prog *prog);
2062 extern int security_bpf_map_alloc(struct bpf_map *map);
2063 extern void security_bpf_map_free(struct bpf_map *map);
2064 extern int security_bpf_prog_alloc(struct bpf_prog_aux *aux);
2065 extern void security_bpf_prog_free(struct bpf_prog_aux *aux);
2066 #else
2067 static inline int security_bpf(int cmd, union bpf_attr *attr,
2068 					     unsigned int size)
2069 {
2070 	return 0;
2071 }
2072 
2073 static inline int security_bpf_map(struct bpf_map *map, fmode_t fmode)
2074 {
2075 	return 0;
2076 }
2077 
2078 static inline int security_bpf_prog(struct bpf_prog *prog)
2079 {
2080 	return 0;
2081 }
2082 
2083 static inline int security_bpf_map_alloc(struct bpf_map *map)
2084 {
2085 	return 0;
2086 }
2087 
2088 static inline void security_bpf_map_free(struct bpf_map *map)
2089 { }
2090 
2091 static inline int security_bpf_prog_alloc(struct bpf_prog_aux *aux)
2092 {
2093 	return 0;
2094 }
2095 
2096 static inline void security_bpf_prog_free(struct bpf_prog_aux *aux)
2097 { }
2098 #endif /* CONFIG_SECURITY */
2099 #endif /* CONFIG_BPF_SYSCALL */
2100 
2101 #ifdef CONFIG_PERF_EVENTS
2102 struct perf_event_attr;
2103 struct perf_event;
2104 
2105 #ifdef CONFIG_SECURITY
2106 extern int security_perf_event_open(struct perf_event_attr *attr, int type);
2107 extern int security_perf_event_alloc(struct perf_event *event);
2108 extern void security_perf_event_free(struct perf_event *event);
2109 extern int security_perf_event_read(struct perf_event *event);
2110 extern int security_perf_event_write(struct perf_event *event);
2111 #else
2112 static inline int security_perf_event_open(struct perf_event_attr *attr,
2113 					   int type)
2114 {
2115 	return 0;
2116 }
2117 
2118 static inline int security_perf_event_alloc(struct perf_event *event)
2119 {
2120 	return 0;
2121 }
2122 
2123 static inline void security_perf_event_free(struct perf_event *event)
2124 {
2125 }
2126 
2127 static inline int security_perf_event_read(struct perf_event *event)
2128 {
2129 	return 0;
2130 }
2131 
2132 static inline int security_perf_event_write(struct perf_event *event)
2133 {
2134 	return 0;
2135 }
2136 #endif /* CONFIG_SECURITY */
2137 #endif /* CONFIG_PERF_EVENTS */
2138 
2139 #ifdef CONFIG_IO_URING
2140 #ifdef CONFIG_SECURITY
2141 extern int security_uring_override_creds(const struct cred *new);
2142 extern int security_uring_sqpoll(void);
2143 extern int security_uring_cmd(struct io_uring_cmd *ioucmd);
2144 #else
2145 static inline int security_uring_override_creds(const struct cred *new)
2146 {
2147 	return 0;
2148 }
2149 static inline int security_uring_sqpoll(void)
2150 {
2151 	return 0;
2152 }
2153 static inline int security_uring_cmd(struct io_uring_cmd *ioucmd)
2154 {
2155 	return 0;
2156 }
2157 #endif /* CONFIG_SECURITY */
2158 #endif /* CONFIG_IO_URING */
2159 
2160 #endif /* ! __LINUX_SECURITY_H */
2161