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