blob: 6791813cd439c085ea9703d30b176fc08147f9b0 [file] [log] [blame]
KP Singh98e828a2020-03-29 01:43:50 +01001/* 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/*
18 * The macro LSM_HOOK is used to define the data structures required by the
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 */
29LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr)
30LSM_HOOK(int, 0, binder_transaction, struct task_struct *from,
31 struct task_struct *to)
32LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from,
33 struct task_struct *to)
34LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from,
35 struct task_struct *to, struct file *file)
36LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
37 unsigned int mode)
38LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
39LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective,
40 kernel_cap_t *inheritable, kernel_cap_t *permitted)
41LSM_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)
44LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns,
45 int cap, unsigned int opts)
46LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb)
47LSM_HOOK(int, 0, quota_on, struct dentry *dentry)
48LSM_HOOK(int, 0, syslog, int type)
49LSM_HOOK(int, 0, settime, const struct timespec64 *ts,
50 const struct timezone *tz)
51LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
Eric W. Biedermanb8bff592020-03-22 15:46:24 -050052LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm)
Eric W. Biederman56305aa2020-05-29 22:00:54 -050053LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, struct file *file)
KP Singh98e828a2020-03-29 01:43:50 +010054LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
55LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm)
56LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
57LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
58 struct fs_context *src_sc)
KP Singh54261af2020-04-30 17:52:40 +020059LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc,
KP Singh98e828a2020-03-29 01:43:50 +010060 struct fs_parameter *param)
61LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
62LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)
63LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts)
64LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts)
65LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts)
66LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb)
67LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb)
68LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry)
69LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path,
70 const char *type, unsigned long flags, void *data)
71LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags)
72LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path,
73 const struct path *new_path)
74LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts,
75 unsigned long kern_flags, unsigned long *set_kern_flags)
76LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb,
77 struct super_block *newsb, unsigned long kern_flags,
78 unsigned long *set_kern_flags)
79LSM_HOOK(int, 0, sb_add_mnt_opt, const char *option, const char *val,
80 int len, void **mnt_opts)
81LSM_HOOK(int, 0, move_mount, const struct path *from_path,
82 const struct path *to_path)
83LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry,
84 int mode, const struct qstr *name, void **ctx, u32 *ctxlen)
85LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
86 struct qstr *name, const struct cred *old, struct cred *new)
87
88#ifdef CONFIG_SECURITY_PATH
89LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
90LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry,
91 umode_t mode)
92LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry)
93LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry,
94 umode_t mode, unsigned int dev)
95LSM_HOOK(int, 0, path_truncate, const struct path *path)
96LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry,
97 const char *old_name)
98LSM_HOOK(int, 0, path_link, struct dentry *old_dentry,
99 const struct path *new_dir, struct dentry *new_dentry)
100LSM_HOOK(int, 0, path_rename, const struct path *old_dir,
101 struct dentry *old_dentry, const struct path *new_dir,
102 struct dentry *new_dentry)
103LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode)
104LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid)
105LSM_HOOK(int, 0, path_chroot, const struct path *path)
106#endif /* CONFIG_SECURITY_PATH */
107
108/* Needed for inode based security check */
109LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask,
110 unsigned int obj_type)
111LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode)
112LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)
113LSM_HOOK(int, 0, inode_init_security, struct inode *inode,
114 struct inode *dir, const struct qstr *qstr, const char **name,
115 void **value, size_t *len)
116LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry,
117 umode_t mode)
118LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir,
119 struct dentry *new_dentry)
120LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry)
121LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry,
122 const char *old_name)
123LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry,
124 umode_t mode)
125LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry)
126LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry,
127 umode_t mode, dev_t dev)
128LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry,
129 struct inode *new_dir, struct dentry *new_dentry)
130LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
131LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
132 bool rcu)
133LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
134LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
135LSM_HOOK(int, 0, inode_getattr, const struct path *path)
136LSM_HOOK(int, 0, inode_setxattr, struct dentry *dentry, const char *name,
137 const void *value, size_t size, int flags)
138LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry,
139 const char *name, const void *value, size_t size, int flags)
140LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name)
141LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry)
142LSM_HOOK(int, 0, inode_removexattr, struct dentry *dentry, const char *name)
143LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry)
144LSM_HOOK(int, 0, inode_killpriv, struct dentry *dentry)
145LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct inode *inode,
146 const char *name, void **buffer, bool alloc)
147LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode,
148 const char *name, const void *value, size_t size, int flags)
149LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer,
150 size_t buffer_size)
151LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid)
152LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new)
153LSM_HOOK(int, 0, inode_copy_up_xattr, const char *name)
154LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir,
155 struct kernfs_node *kn)
156LSM_HOOK(int, 0, file_permission, struct file *file, int mask)
157LSM_HOOK(int, 0, file_alloc_security, struct file *file)
158LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file)
159LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd,
160 unsigned long arg)
161LSM_HOOK(int, 0, mmap_addr, unsigned long addr)
162LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot,
163 unsigned long prot, unsigned long flags)
164LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma,
165 unsigned long reqprot, unsigned long prot)
166LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd)
167LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd,
168 unsigned long arg)
169LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file)
170LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk,
171 struct fown_struct *fown, int sig)
172LSM_HOOK(int, 0, file_receive, struct file *file)
173LSM_HOOK(int, 0, file_open, struct file *file)
174LSM_HOOK(int, 0, task_alloc, struct task_struct *task,
175 unsigned long clone_flags)
176LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task)
177LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp)
178LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred)
179LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old,
180 gfp_t gfp)
181LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new,
182 const struct cred *old)
183LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid)
184LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid)
185LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
186LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
187LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id)
188LSM_HOOK(int, 0, kernel_read_file, struct file *file,
189 enum kernel_read_file_id id)
190LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
191 loff_t size, enum kernel_read_file_id id)
192LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old,
193 int flags)
Thomas Cedeno39030e12020-06-09 10:22:13 -0700194LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old,
195 int flags)
KP Singh98e828a2020-03-29 01:43:50 +0100196LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid)
197LSM_HOOK(int, 0, task_getpgid, struct task_struct *p)
198LSM_HOOK(int, 0, task_getsid, struct task_struct *p)
199LSM_HOOK(void, LSM_RET_VOID, task_getsecid, struct task_struct *p, u32 *secid)
200LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice)
201LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio)
202LSM_HOOK(int, 0, task_getioprio, struct task_struct *p)
203LSM_HOOK(int, 0, task_prlimit, const struct cred *cred,
204 const struct cred *tcred, unsigned int flags)
205LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource,
206 struct rlimit *new_rlim)
207LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p)
208LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p)
209LSM_HOOK(int, 0, task_movememory, struct task_struct *p)
210LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info,
211 int sig, const struct cred *cred)
212LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2,
213 unsigned long arg3, unsigned long arg4, unsigned long arg5)
214LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p,
215 struct inode *inode)
216LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag)
217LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp,
218 u32 *secid)
219LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg)
220LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg)
221LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm)
222LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security,
223 struct kern_ipc_perm *perm)
224LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg)
225LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd)
226LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm,
227 struct msg_msg *msg, int msqflg)
228LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm,
229 struct msg_msg *msg, struct task_struct *target, long type, int mode)
230LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm)
231LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm)
232LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg)
233LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd)
234LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr,
235 int shmflg)
236LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm)
237LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm)
238LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg)
239LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd)
240LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops,
241 unsigned nsops, int alter)
242LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb)
243LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry,
244 struct inode *inode)
245LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name,
246 char **value)
247LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
248LSM_HOOK(int, 0, ismaclabel, const char *name)
Anders Roxell625236b2020-05-12 19:46:07 +0200249LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata,
KP Singh98e828a2020-03-29 01:43:50 +0100250 u32 *seclen)
251LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid)
252LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
253LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode)
254LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen)
255LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen)
256LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx,
257 u32 *ctxlen)
258
David Howells344fa642020-02-12 13:58:35 +0000259#if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
260LSM_HOOK(int, 0, post_notification, const struct cred *w_cred,
261 const struct cred *cred, struct watch_notification *n)
David Howells998f5042020-02-12 13:58:35 +0000262#endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */
263
264#if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS)
265LSM_HOOK(int, 0, watch_key, struct key *key)
David Howells344fa642020-02-12 13:58:35 +0000266#endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */
267
KP Singh98e828a2020-03-29 01:43:50 +0100268#ifdef CONFIG_SECURITY_NETWORK
269LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other,
270 struct sock *newsk)
271LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other)
272LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern)
273LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type,
274 int protocol, int kern)
275LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb)
276LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address,
277 int addrlen)
278LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address,
279 int addrlen)
280LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog)
281LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock)
282LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg,
283 int size)
284LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg,
285 int size, int flags)
286LSM_HOOK(int, 0, socket_getsockname, struct socket *sock)
287LSM_HOOK(int, 0, socket_getpeername, struct socket *sock)
288LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname)
289LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname)
290LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how)
291LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb)
292LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock,
293 char __user *optval, int __user *optlen, unsigned len)
294LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock,
295 struct sk_buff *skb, u32 *secid)
296LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority)
297LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk)
298LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk,
299 struct sock *newsk)
300LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid)
301LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent)
302LSM_HOOK(int, 0, inet_conn_request, struct sock *sk, struct sk_buff *skb,
303 struct request_sock *req)
304LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk,
305 const struct request_sock *req)
306LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk,
307 struct sk_buff *skb)
308LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid)
309LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void)
310LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void)
311LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req,
312 struct flowi *fl)
313LSM_HOOK(int, 0, tun_dev_alloc_security, void **security)
314LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security)
315LSM_HOOK(int, 0, tun_dev_create, void)
316LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
317LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
318LSM_HOOK(int, 0, tun_dev_open, void *security)
319LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep,
320 struct sk_buff *skb)
321LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname,
322 struct sockaddr *address, int addrlen)
323LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_endpoint *ep,
324 struct sock *sk, struct sock *newsk)
325#endif /* CONFIG_SECURITY_NETWORK */
326
327#ifdef CONFIG_SECURITY_INFINIBAND
328LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey)
329LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name,
330 u8 port_num)
331LSM_HOOK(int, 0, ib_alloc_security, void **sec)
332LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec)
333#endif /* CONFIG_SECURITY_INFINIBAND */
334
335#ifdef CONFIG_SECURITY_NETWORK_XFRM
336LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp,
337 struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp)
338LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx,
339 struct xfrm_sec_ctx **new_ctx)
340LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security,
341 struct xfrm_sec_ctx *ctx)
342LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx)
343LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x,
344 struct xfrm_user_sec_ctx *sec_ctx)
345LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x,
346 struct xfrm_sec_ctx *polsec, u32 secid)
347LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x)
348LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x)
349LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid,
350 u8 dir)
351LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x,
352 struct xfrm_policy *xp, const struct flowi *fl)
353LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid,
354 int ckall)
355#endif /* CONFIG_SECURITY_NETWORK_XFRM */
356
357/* key management security hooks */
358#ifdef CONFIG_KEYS
359LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred,
360 unsigned long flags)
361LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key)
362LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred,
363 unsigned perm)
364LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer)
365#endif /* CONFIG_KEYS */
366
367#ifdef CONFIG_AUDIT
368LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr,
369 void **lsmrule)
370LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule)
371LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule)
372LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule)
373#endif /* CONFIG_AUDIT */
374
375#ifdef CONFIG_BPF_SYSCALL
376LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size)
377LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode)
378LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog)
379LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map)
380LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map)
381LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux)
382LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
383#endif /* CONFIG_BPF_SYSCALL */
384
385LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
386
387#ifdef CONFIG_PERF_EVENTS
388LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
389LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event)
390LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event)
391LSM_HOOK(int, 0, perf_event_read, struct perf_event *event)
392LSM_HOOK(int, 0, perf_event_write, struct perf_event *event)
393#endif /* CONFIG_PERF_EVENTS */