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