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