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