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