Commit | Line | Data |
---|---|---|
98e828a0 KS |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | ||
3 | /* | |
4 | * Linux Security Module Hook declarations. | |
5 | * | |
6 | * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> | |
7 | * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com> | |
8 | * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> | |
9 | * Copyright (C) 2001 James Morris <jmorris@intercode.com.au> | |
10 | * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) | |
11 | * Copyright (C) 2015 Intel Corporation. | |
12 | * Copyright (C) 2015 Casey Schaufler <casey@schaufler-ca.com> | |
13 | * Copyright (C) 2016 Mellanox Techonologies | |
14 | * Copyright (C) 2020 Google LLC. | |
15 | */ | |
16 | ||
17 | /* | |
bb22d80b | 18 | * The macro LSM_HOOK is used to define the data structures required by |
98e828a0 KS |
19 | * the LSM framework using the pattern: |
20 | * | |
21 | * LSM_HOOK(<return_type>, <default_value>, <hook_name>, args...) | |
22 | * | |
23 | * struct security_hook_heads { | |
24 | * #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME; | |
25 | * #include <linux/lsm_hook_defs.h> | |
26 | * #undef LSM_HOOK | |
27 | * }; | |
28 | */ | |
52f88693 TK |
29 | LSM_HOOK(int, 0, binder_set_context_mgr, const struct cred *mgr) |
30 | LSM_HOOK(int, 0, binder_transaction, const struct cred *from, | |
31 | const struct cred *to) | |
32 | LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from, | |
33 | const struct cred *to) | |
34 | LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from, | |
35 | const struct cred *to, struct file *file) | |
98e828a0 KS |
36 | LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child, |
37 | unsigned int mode) | |
38 | LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent) | |
39 | LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective, | |
40 | kernel_cap_t *inheritable, kernel_cap_t *permitted) | |
41 | LSM_HOOK(int, 0, capset, struct cred *new, const struct cred *old, | |
42 | const kernel_cap_t *effective, const kernel_cap_t *inheritable, | |
43 | const kernel_cap_t *permitted) | |
44 | LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns, | |
45 | int cap, unsigned int opts) | |
46 | LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb) | |
47 | LSM_HOOK(int, 0, quota_on, struct dentry *dentry) | |
48 | LSM_HOOK(int, 0, syslog, int type) | |
49 | LSM_HOOK(int, 0, settime, const struct timespec64 *ts, | |
50 | const struct timezone *tz) | |
51 | LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages) | |
b8bff599 | 52 | LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm) |
56305aa9 | 53 | LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, struct file *file) |
98e828a0 KS |
54 | LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm) |
55 | LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) | |
56 | LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm) | |
57 | LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, | |
58 | struct fs_context *src_sc) | |
54261af4 | 59 | LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc, |
98e828a0 KS |
60 | struct fs_parameter *param) |
61 | LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb) | |
83e804f0 | 62 | LSM_HOOK(void, LSM_RET_VOID, sb_delete, struct super_block *sb) |
98e828a0 KS |
63 | LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb) |
64 | LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts) | |
65 | LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts) | |
69c4a42d | 66 | LSM_HOOK(int, 0, sb_mnt_opts_compat, struct super_block *sb, void *mnt_opts) |
98e828a0 KS |
67 | LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts) |
68 | LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb) | |
69 | LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb) | |
70 | LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry) | |
71 | LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path, | |
72 | const char *type, unsigned long flags, void *data) | |
73 | LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags) | |
74 | LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path, | |
75 | const struct path *new_path) | |
76 | LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts, | |
77 | unsigned long kern_flags, unsigned long *set_kern_flags) | |
78 | LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, | |
79 | struct super_block *newsb, unsigned long kern_flags, | |
80 | unsigned long *set_kern_flags) | |
98e828a0 KS |
81 | LSM_HOOK(int, 0, move_mount, const struct path *from_path, |
82 | const struct path *to_path) | |
7f5056b9 | 83 | LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry, |
15bf3239 VG |
84 | int mode, const struct qstr *name, const char **xattr_name, |
85 | void **ctx, u32 *ctxlen) | |
98e828a0 KS |
86 | LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, |
87 | struct qstr *name, const struct cred *old, struct cred *new) | |
88 | ||
89 | #ifdef CONFIG_SECURITY_PATH | |
90 | LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry) | |
91 | LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry, | |
92 | umode_t mode) | |
93 | LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry) | |
94 | LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry, | |
95 | umode_t mode, unsigned int dev) | |
96 | LSM_HOOK(int, 0, path_truncate, const struct path *path) | |
97 | LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry, | |
98 | const char *old_name) | |
99 | LSM_HOOK(int, 0, path_link, struct dentry *old_dentry, | |
100 | const struct path *new_dir, struct dentry *new_dentry) | |
101 | LSM_HOOK(int, 0, path_rename, const struct path *old_dir, | |
102 | struct dentry *old_dentry, const struct path *new_dir, | |
103 | struct dentry *new_dentry) | |
104 | LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode) | |
105 | LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid) | |
106 | LSM_HOOK(int, 0, path_chroot, const struct path *path) | |
107 | #endif /* CONFIG_SECURITY_PATH */ | |
108 | ||
109 | /* Needed for inode based security check */ | |
110 | LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask, | |
111 | unsigned int obj_type) | |
112 | LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode) | |
113 | LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode) | |
114 | LSM_HOOK(int, 0, inode_init_security, struct inode *inode, | |
115 | struct inode *dir, const struct qstr *qstr, const char **name, | |
116 | void **value, size_t *len) | |
215b674b LG |
117 | LSM_HOOK(int, 0, inode_init_security_anon, struct inode *inode, |
118 | const struct qstr *name, const struct inode *context_inode) | |
98e828a0 KS |
119 | LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry, |
120 | umode_t mode) | |
121 | LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir, | |
122 | struct dentry *new_dentry) | |
123 | LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry) | |
124 | LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry, | |
125 | const char *old_name) | |
126 | LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry, | |
127 | umode_t mode) | |
128 | LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry) | |
129 | LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry, | |
130 | umode_t mode, dev_t dev) | |
131 | LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry, | |
132 | struct inode *new_dir, struct dentry *new_dentry) | |
133 | LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry) | |
134 | LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode, | |
135 | bool rcu) | |
136 | LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask) | |
137 | LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr) | |
138 | LSM_HOOK(int, 0, inode_getattr, const struct path *path) | |
71bc356f CB |
139 | LSM_HOOK(int, 0, inode_setxattr, struct user_namespace *mnt_userns, |
140 | struct dentry *dentry, const char *name, const void *value, | |
141 | size_t size, int flags) | |
98e828a0 KS |
142 | LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry, |
143 | const char *name, const void *value, size_t size, int flags) | |
144 | LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name) | |
145 | LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry) | |
71bc356f CB |
146 | LSM_HOOK(int, 0, inode_removexattr, struct user_namespace *mnt_userns, |
147 | struct dentry *dentry, const char *name) | |
98e828a0 | 148 | LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry) |
71bc356f CB |
149 | LSM_HOOK(int, 0, inode_killpriv, struct user_namespace *mnt_userns, |
150 | struct dentry *dentry) | |
151 | LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct user_namespace *mnt_userns, | |
152 | struct inode *inode, const char *name, void **buffer, bool alloc) | |
98e828a0 KS |
153 | LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode, |
154 | const char *name, const void *value, size_t size, int flags) | |
155 | LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer, | |
156 | size_t buffer_size) | |
157 | LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid) | |
158 | LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new) | |
23e390cd | 159 | LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, const char *name) |
98e828a0 KS |
160 | LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir, |
161 | struct kernfs_node *kn) | |
162 | LSM_HOOK(int, 0, file_permission, struct file *file, int mask) | |
163 | LSM_HOOK(int, 0, file_alloc_security, struct file *file) | |
164 | LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) | |
165 | LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, | |
166 | unsigned long arg) | |
167 | LSM_HOOK(int, 0, mmap_addr, unsigned long addr) | |
168 | LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, | |
169 | unsigned long prot, unsigned long flags) | |
170 | LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma, | |
171 | unsigned long reqprot, unsigned long prot) | |
172 | LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd) | |
173 | LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd, | |
174 | unsigned long arg) | |
175 | LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file) | |
176 | LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk, | |
177 | struct fown_struct *fown, int sig) | |
178 | LSM_HOOK(int, 0, file_receive, struct file *file) | |
179 | LSM_HOOK(int, 0, file_open, struct file *file) | |
180 | LSM_HOOK(int, 0, task_alloc, struct task_struct *task, | |
181 | unsigned long clone_flags) | |
182 | LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) | |
183 | LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) | |
184 | LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) | |
185 | LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old, | |
186 | gfp_t gfp) | |
187 | LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new, | |
188 | const struct cred *old) | |
189 | LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid) | |
190 | LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid) | |
191 | LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) | |
192 | LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) | |
b64fcae7 KC |
193 | LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents) |
194 | LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size, | |
200da27a | 195 | enum kernel_load_data_id id, char *description) |
98e828a0 | 196 | LSM_HOOK(int, 0, kernel_read_file, struct file *file, |
2039bda1 | 197 | enum kernel_read_file_id id, bool contents) |
98e828a0 KS |
198 | LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, |
199 | loff_t size, enum kernel_read_file_id id) | |
200 | LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old, | |
201 | int flags) | |
39030e13 TC |
202 | LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old, |
203 | int flags) | |
98e828a0 KS |
204 | LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid) |
205 | LSM_HOOK(int, 0, task_getpgid, struct task_struct *p) | |
206 | LSM_HOOK(int, 0, task_getsid, struct task_struct *p) | |
6326948f | 207 | LSM_HOOK(void, LSM_RET_VOID, current_getsecid_subj, u32 *secid) |
4ebd7651 PM |
208 | LSM_HOOK(void, LSM_RET_VOID, task_getsecid_obj, |
209 | struct task_struct *p, u32 *secid) | |
98e828a0 KS |
210 | LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice) |
211 | LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio) | |
212 | LSM_HOOK(int, 0, task_getioprio, struct task_struct *p) | |
213 | LSM_HOOK(int, 0, task_prlimit, const struct cred *cred, | |
214 | const struct cred *tcred, unsigned int flags) | |
215 | LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource, | |
216 | struct rlimit *new_rlim) | |
217 | LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p) | |
218 | LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p) | |
219 | LSM_HOOK(int, 0, task_movememory, struct task_struct *p) | |
220 | LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info, | |
221 | int sig, const struct cred *cred) | |
222 | LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2, | |
223 | unsigned long arg3, unsigned long arg4, unsigned long arg5) | |
224 | LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p, | |
225 | struct inode *inode) | |
226 | LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag) | |
227 | LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp, | |
228 | u32 *secid) | |
229 | LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg) | |
230 | LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg) | |
231 | LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm) | |
232 | LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security, | |
233 | struct kern_ipc_perm *perm) | |
234 | LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg) | |
235 | LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd) | |
236 | LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm, | |
237 | struct msg_msg *msg, int msqflg) | |
238 | LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm, | |
239 | struct msg_msg *msg, struct task_struct *target, long type, int mode) | |
240 | LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm) | |
241 | LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm) | |
242 | LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg) | |
243 | LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd) | |
244 | LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr, | |
245 | int shmflg) | |
246 | LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm) | |
247 | LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm) | |
248 | LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg) | |
249 | LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd) | |
250 | LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops, | |
251 | unsigned nsops, int alter) | |
252 | LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb) | |
253 | LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry, | |
254 | struct inode *inode) | |
255 | LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name, | |
256 | char **value) | |
257 | LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) | |
258 | LSM_HOOK(int, 0, ismaclabel, const char *name) | |
625236ba | 259 | LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata, |
98e828a0 KS |
260 | u32 *seclen) |
261 | LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) | |
262 | LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen) | |
263 | LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) | |
264 | LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) | |
265 | LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) | |
266 | LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx, | |
267 | u32 *ctxlen) | |
268 | ||
344fa64e DH |
269 | #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) |
270 | LSM_HOOK(int, 0, post_notification, const struct cred *w_cred, | |
271 | const struct cred *cred, struct watch_notification *n) | |
998f5040 DH |
272 | #endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */ |
273 | ||
274 | #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS) | |
275 | LSM_HOOK(int, 0, watch_key, struct key *key) | |
344fa64e DH |
276 | #endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */ |
277 | ||
98e828a0 KS |
278 | #ifdef CONFIG_SECURITY_NETWORK |
279 | LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other, | |
280 | struct sock *newsk) | |
281 | LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other) | |
282 | LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern) | |
283 | LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type, | |
284 | int protocol, int kern) | |
285 | LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb) | |
286 | LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address, | |
287 | int addrlen) | |
288 | LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address, | |
289 | int addrlen) | |
290 | LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog) | |
291 | LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock) | |
292 | LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg, | |
293 | int size) | |
294 | LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg, | |
295 | int size, int flags) | |
296 | LSM_HOOK(int, 0, socket_getsockname, struct socket *sock) | |
297 | LSM_HOOK(int, 0, socket_getpeername, struct socket *sock) | |
298 | LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) | |
299 | LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname) | |
300 | LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how) | |
301 | LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb) | |
302 | LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock, | |
303 | char __user *optval, int __user *optlen, unsigned len) | |
304 | LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock, | |
305 | struct sk_buff *skb, u32 *secid) | |
306 | LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority) | |
307 | LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk) | |
308 | LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk, | |
309 | struct sock *newsk) | |
310 | LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid) | |
311 | LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent) | |
41dd9596 | 312 | LSM_HOOK(int, 0, inet_conn_request, const struct sock *sk, struct sk_buff *skb, |
98e828a0 KS |
313 | struct request_sock *req) |
314 | LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk, | |
315 | const struct request_sock *req) | |
316 | LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk, | |
317 | struct sk_buff *skb) | |
318 | LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid) | |
319 | LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void) | |
320 | LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void) | |
321 | LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req, | |
3df98d79 | 322 | struct flowi_common *flic) |
98e828a0 KS |
323 | LSM_HOOK(int, 0, tun_dev_alloc_security, void **security) |
324 | LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security) | |
325 | LSM_HOOK(int, 0, tun_dev_create, void) | |
326 | LSM_HOOK(int, 0, tun_dev_attach_queue, void *security) | |
327 | LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security) | |
328 | LSM_HOOK(int, 0, tun_dev_open, void *security) | |
c081d53f | 329 | LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_association *asoc, |
98e828a0 KS |
330 | struct sk_buff *skb) |
331 | LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname, | |
332 | struct sockaddr *address, int addrlen) | |
c081d53f | 333 | LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_association *asoc, |
98e828a0 | 334 | struct sock *sk, struct sock *newsk) |
5e50f5d4 OM |
335 | LSM_HOOK(int, 0, sctp_assoc_established, struct sctp_association *asoc, |
336 | struct sk_buff *skb) | |
98e828a0 KS |
337 | #endif /* CONFIG_SECURITY_NETWORK */ |
338 | ||
339 | #ifdef CONFIG_SECURITY_INFINIBAND | |
340 | LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey) | |
341 | LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name, | |
342 | u8 port_num) | |
343 | LSM_HOOK(int, 0, ib_alloc_security, void **sec) | |
344 | LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec) | |
345 | #endif /* CONFIG_SECURITY_INFINIBAND */ | |
346 | ||
347 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | |
348 | LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp, | |
349 | struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp) | |
350 | LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx, | |
351 | struct xfrm_sec_ctx **new_ctx) | |
352 | LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security, | |
353 | struct xfrm_sec_ctx *ctx) | |
354 | LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx) | |
355 | LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x, | |
356 | struct xfrm_user_sec_ctx *sec_ctx) | |
357 | LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x, | |
358 | struct xfrm_sec_ctx *polsec, u32 secid) | |
359 | LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x) | |
360 | LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x) | |
8a922805 | 361 | LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid) |
98e828a0 | 362 | LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x, |
3df98d79 | 363 | struct xfrm_policy *xp, const struct flowi_common *flic) |
98e828a0 KS |
364 | LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid, |
365 | int ckall) | |
366 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | |
367 | ||
368 | /* key management security hooks */ | |
369 | #ifdef CONFIG_KEYS | |
370 | LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, | |
371 | unsigned long flags) | |
372 | LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) | |
373 | LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, | |
4bc799dc | 374 | enum key_need_perm need_perm) |
98e828a0 KS |
375 | LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer) |
376 | #endif /* CONFIG_KEYS */ | |
377 | ||
378 | #ifdef CONFIG_AUDIT | |
379 | LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr, | |
380 | void **lsmrule) | |
381 | LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule) | |
382 | LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule) | |
383 | LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule) | |
384 | #endif /* CONFIG_AUDIT */ | |
385 | ||
386 | #ifdef CONFIG_BPF_SYSCALL | |
387 | LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size) | |
388 | LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode) | |
389 | LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog) | |
390 | LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map) | |
391 | LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map) | |
392 | LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux) | |
393 | LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) | |
394 | #endif /* CONFIG_BPF_SYSCALL */ | |
395 | ||
396 | LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) | |
397 | ||
398 | #ifdef CONFIG_PERF_EVENTS | |
399 | LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) | |
400 | LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event) | |
401 | LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event) | |
402 | LSM_HOOK(int, 0, perf_event_read, struct perf_event *event) | |
403 | LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) | |
404 | #endif /* CONFIG_PERF_EVENTS */ | |
cdc1404a PM |
405 | |
406 | #ifdef CONFIG_IO_URING | |
407 | LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) | |
408 | LSM_HOOK(int, 0, uring_sqpoll, void) | |
409 | #endif /* CONFIG_IO_URING */ |