Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /*
0004  * Linux Security Module Hook declarations.
0005  *
0006  * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
0007  * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
0008  * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
0009  * Copyright (C) 2001 James Morris <jmorris@intercode.com.au>
0010  * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
0011  * Copyright (C) 2015 Intel Corporation.
0012  * Copyright (C) 2015 Casey Schaufler <casey@schaufler-ca.com>
0013  * Copyright (C) 2016 Mellanox Techonologies
0014  * Copyright (C) 2020 Google LLC.
0015  */
0016 
0017 /*
0018  * The macro LSM_HOOK is used to define the data structures required by
0019  * the LSM framework using the pattern:
0020  *
0021  *  LSM_HOOK(<return_type>, <default_value>, <hook_name>, args...)
0022  *
0023  * struct security_hook_heads {
0024  *   #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME;
0025  *   #include <linux/lsm_hook_defs.h>
0026  *   #undef LSM_HOOK
0027  * };
0028  */
0029 LSM_HOOK(int, 0, binder_set_context_mgr, const struct cred *mgr)
0030 LSM_HOOK(int, 0, binder_transaction, const struct cred *from,
0031      const struct cred *to)
0032 LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from,
0033      const struct cred *to)
0034 LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from,
0035      const struct cred *to, struct file *file)
0036 LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
0037      unsigned int mode)
0038 LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
0039 LSM_HOOK(int, 0, capget, struct task_struct *target, kernel_cap_t *effective,
0040      kernel_cap_t *inheritable, kernel_cap_t *permitted)
0041 LSM_HOOK(int, 0, capset, struct cred *new, const struct cred *old,
0042      const kernel_cap_t *effective, const kernel_cap_t *inheritable,
0043      const kernel_cap_t *permitted)
0044 LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns,
0045      int cap, unsigned int opts)
0046 LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb)
0047 LSM_HOOK(int, 0, quota_on, struct dentry *dentry)
0048 LSM_HOOK(int, 0, syslog, int type)
0049 LSM_HOOK(int, 0, settime, const struct timespec64 *ts,
0050      const struct timezone *tz)
0051 LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages)
0052 LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm)
0053 LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, struct file *file)
0054 LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm)
0055 LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm)
0056 LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
0057 LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
0058      struct fs_context *src_sc)
0059 LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc,
0060      struct fs_parameter *param)
0061 LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
0062 LSM_HOOK(void, LSM_RET_VOID, sb_delete, struct super_block *sb)
0063 LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)
0064 LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts)
0065 LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts)
0066 LSM_HOOK(int, 0, sb_mnt_opts_compat, struct super_block *sb, void *mnt_opts)
0067 LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts)
0068 LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb)
0069 LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb)
0070 LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry)
0071 LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path,
0072      const char *type, unsigned long flags, void *data)
0073 LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags)
0074 LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path,
0075      const struct path *new_path)
0076 LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts,
0077      unsigned long kern_flags, unsigned long *set_kern_flags)
0078 LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb,
0079      struct super_block *newsb, unsigned long kern_flags,
0080      unsigned long *set_kern_flags)
0081 LSM_HOOK(int, 0, move_mount, const struct path *from_path,
0082      const struct path *to_path)
0083 LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry,
0084      int mode, const struct qstr *name, const char **xattr_name,
0085      void **ctx, u32 *ctxlen)
0086 LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
0087      struct qstr *name, const struct cred *old, struct cred *new)
0088 
0089 #ifdef CONFIG_SECURITY_PATH
0090 LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
0091 LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry,
0092      umode_t mode)
0093 LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry)
0094 LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry,
0095      umode_t mode, unsigned int dev)
0096 LSM_HOOK(int, 0, path_truncate, const struct path *path)
0097 LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry,
0098      const char *old_name)
0099 LSM_HOOK(int, 0, path_link, struct dentry *old_dentry,
0100      const struct path *new_dir, struct dentry *new_dentry)
0101 LSM_HOOK(int, 0, path_rename, const struct path *old_dir,
0102      struct dentry *old_dentry, const struct path *new_dir,
0103      struct dentry *new_dentry, unsigned int flags)
0104 LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode)
0105 LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid)
0106 LSM_HOOK(int, 0, path_chroot, const struct path *path)
0107 #endif /* CONFIG_SECURITY_PATH */
0108 
0109 /* Needed for inode based security check */
0110 LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask,
0111      unsigned int obj_type)
0112 LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode)
0113 LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)
0114 LSM_HOOK(int, 0, inode_init_security, struct inode *inode,
0115      struct inode *dir, const struct qstr *qstr, const char **name,
0116      void **value, size_t *len)
0117 LSM_HOOK(int, 0, inode_init_security_anon, struct inode *inode,
0118      const struct qstr *name, const struct inode *context_inode)
0119 LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry,
0120      umode_t mode)
0121 LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir,
0122      struct dentry *new_dentry)
0123 LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry)
0124 LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry,
0125      const char *old_name)
0126 LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry,
0127      umode_t mode)
0128 LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry)
0129 LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry,
0130      umode_t mode, dev_t dev)
0131 LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry,
0132      struct inode *new_dir, struct dentry *new_dentry)
0133 LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
0134 LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
0135      bool rcu)
0136 LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
0137 LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
0138 LSM_HOOK(int, 0, inode_getattr, const struct path *path)
0139 LSM_HOOK(int, 0, inode_setxattr, struct user_namespace *mnt_userns,
0140      struct dentry *dentry, const char *name, const void *value,
0141      size_t size, int flags)
0142 LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry,
0143      const char *name, const void *value, size_t size, int flags)
0144 LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name)
0145 LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry)
0146 LSM_HOOK(int, 0, inode_removexattr, struct user_namespace *mnt_userns,
0147      struct dentry *dentry, const char *name)
0148 LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry)
0149 LSM_HOOK(int, 0, inode_killpriv, struct user_namespace *mnt_userns,
0150      struct dentry *dentry)
0151 LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct user_namespace *mnt_userns,
0152      struct inode *inode, const char *name, void **buffer, bool alloc)
0153 LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode,
0154      const char *name, const void *value, size_t size, int flags)
0155 LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer,
0156      size_t buffer_size)
0157 LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid)
0158 LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new)
0159 LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, const char *name)
0160 LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir,
0161      struct kernfs_node *kn)
0162 LSM_HOOK(int, 0, file_permission, struct file *file, int mask)
0163 LSM_HOOK(int, 0, file_alloc_security, struct file *file)
0164 LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file)
0165 LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd,
0166      unsigned long arg)
0167 LSM_HOOK(int, 0, mmap_addr, unsigned long addr)
0168 LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot,
0169      unsigned long prot, unsigned long flags)
0170 LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma,
0171      unsigned long reqprot, unsigned long prot)
0172 LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd)
0173 LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd,
0174      unsigned long arg)
0175 LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file)
0176 LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk,
0177      struct fown_struct *fown, int sig)
0178 LSM_HOOK(int, 0, file_receive, struct file *file)
0179 LSM_HOOK(int, 0, file_open, struct file *file)
0180 LSM_HOOK(int, 0, task_alloc, struct task_struct *task,
0181      unsigned long clone_flags)
0182 LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task)
0183 LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp)
0184 LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred)
0185 LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old,
0186      gfp_t gfp)
0187 LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new,
0188      const struct cred *old)
0189 LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid)
0190 LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid)
0191 LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
0192 LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
0193 LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents)
0194 LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size,
0195      enum kernel_load_data_id id, char *description)
0196 LSM_HOOK(int, 0, kernel_read_file, struct file *file,
0197      enum kernel_read_file_id id, bool contents)
0198 LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
0199      loff_t size, enum kernel_read_file_id id)
0200 LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old,
0201      int flags)
0202 LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old,
0203      int flags)
0204 LSM_HOOK(int, 0, task_fix_setgroups, struct cred *new, const struct cred * old)
0205 LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid)
0206 LSM_HOOK(int, 0, task_getpgid, struct task_struct *p)
0207 LSM_HOOK(int, 0, task_getsid, struct task_struct *p)
0208 LSM_HOOK(void, LSM_RET_VOID, current_getsecid_subj, u32 *secid)
0209 LSM_HOOK(void, LSM_RET_VOID, task_getsecid_obj,
0210      struct task_struct *p, u32 *secid)
0211 LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice)
0212 LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio)
0213 LSM_HOOK(int, 0, task_getioprio, struct task_struct *p)
0214 LSM_HOOK(int, 0, task_prlimit, const struct cred *cred,
0215      const struct cred *tcred, unsigned int flags)
0216 LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource,
0217      struct rlimit *new_rlim)
0218 LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p)
0219 LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p)
0220 LSM_HOOK(int, 0, task_movememory, struct task_struct *p)
0221 LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info,
0222      int sig, const struct cred *cred)
0223 LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2,
0224      unsigned long arg3, unsigned long arg4, unsigned long arg5)
0225 LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p,
0226      struct inode *inode)
0227 LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag)
0228 LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp,
0229      u32 *secid)
0230 LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg)
0231 LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg)
0232 LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm)
0233 LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security,
0234      struct kern_ipc_perm *perm)
0235 LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg)
0236 LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd)
0237 LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm,
0238      struct msg_msg *msg, int msqflg)
0239 LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm,
0240      struct msg_msg *msg, struct task_struct *target, long type, int mode)
0241 LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm)
0242 LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm)
0243 LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg)
0244 LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd)
0245 LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr,
0246      int shmflg)
0247 LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm)
0248 LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm)
0249 LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg)
0250 LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd)
0251 LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops,
0252      unsigned nsops, int alter)
0253 LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb)
0254 LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry,
0255      struct inode *inode)
0256 LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name,
0257      char **value)
0258 LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
0259 LSM_HOOK(int, 0, ismaclabel, const char *name)
0260 LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata,
0261      u32 *seclen)
0262 LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid)
0263 LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
0264 LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode)
0265 LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen)
0266 LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen)
0267 LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx,
0268      u32 *ctxlen)
0269 
0270 #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
0271 LSM_HOOK(int, 0, post_notification, const struct cred *w_cred,
0272      const struct cred *cred, struct watch_notification *n)
0273 #endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */
0274 
0275 #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS)
0276 LSM_HOOK(int, 0, watch_key, struct key *key)
0277 #endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */
0278 
0279 #ifdef CONFIG_SECURITY_NETWORK
0280 LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other,
0281      struct sock *newsk)
0282 LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other)
0283 LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern)
0284 LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type,
0285      int protocol, int kern)
0286 LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb)
0287 LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address,
0288      int addrlen)
0289 LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address,
0290      int addrlen)
0291 LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog)
0292 LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock)
0293 LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg,
0294      int size)
0295 LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg,
0296      int size, int flags)
0297 LSM_HOOK(int, 0, socket_getsockname, struct socket *sock)
0298 LSM_HOOK(int, 0, socket_getpeername, struct socket *sock)
0299 LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname)
0300 LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname)
0301 LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how)
0302 LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb)
0303 LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock,
0304      char __user *optval, int __user *optlen, unsigned len)
0305 LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock,
0306      struct sk_buff *skb, u32 *secid)
0307 LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority)
0308 LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk)
0309 LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk,
0310      struct sock *newsk)
0311 LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid)
0312 LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent)
0313 LSM_HOOK(int, 0, inet_conn_request, const struct sock *sk, struct sk_buff *skb,
0314      struct request_sock *req)
0315 LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk,
0316      const struct request_sock *req)
0317 LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk,
0318      struct sk_buff *skb)
0319 LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid)
0320 LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void)
0321 LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void)
0322 LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req,
0323      struct flowi_common *flic)
0324 LSM_HOOK(int, 0, tun_dev_alloc_security, void **security)
0325 LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security)
0326 LSM_HOOK(int, 0, tun_dev_create, void)
0327 LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
0328 LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
0329 LSM_HOOK(int, 0, tun_dev_open, void *security)
0330 LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_association *asoc,
0331      struct sk_buff *skb)
0332 LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname,
0333      struct sockaddr *address, int addrlen)
0334 LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_association *asoc,
0335      struct sock *sk, struct sock *newsk)
0336 LSM_HOOK(int, 0, sctp_assoc_established, struct sctp_association *asoc,
0337      struct sk_buff *skb)
0338 #endif /* CONFIG_SECURITY_NETWORK */
0339 
0340 #ifdef CONFIG_SECURITY_INFINIBAND
0341 LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey)
0342 LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name,
0343      u8 port_num)
0344 LSM_HOOK(int, 0, ib_alloc_security, void **sec)
0345 LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec)
0346 #endif /* CONFIG_SECURITY_INFINIBAND */
0347 
0348 #ifdef CONFIG_SECURITY_NETWORK_XFRM
0349 LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp,
0350      struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp)
0351 LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx,
0352      struct xfrm_sec_ctx **new_ctx)
0353 LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security,
0354      struct xfrm_sec_ctx *ctx)
0355 LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx)
0356 LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x,
0357      struct xfrm_user_sec_ctx *sec_ctx)
0358 LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x,
0359      struct xfrm_sec_ctx *polsec, u32 secid)
0360 LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x)
0361 LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x)
0362 LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid)
0363 LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x,
0364      struct xfrm_policy *xp, const struct flowi_common *flic)
0365 LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid,
0366      int ckall)
0367 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
0368 
0369 /* key management security hooks */
0370 #ifdef CONFIG_KEYS
0371 LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred,
0372      unsigned long flags)
0373 LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key)
0374 LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred,
0375      enum key_need_perm need_perm)
0376 LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer)
0377 #endif /* CONFIG_KEYS */
0378 
0379 #ifdef CONFIG_AUDIT
0380 LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr,
0381      void **lsmrule)
0382 LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule)
0383 LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule)
0384 LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule)
0385 #endif /* CONFIG_AUDIT */
0386 
0387 #ifdef CONFIG_BPF_SYSCALL
0388 LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size)
0389 LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode)
0390 LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog)
0391 LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map)
0392 LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map)
0393 LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux)
0394 LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
0395 #endif /* CONFIG_BPF_SYSCALL */
0396 
0397 LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
0398 
0399 #ifdef CONFIG_PERF_EVENTS
0400 LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
0401 LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event)
0402 LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event)
0403 LSM_HOOK(int, 0, perf_event_read, struct perf_event *event)
0404 LSM_HOOK(int, 0, perf_event_write, struct perf_event *event)
0405 #endif /* CONFIG_PERF_EVENTS */
0406 
0407 #ifdef CONFIG_IO_URING
0408 LSM_HOOK(int, 0, uring_override_creds, const struct cred *new)
0409 LSM_HOOK(int, 0, uring_sqpoll, void)
0410 LSM_HOOK(int, 0, uring_cmd, struct io_uring_cmd *ioucmd)
0411 #endif /* CONFIG_IO_URING */