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