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