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