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