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