198e828a0SKP Singh /* SPDX-License-Identifier: GPL-2.0 */ 298e828a0SKP Singh 398e828a0SKP Singh /* 498e828a0SKP Singh * Linux Security Module Hook declarations. 598e828a0SKP Singh * 698e828a0SKP Singh * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> 798e828a0SKP Singh * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com> 898e828a0SKP Singh * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> 998e828a0SKP Singh * Copyright (C) 2001 James Morris <jmorris@intercode.com.au> 1098e828a0SKP Singh * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) 1198e828a0SKP Singh * Copyright (C) 2015 Intel Corporation. 1298e828a0SKP Singh * Copyright (C) 2015 Casey Schaufler <casey@schaufler-ca.com> 1398e828a0SKP Singh * Copyright (C) 2016 Mellanox Techonologies 1498e828a0SKP Singh * Copyright (C) 2020 Google LLC. 1598e828a0SKP Singh */ 1698e828a0SKP Singh 1798e828a0SKP Singh /* 18bb22d80bSRandy Dunlap * The macro LSM_HOOK is used to define the data structures required by 1998e828a0SKP Singh * the LSM framework using the pattern: 2098e828a0SKP Singh * 2198e828a0SKP Singh * LSM_HOOK(<return_type>, <default_value>, <hook_name>, args...) 2298e828a0SKP Singh * 2398e828a0SKP Singh * struct security_hook_heads { 2498e828a0SKP Singh * #define LSM_HOOK(RET, DEFAULT, NAME, ...) struct hlist_head NAME; 2598e828a0SKP Singh * #include <linux/lsm_hook_defs.h> 2698e828a0SKP Singh * #undef LSM_HOOK 2798e828a0SKP Singh * }; 2898e828a0SKP Singh */ 2952f88693STodd Kjos LSM_HOOK(int, 0, binder_set_context_mgr, const struct cred *mgr) 3052f88693STodd Kjos LSM_HOOK(int, 0, binder_transaction, const struct cred *from, 3152f88693STodd Kjos const struct cred *to) 3252f88693STodd Kjos LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from, 3352f88693STodd Kjos const struct cred *to) 3452f88693STodd Kjos LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from, 358e4672d6SKhadija Kamran const struct cred *to, const struct file *file) 3698e828a0SKP Singh LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child, 3798e828a0SKP Singh unsigned int mode) 3898e828a0SKP Singh LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent) 396672efbbSKhadija Kamran LSM_HOOK(int, 0, capget, const struct task_struct *target, kernel_cap_t *effective, 4098e828a0SKP Singh kernel_cap_t *inheritable, kernel_cap_t *permitted) 4198e828a0SKP Singh LSM_HOOK(int, 0, capset, struct cred *new, const struct cred *old, 4298e828a0SKP Singh const kernel_cap_t *effective, const kernel_cap_t *inheritable, 4398e828a0SKP Singh const kernel_cap_t *permitted) 4498e828a0SKP Singh LSM_HOOK(int, 0, capable, const struct cred *cred, struct user_namespace *ns, 4598e828a0SKP Singh int cap, unsigned int opts) 4698e828a0SKP Singh LSM_HOOK(int, 0, quotactl, int cmds, int type, int id, struct super_block *sb) 4798e828a0SKP Singh LSM_HOOK(int, 0, quota_on, struct dentry *dentry) 4898e828a0SKP Singh LSM_HOOK(int, 0, syslog, int type) 4998e828a0SKP Singh LSM_HOOK(int, 0, settime, const struct timespec64 *ts, 5098e828a0SKP Singh const struct timezone *tz) 5164d84030SOndrej Mosnacek LSM_HOOK(int, 1, vm_enough_memory, struct mm_struct *mm, long pages) 52b8bff599SEric W. Biederman LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm) 5356305aa9SEric W. Biederman LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, struct file *file) 5498e828a0SKP Singh LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm) 5598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) 5698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm) 57d80a8f1bSDavid Howells LSM_HOOK(int, 0, fs_context_submount, struct fs_context *fc, struct super_block *reference) 5898e828a0SKP Singh LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, 5998e828a0SKP Singh struct fs_context *src_sc) 6054261af4SKP Singh LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc, 6198e828a0SKP Singh struct fs_parameter *param) 6298e828a0SKP Singh LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb) 6383e804f0SMickaël Salaün LSM_HOOK(void, LSM_RET_VOID, sb_delete, struct super_block *sb) 6498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb) 6598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts) 6698e828a0SKP Singh LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts) 6769c4a42dSOlga Kornievskaia LSM_HOOK(int, 0, sb_mnt_opts_compat, struct super_block *sb, void *mnt_opts) 6898e828a0SKP Singh LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts) 6998e828a0SKP Singh LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb) 7098e828a0SKP Singh LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb) 7198e828a0SKP Singh LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry) 7298e828a0SKP Singh LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path, 7398e828a0SKP Singh const char *type, unsigned long flags, void *data) 7498e828a0SKP Singh LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags) 7598e828a0SKP Singh LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path, 7698e828a0SKP Singh const struct path *new_path) 7798e828a0SKP Singh LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts, 7898e828a0SKP Singh unsigned long kern_flags, unsigned long *set_kern_flags) 7998e828a0SKP Singh LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, 8098e828a0SKP Singh struct super_block *newsb, unsigned long kern_flags, 8198e828a0SKP Singh unsigned long *set_kern_flags) 8298e828a0SKP Singh LSM_HOOK(int, 0, move_mount, const struct path *from_path, 8398e828a0SKP Singh const struct path *to_path) 847f5056b9SVivek Goyal LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry, 8515bf3239SVivek Goyal int mode, const struct qstr *name, const char **xattr_name, 8615bf3239SVivek Goyal void **ctx, u32 *ctxlen) 8798e828a0SKP Singh LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, 8898e828a0SKP Singh struct qstr *name, const struct cred *old, struct cred *new) 8998e828a0SKP Singh 9098e828a0SKP Singh #ifdef CONFIG_SECURITY_PATH 9198e828a0SKP Singh LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry) 9298e828a0SKP Singh LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry, 9398e828a0SKP Singh umode_t mode) 9498e828a0SKP Singh LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry) 9598e828a0SKP Singh LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry, 9698e828a0SKP Singh umode_t mode, unsigned int dev) 9798e828a0SKP Singh LSM_HOOK(int, 0, path_truncate, const struct path *path) 9898e828a0SKP Singh LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry, 9998e828a0SKP Singh const char *old_name) 10098e828a0SKP Singh LSM_HOOK(int, 0, path_link, struct dentry *old_dentry, 10198e828a0SKP Singh const struct path *new_dir, struct dentry *new_dentry) 10298e828a0SKP Singh LSM_HOOK(int, 0, path_rename, const struct path *old_dir, 10398e828a0SKP Singh struct dentry *old_dentry, const struct path *new_dir, 104100f59d9SMickaël Salaün struct dentry *new_dentry, unsigned int flags) 10598e828a0SKP Singh LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode) 10698e828a0SKP Singh LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid) 10798e828a0SKP Singh LSM_HOOK(int, 0, path_chroot, const struct path *path) 10898e828a0SKP Singh #endif /* CONFIG_SECURITY_PATH */ 10998e828a0SKP Singh 11098e828a0SKP Singh /* Needed for inode based security check */ 11198e828a0SKP Singh LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask, 11298e828a0SKP Singh unsigned int obj_type) 11398e828a0SKP Singh LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode) 11498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode) 1156bcdfd2cSRoberto Sassu LSM_HOOK(int, -EOPNOTSUPP, inode_init_security, struct inode *inode, 1166bcdfd2cSRoberto Sassu struct inode *dir, const struct qstr *qstr, struct xattr *xattrs, 1176bcdfd2cSRoberto Sassu int *xattr_count) 118215b674bSLokesh Gidra LSM_HOOK(int, 0, inode_init_security_anon, struct inode *inode, 119215b674bSLokesh Gidra const struct qstr *name, const struct inode *context_inode) 12098e828a0SKP Singh LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry, 12198e828a0SKP Singh umode_t mode) 12298e828a0SKP Singh LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir, 12398e828a0SKP Singh struct dentry *new_dentry) 12498e828a0SKP Singh LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry) 12598e828a0SKP Singh LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry, 12698e828a0SKP Singh const char *old_name) 12798e828a0SKP Singh LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry, 12898e828a0SKP Singh umode_t mode) 12998e828a0SKP Singh LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry) 13098e828a0SKP Singh LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry, 13198e828a0SKP Singh umode_t mode, dev_t dev) 13298e828a0SKP Singh LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry, 13398e828a0SKP Singh struct inode *new_dir, struct dentry *new_dentry) 13498e828a0SKP Singh LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry) 13598e828a0SKP Singh LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode, 13698e828a0SKP Singh bool rcu) 13798e828a0SKP Singh LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask) 13898e828a0SKP Singh LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr) 13998e828a0SKP Singh LSM_HOOK(int, 0, inode_getattr, const struct path *path) 14039f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_setxattr, struct mnt_idmap *idmap, 14171bc356fSChristian Brauner struct dentry *dentry, const char *name, const void *value, 14271bc356fSChristian Brauner size_t size, int flags) 14398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry, 14498e828a0SKP Singh const char *name, const void *value, size_t size, int flags) 14598e828a0SKP Singh LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name) 14698e828a0SKP Singh LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry) 14739f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_removexattr, struct mnt_idmap *idmap, 14871bc356fSChristian Brauner struct dentry *dentry, const char *name) 149700b7940SChristian Brauner LSM_HOOK(int, 0, inode_set_acl, struct mnt_idmap *idmap, 15072b3897eSChristian Brauner struct dentry *dentry, const char *acl_name, struct posix_acl *kacl) 151700b7940SChristian Brauner LSM_HOOK(int, 0, inode_get_acl, struct mnt_idmap *idmap, 15272b3897eSChristian Brauner struct dentry *dentry, const char *acl_name) 153700b7940SChristian Brauner LSM_HOOK(int, 0, inode_remove_acl, struct mnt_idmap *idmap, 15472b3897eSChristian Brauner struct dentry *dentry, const char *acl_name) 15598e828a0SKP Singh LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry) 15639f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_killpriv, struct mnt_idmap *idmap, 15771bc356fSChristian Brauner struct dentry *dentry) 1584609e1f1SChristian Brauner LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct mnt_idmap *idmap, 15971bc356fSChristian Brauner struct inode *inode, const char *name, void **buffer, bool alloc) 16098e828a0SKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode, 16198e828a0SKP Singh const char *name, const void *value, size_t size, int flags) 16298e828a0SKP Singh LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer, 16398e828a0SKP Singh size_t buffer_size) 16498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid) 16598e828a0SKP Singh LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new) 16623e390cdSKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, const char *name) 16798e828a0SKP Singh LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir, 16898e828a0SKP Singh struct kernfs_node *kn) 16998e828a0SKP Singh LSM_HOOK(int, 0, file_permission, struct file *file, int mask) 17098e828a0SKP Singh LSM_HOOK(int, 0, file_alloc_security, struct file *file) 17198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) 17298e828a0SKP Singh LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, 17398e828a0SKP Singh unsigned long arg) 174*820831deSAlfred Piccioni LSM_HOOK(int, 0, file_ioctl_compat, struct file *file, unsigned int cmd, 175*820831deSAlfred Piccioni unsigned long arg) 17698e828a0SKP Singh LSM_HOOK(int, 0, mmap_addr, unsigned long addr) 17798e828a0SKP Singh LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, 17898e828a0SKP Singh unsigned long prot, unsigned long flags) 17998e828a0SKP Singh LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma, 18098e828a0SKP Singh unsigned long reqprot, unsigned long prot) 18198e828a0SKP Singh LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd) 18298e828a0SKP Singh LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd, 18398e828a0SKP Singh unsigned long arg) 18498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file) 18598e828a0SKP Singh LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk, 18698e828a0SKP Singh struct fown_struct *fown, int sig) 18798e828a0SKP Singh LSM_HOOK(int, 0, file_receive, struct file *file) 18898e828a0SKP Singh LSM_HOOK(int, 0, file_open, struct file *file) 1893350607dSGünther Noack LSM_HOOK(int, 0, file_truncate, struct file *file) 19098e828a0SKP Singh LSM_HOOK(int, 0, task_alloc, struct task_struct *task, 19198e828a0SKP Singh unsigned long clone_flags) 19298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) 19398e828a0SKP Singh LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) 19498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) 19598e828a0SKP Singh LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old, 19698e828a0SKP Singh gfp_t gfp) 19798e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new, 19898e828a0SKP Singh const struct cred *old) 19998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid) 20098e828a0SKP Singh LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid) 20198e828a0SKP Singh LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) 20298e828a0SKP Singh LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) 203b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents) 204b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size, 205200da27aSNathan Chancellor enum kernel_load_data_id id, char *description) 20698e828a0SKP Singh LSM_HOOK(int, 0, kernel_read_file, struct file *file, 2072039bda1SKees Cook enum kernel_read_file_id id, bool contents) 20898e828a0SKP Singh LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, 20998e828a0SKP Singh loff_t size, enum kernel_read_file_id id) 21098e828a0SKP Singh LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old, 21198e828a0SKP Singh int flags) 21239030e13SThomas Cedeno LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old, 21339030e13SThomas Cedeno int flags) 214fcfe0ac2SMicah Morton LSM_HOOK(int, 0, task_fix_setgroups, struct cred *new, const struct cred * old) 21598e828a0SKP Singh LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid) 21698e828a0SKP Singh LSM_HOOK(int, 0, task_getpgid, struct task_struct *p) 21798e828a0SKP Singh LSM_HOOK(int, 0, task_getsid, struct task_struct *p) 2186326948fSPaul Moore LSM_HOOK(void, LSM_RET_VOID, current_getsecid_subj, u32 *secid) 2194ebd7651SPaul Moore LSM_HOOK(void, LSM_RET_VOID, task_getsecid_obj, 2204ebd7651SPaul Moore struct task_struct *p, u32 *secid) 22198e828a0SKP Singh LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice) 22298e828a0SKP Singh LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio) 22398e828a0SKP Singh LSM_HOOK(int, 0, task_getioprio, struct task_struct *p) 22498e828a0SKP Singh LSM_HOOK(int, 0, task_prlimit, const struct cred *cred, 22598e828a0SKP Singh const struct cred *tcred, unsigned int flags) 22698e828a0SKP Singh LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource, 22798e828a0SKP Singh struct rlimit *new_rlim) 22898e828a0SKP Singh LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p) 22998e828a0SKP Singh LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p) 23098e828a0SKP Singh LSM_HOOK(int, 0, task_movememory, struct task_struct *p) 23198e828a0SKP Singh LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info, 23298e828a0SKP Singh int sig, const struct cred *cred) 23398e828a0SKP Singh LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2, 23498e828a0SKP Singh unsigned long arg3, unsigned long arg4, unsigned long arg5) 23598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p, 23698e828a0SKP Singh struct inode *inode) 2377cd4c5c2SFrederick Lawler LSM_HOOK(int, 0, userns_create, const struct cred *cred) 23898e828a0SKP Singh LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag) 23998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp, 24098e828a0SKP Singh u32 *secid) 24198e828a0SKP Singh LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg) 24298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg) 24398e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm) 24498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security, 24598e828a0SKP Singh struct kern_ipc_perm *perm) 24698e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg) 24798e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd) 24898e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm, 24998e828a0SKP Singh struct msg_msg *msg, int msqflg) 25098e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm, 25198e828a0SKP Singh struct msg_msg *msg, struct task_struct *target, long type, int mode) 25298e828a0SKP Singh LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm) 25398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm) 25498e828a0SKP Singh LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg) 25598e828a0SKP Singh LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd) 25698e828a0SKP Singh LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr, 25798e828a0SKP Singh int shmflg) 25898e828a0SKP Singh LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm) 25998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm) 26098e828a0SKP Singh LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg) 26198e828a0SKP Singh LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd) 26298e828a0SKP Singh LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops, 26398e828a0SKP Singh unsigned nsops, int alter) 26498e828a0SKP Singh LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb) 26598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry, 26698e828a0SKP Singh struct inode *inode) 267c8e477c6SAl Viro LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, const char *name, 26898e828a0SKP Singh char **value) 26998e828a0SKP Singh LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) 27098e828a0SKP Singh LSM_HOOK(int, 0, ismaclabel, const char *name) 271625236baSAnders Roxell LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata, 27298e828a0SKP Singh u32 *seclen) 27398e828a0SKP Singh LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) 27498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen) 27598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) 27698e828a0SKP Singh LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) 27798e828a0SKP Singh LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) 27837dab33fSOndrej Mosnacek LSM_HOOK(int, -EOPNOTSUPP, inode_getsecctx, struct inode *inode, void **ctx, 27998e828a0SKP Singh u32 *ctxlen) 28098e828a0SKP Singh 281344fa64eSDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) 282344fa64eSDavid Howells LSM_HOOK(int, 0, post_notification, const struct cred *w_cred, 283344fa64eSDavid Howells const struct cred *cred, struct watch_notification *n) 284998f5040SDavid Howells #endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */ 285998f5040SDavid Howells 286998f5040SDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS) 287998f5040SDavid Howells LSM_HOOK(int, 0, watch_key, struct key *key) 288344fa64eSDavid Howells #endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */ 289344fa64eSDavid Howells 29098e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK 29198e828a0SKP Singh LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other, 29298e828a0SKP Singh struct sock *newsk) 29398e828a0SKP Singh LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other) 29498e828a0SKP Singh LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern) 29598e828a0SKP Singh LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type, 29698e828a0SKP Singh int protocol, int kern) 29798e828a0SKP Singh LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb) 29898e828a0SKP Singh LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address, 29998e828a0SKP Singh int addrlen) 30098e828a0SKP Singh LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address, 30198e828a0SKP Singh int addrlen) 30298e828a0SKP Singh LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog) 30398e828a0SKP Singh LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock) 30498e828a0SKP Singh LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg, 30598e828a0SKP Singh int size) 30698e828a0SKP Singh LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg, 30798e828a0SKP Singh int size, int flags) 30898e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockname, struct socket *sock) 30998e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeername, struct socket *sock) 31098e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) 31198e828a0SKP Singh LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname) 31298e828a0SKP Singh LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how) 31398e828a0SKP Singh LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb) 31498e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock, 315b10b9c34SPaul Moore sockptr_t optval, sockptr_t optlen, unsigned int len) 31698e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock, 31798e828a0SKP Singh struct sk_buff *skb, u32 *secid) 31898e828a0SKP Singh LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority) 31998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk) 32098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk, 32198e828a0SKP Singh struct sock *newsk) 3225b52ad34SGuillaume Nault LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, const struct sock *sk, u32 *secid) 32398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent) 32441dd9596SFlorian Westphal LSM_HOOK(int, 0, inet_conn_request, const struct sock *sk, struct sk_buff *skb, 32598e828a0SKP Singh struct request_sock *req) 32698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk, 32798e828a0SKP Singh const struct request_sock *req) 32898e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk, 32998e828a0SKP Singh struct sk_buff *skb) 33098e828a0SKP Singh LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid) 33198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void) 33298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void) 33398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req, 3343df98d79SPaul Moore struct flowi_common *flic) 33598e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_alloc_security, void **security) 33698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security) 33798e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_create, void) 33898e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach_queue, void *security) 33998e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security) 34098e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_open, void *security) 341c081d53fSXin Long LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_association *asoc, 34298e828a0SKP Singh struct sk_buff *skb) 34398e828a0SKP Singh LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname, 34498e828a0SKP Singh struct sockaddr *address, int addrlen) 345c081d53fSXin Long LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_association *asoc, 34698e828a0SKP Singh struct sock *sk, struct sock *newsk) 3475e50f5d4SOndrej Mosnacek LSM_HOOK(int, 0, sctp_assoc_established, struct sctp_association *asoc, 3485e50f5d4SOndrej Mosnacek struct sk_buff *skb) 349e3d9387fSPaolo Abeni LSM_HOOK(int, 0, mptcp_add_subflow, struct sock *sk, struct sock *ssk) 35098e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK */ 35198e828a0SKP Singh 35298e828a0SKP Singh #ifdef CONFIG_SECURITY_INFINIBAND 35398e828a0SKP Singh LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey) 35498e828a0SKP Singh LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name, 35598e828a0SKP Singh u8 port_num) 35698e828a0SKP Singh LSM_HOOK(int, 0, ib_alloc_security, void **sec) 35798e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec) 35898e828a0SKP Singh #endif /* CONFIG_SECURITY_INFINIBAND */ 35998e828a0SKP Singh 36098e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK_XFRM 36198e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp, 36298e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp) 36398e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx, 36498e828a0SKP Singh struct xfrm_sec_ctx **new_ctx) 36598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security, 36698e828a0SKP Singh struct xfrm_sec_ctx *ctx) 36798e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx) 36898e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x, 36998e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx) 37098e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x, 37198e828a0SKP Singh struct xfrm_sec_ctx *polsec, u32 secid) 37298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x) 37398e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x) 3748a922805SZhongjun Tan LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid) 37598e828a0SKP Singh LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x, 3763df98d79SPaul Moore struct xfrm_policy *xp, const struct flowi_common *flic) 37798e828a0SKP Singh LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid, 37898e828a0SKP Singh int ckall) 37998e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK_XFRM */ 38098e828a0SKP Singh 38198e828a0SKP Singh /* key management security hooks */ 38298e828a0SKP Singh #ifdef CONFIG_KEYS 38398e828a0SKP Singh LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, 38498e828a0SKP Singh unsigned long flags) 38598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) 38698e828a0SKP Singh LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, 3874bc799dcSSami Tolvanen enum key_need_perm need_perm) 388b3816cf8SPaul Moore LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **buffer) 38998e828a0SKP Singh #endif /* CONFIG_KEYS */ 39098e828a0SKP Singh 39198e828a0SKP Singh #ifdef CONFIG_AUDIT 39298e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr, 39398e828a0SKP Singh void **lsmrule) 39498e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule) 39598e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule) 39698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule) 39798e828a0SKP Singh #endif /* CONFIG_AUDIT */ 39898e828a0SKP Singh 39998e828a0SKP Singh #ifdef CONFIG_BPF_SYSCALL 40098e828a0SKP Singh LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size) 40198e828a0SKP Singh LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode) 40298e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog) 40398e828a0SKP Singh LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map) 40498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map) 40598e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux) 40698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) 40798e828a0SKP Singh #endif /* CONFIG_BPF_SYSCALL */ 40898e828a0SKP Singh 40998e828a0SKP Singh LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) 41098e828a0SKP Singh 41198e828a0SKP Singh #ifdef CONFIG_PERF_EVENTS 41298e828a0SKP Singh LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) 41398e828a0SKP Singh LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event) 41498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event) 41598e828a0SKP Singh LSM_HOOK(int, 0, perf_event_read, struct perf_event *event) 41698e828a0SKP Singh LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) 41798e828a0SKP Singh #endif /* CONFIG_PERF_EVENTS */ 418cdc1404aSPaul Moore 419cdc1404aSPaul Moore #ifdef CONFIG_IO_URING 420cdc1404aSPaul Moore LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) 421cdc1404aSPaul Moore LSM_HOOK(int, 0, uring_sqpoll, void) 4222a584012SLuis Chamberlain LSM_HOOK(int, 0, uring_cmd, struct io_uring_cmd *ioucmd) 423cdc1404aSPaul Moore #endif /* CONFIG_IO_URING */ 424