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, 3552f88693STodd Kjos const struct cred *to, 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) 3998e828a0SKP Singh LSM_HOOK(int, 0, capget, 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) 5198e828a0SKP Singh LSM_HOOK(int, 0, 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) 5798e828a0SKP Singh LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, 5898e828a0SKP Singh struct fs_context *src_sc) 5954261af4SKP Singh LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc, 6098e828a0SKP Singh struct fs_parameter *param) 6198e828a0SKP Singh LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb) 6283e804f0SMickaël Salaün LSM_HOOK(void, LSM_RET_VOID, sb_delete, struct super_block *sb) 6398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb) 6498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sb_free_mnt_opts, void *mnt_opts) 6598e828a0SKP Singh LSM_HOOK(int, 0, sb_eat_lsm_opts, char *orig, void **mnt_opts) 6669c4a42dSOlga Kornievskaia LSM_HOOK(int, 0, sb_mnt_opts_compat, struct super_block *sb, void *mnt_opts) 6798e828a0SKP Singh LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts) 6898e828a0SKP Singh LSM_HOOK(int, 0, sb_kern_mount, struct super_block *sb) 6998e828a0SKP Singh LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb) 7098e828a0SKP Singh LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry) 7198e828a0SKP Singh LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path, 7298e828a0SKP Singh const char *type, unsigned long flags, void *data) 7398e828a0SKP Singh LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags) 7498e828a0SKP Singh LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path, 7598e828a0SKP Singh const struct path *new_path) 7698e828a0SKP Singh LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts, 7798e828a0SKP Singh unsigned long kern_flags, unsigned long *set_kern_flags) 7898e828a0SKP Singh LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, 7998e828a0SKP Singh struct super_block *newsb, unsigned long kern_flags, 8098e828a0SKP Singh unsigned long *set_kern_flags) 8198e828a0SKP Singh LSM_HOOK(int, 0, move_mount, const struct path *from_path, 8298e828a0SKP Singh const struct path *to_path) 837f5056b9SVivek Goyal LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry, 8415bf3239SVivek Goyal int mode, const struct qstr *name, const char **xattr_name, 8515bf3239SVivek Goyal void **ctx, u32 *ctxlen) 8698e828a0SKP Singh LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode, 8798e828a0SKP Singh struct qstr *name, const struct cred *old, struct cred *new) 8898e828a0SKP Singh 8998e828a0SKP Singh #ifdef CONFIG_SECURITY_PATH 9098e828a0SKP Singh LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry) 9198e828a0SKP Singh LSM_HOOK(int, 0, path_mkdir, const struct path *dir, struct dentry *dentry, 9298e828a0SKP Singh umode_t mode) 9398e828a0SKP Singh LSM_HOOK(int, 0, path_rmdir, const struct path *dir, struct dentry *dentry) 9498e828a0SKP Singh LSM_HOOK(int, 0, path_mknod, const struct path *dir, struct dentry *dentry, 9598e828a0SKP Singh umode_t mode, unsigned int dev) 9698e828a0SKP Singh LSM_HOOK(int, 0, path_truncate, const struct path *path) 9798e828a0SKP Singh LSM_HOOK(int, 0, path_symlink, const struct path *dir, struct dentry *dentry, 9898e828a0SKP Singh const char *old_name) 9998e828a0SKP Singh LSM_HOOK(int, 0, path_link, struct dentry *old_dentry, 10098e828a0SKP Singh const struct path *new_dir, struct dentry *new_dentry) 10198e828a0SKP Singh LSM_HOOK(int, 0, path_rename, const struct path *old_dir, 10298e828a0SKP Singh struct dentry *old_dentry, const struct path *new_dir, 103100f59d9SMickaël Salaün struct dentry *new_dentry, unsigned int flags) 10498e828a0SKP Singh LSM_HOOK(int, 0, path_chmod, const struct path *path, umode_t mode) 10598e828a0SKP Singh LSM_HOOK(int, 0, path_chown, const struct path *path, kuid_t uid, kgid_t gid) 10698e828a0SKP Singh LSM_HOOK(int, 0, path_chroot, const struct path *path) 10798e828a0SKP Singh #endif /* CONFIG_SECURITY_PATH */ 10898e828a0SKP Singh 10998e828a0SKP Singh /* Needed for inode based security check */ 11098e828a0SKP Singh LSM_HOOK(int, 0, path_notify, const struct path *path, u64 mask, 11198e828a0SKP Singh unsigned int obj_type) 11298e828a0SKP Singh LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode) 11398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode) 11498e828a0SKP Singh LSM_HOOK(int, 0, inode_init_security, struct inode *inode, 11598e828a0SKP Singh struct inode *dir, const struct qstr *qstr, const char **name, 11698e828a0SKP Singh void **value, size_t *len) 117215b674bSLokesh Gidra LSM_HOOK(int, 0, inode_init_security_anon, struct inode *inode, 118215b674bSLokesh Gidra const struct qstr *name, const struct inode *context_inode) 11998e828a0SKP Singh LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentry, 12098e828a0SKP Singh umode_t mode) 12198e828a0SKP Singh LSM_HOOK(int, 0, inode_link, struct dentry *old_dentry, struct inode *dir, 12298e828a0SKP Singh struct dentry *new_dentry) 12398e828a0SKP Singh LSM_HOOK(int, 0, inode_unlink, struct inode *dir, struct dentry *dentry) 12498e828a0SKP Singh LSM_HOOK(int, 0, inode_symlink, struct inode *dir, struct dentry *dentry, 12598e828a0SKP Singh const char *old_name) 12698e828a0SKP Singh LSM_HOOK(int, 0, inode_mkdir, struct inode *dir, struct dentry *dentry, 12798e828a0SKP Singh umode_t mode) 12898e828a0SKP Singh LSM_HOOK(int, 0, inode_rmdir, struct inode *dir, struct dentry *dentry) 12998e828a0SKP Singh LSM_HOOK(int, 0, inode_mknod, struct inode *dir, struct dentry *dentry, 13098e828a0SKP Singh umode_t mode, dev_t dev) 13198e828a0SKP Singh LSM_HOOK(int, 0, inode_rename, struct inode *old_dir, struct dentry *old_dentry, 13298e828a0SKP Singh struct inode *new_dir, struct dentry *new_dentry) 13398e828a0SKP Singh LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry) 13498e828a0SKP Singh LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode, 13598e828a0SKP Singh bool rcu) 13698e828a0SKP Singh LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask) 13798e828a0SKP Singh LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr) 13898e828a0SKP Singh LSM_HOOK(int, 0, inode_getattr, const struct path *path) 13939f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_setxattr, struct mnt_idmap *idmap, 14071bc356fSChristian Brauner struct dentry *dentry, const char *name, const void *value, 14171bc356fSChristian Brauner size_t size, int flags) 14298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_post_setxattr, struct dentry *dentry, 14398e828a0SKP Singh const char *name, const void *value, size_t size, int flags) 14498e828a0SKP Singh LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name) 14598e828a0SKP Singh LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry) 14639f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_removexattr, struct mnt_idmap *idmap, 14771bc356fSChristian Brauner struct dentry *dentry, const char *name) 148700b7940SChristian Brauner LSM_HOOK(int, 0, inode_set_acl, struct mnt_idmap *idmap, 14972b3897eSChristian Brauner struct dentry *dentry, const char *acl_name, struct posix_acl *kacl) 150700b7940SChristian Brauner LSM_HOOK(int, 0, inode_get_acl, struct mnt_idmap *idmap, 15172b3897eSChristian Brauner struct dentry *dentry, const char *acl_name) 152700b7940SChristian Brauner LSM_HOOK(int, 0, inode_remove_acl, struct mnt_idmap *idmap, 15372b3897eSChristian Brauner struct dentry *dentry, const char *acl_name) 15498e828a0SKP Singh LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry) 15539f60c1cSChristian Brauner LSM_HOOK(int, 0, inode_killpriv, struct mnt_idmap *idmap, 15671bc356fSChristian Brauner struct dentry *dentry) 1574609e1f1SChristian Brauner LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct mnt_idmap *idmap, 15871bc356fSChristian Brauner struct inode *inode, const char *name, void **buffer, bool alloc) 15998e828a0SKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode, 16098e828a0SKP Singh const char *name, const void *value, size_t size, int flags) 16198e828a0SKP Singh LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer, 16298e828a0SKP Singh size_t buffer_size) 16398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid) 16498e828a0SKP Singh LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new) 16523e390cdSKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, const char *name) 16698e828a0SKP Singh LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir, 16798e828a0SKP Singh struct kernfs_node *kn) 16898e828a0SKP Singh LSM_HOOK(int, 0, file_permission, struct file *file, int mask) 16998e828a0SKP Singh LSM_HOOK(int, 0, file_alloc_security, struct file *file) 17098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) 17198e828a0SKP Singh LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, 17298e828a0SKP Singh unsigned long arg) 17398e828a0SKP Singh LSM_HOOK(int, 0, mmap_addr, unsigned long addr) 17498e828a0SKP Singh LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, 17598e828a0SKP Singh unsigned long prot, unsigned long flags) 17698e828a0SKP Singh LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma, 17798e828a0SKP Singh unsigned long reqprot, unsigned long prot) 17898e828a0SKP Singh LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd) 17998e828a0SKP Singh LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd, 18098e828a0SKP Singh unsigned long arg) 18198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file) 18298e828a0SKP Singh LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk, 18398e828a0SKP Singh struct fown_struct *fown, int sig) 18498e828a0SKP Singh LSM_HOOK(int, 0, file_receive, struct file *file) 18598e828a0SKP Singh LSM_HOOK(int, 0, file_open, struct file *file) 1863350607dSGünther Noack LSM_HOOK(int, 0, file_truncate, struct file *file) 18798e828a0SKP Singh LSM_HOOK(int, 0, task_alloc, struct task_struct *task, 18898e828a0SKP Singh unsigned long clone_flags) 18998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) 19098e828a0SKP Singh LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) 19198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) 19298e828a0SKP Singh LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old, 19398e828a0SKP Singh gfp_t gfp) 19498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new, 19598e828a0SKP Singh const struct cred *old) 19698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid) 19798e828a0SKP Singh LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid) 19898e828a0SKP Singh LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) 19998e828a0SKP Singh LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) 200b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents) 201b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size, 202200da27aSNathan Chancellor enum kernel_load_data_id id, char *description) 20398e828a0SKP Singh LSM_HOOK(int, 0, kernel_read_file, struct file *file, 2042039bda1SKees Cook enum kernel_read_file_id id, bool contents) 20598e828a0SKP Singh LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, 20698e828a0SKP Singh loff_t size, enum kernel_read_file_id id) 20798e828a0SKP Singh LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old, 20898e828a0SKP Singh int flags) 20939030e13SThomas Cedeno LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old, 21039030e13SThomas Cedeno int flags) 211fcfe0ac2SMicah Morton LSM_HOOK(int, 0, task_fix_setgroups, struct cred *new, const struct cred * old) 21298e828a0SKP Singh LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid) 21398e828a0SKP Singh LSM_HOOK(int, 0, task_getpgid, struct task_struct *p) 21498e828a0SKP Singh LSM_HOOK(int, 0, task_getsid, struct task_struct *p) 2156326948fSPaul Moore LSM_HOOK(void, LSM_RET_VOID, current_getsecid_subj, u32 *secid) 2164ebd7651SPaul Moore LSM_HOOK(void, LSM_RET_VOID, task_getsecid_obj, 2174ebd7651SPaul Moore struct task_struct *p, u32 *secid) 21898e828a0SKP Singh LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice) 21998e828a0SKP Singh LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio) 22098e828a0SKP Singh LSM_HOOK(int, 0, task_getioprio, struct task_struct *p) 22198e828a0SKP Singh LSM_HOOK(int, 0, task_prlimit, const struct cred *cred, 22298e828a0SKP Singh const struct cred *tcred, unsigned int flags) 22398e828a0SKP Singh LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource, 22498e828a0SKP Singh struct rlimit *new_rlim) 22598e828a0SKP Singh LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p) 22698e828a0SKP Singh LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p) 22798e828a0SKP Singh LSM_HOOK(int, 0, task_movememory, struct task_struct *p) 22898e828a0SKP Singh LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info, 22998e828a0SKP Singh int sig, const struct cred *cred) 23098e828a0SKP Singh LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2, 23198e828a0SKP Singh unsigned long arg3, unsigned long arg4, unsigned long arg5) 23298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p, 23398e828a0SKP Singh struct inode *inode) 2347cd4c5c2SFrederick Lawler LSM_HOOK(int, 0, userns_create, const struct cred *cred) 23598e828a0SKP Singh LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag) 23698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp, 23798e828a0SKP Singh u32 *secid) 23898e828a0SKP Singh LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg) 23998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg) 24098e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm) 24198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security, 24298e828a0SKP Singh struct kern_ipc_perm *perm) 24398e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg) 24498e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd) 24598e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm, 24698e828a0SKP Singh struct msg_msg *msg, int msqflg) 24798e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm, 24898e828a0SKP Singh struct msg_msg *msg, struct task_struct *target, long type, int mode) 24998e828a0SKP Singh LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm) 25098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm) 25198e828a0SKP Singh LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg) 25298e828a0SKP Singh LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd) 25398e828a0SKP Singh LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr, 25498e828a0SKP Singh int shmflg) 25598e828a0SKP Singh LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm) 25698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm) 25798e828a0SKP Singh LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg) 25898e828a0SKP Singh LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd) 25998e828a0SKP Singh LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops, 26098e828a0SKP Singh unsigned nsops, int alter) 26198e828a0SKP Singh LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb) 26298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry, 26398e828a0SKP Singh struct inode *inode) 264c8e477c6SAl Viro LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, const char *name, 26598e828a0SKP Singh char **value) 26698e828a0SKP Singh LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) 26798e828a0SKP Singh LSM_HOOK(int, 0, ismaclabel, const char *name) 268625236baSAnders Roxell LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata, 26998e828a0SKP Singh u32 *seclen) 27098e828a0SKP Singh LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) 27198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen) 27298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) 27398e828a0SKP Singh LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) 27498e828a0SKP Singh LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) 27598e828a0SKP Singh LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx, 27698e828a0SKP Singh u32 *ctxlen) 27798e828a0SKP Singh 278344fa64eSDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) 279344fa64eSDavid Howells LSM_HOOK(int, 0, post_notification, const struct cred *w_cred, 280344fa64eSDavid Howells const struct cred *cred, struct watch_notification *n) 281998f5040SDavid Howells #endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */ 282998f5040SDavid Howells 283998f5040SDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS) 284998f5040SDavid Howells LSM_HOOK(int, 0, watch_key, struct key *key) 285344fa64eSDavid Howells #endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */ 286344fa64eSDavid Howells 28798e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK 28898e828a0SKP Singh LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other, 28998e828a0SKP Singh struct sock *newsk) 29098e828a0SKP Singh LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other) 29198e828a0SKP Singh LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern) 29298e828a0SKP Singh LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type, 29398e828a0SKP Singh int protocol, int kern) 29498e828a0SKP Singh LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb) 29598e828a0SKP Singh LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address, 29698e828a0SKP Singh int addrlen) 29798e828a0SKP Singh LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address, 29898e828a0SKP Singh int addrlen) 29998e828a0SKP Singh LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog) 30098e828a0SKP Singh LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock) 30198e828a0SKP Singh LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg, 30298e828a0SKP Singh int size) 30398e828a0SKP Singh LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg, 30498e828a0SKP Singh int size, int flags) 30598e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockname, struct socket *sock) 30698e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeername, struct socket *sock) 30798e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) 30898e828a0SKP Singh LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname) 30998e828a0SKP Singh LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how) 31098e828a0SKP Singh LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb) 31198e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock, 312b10b9c34SPaul Moore sockptr_t optval, sockptr_t optlen, unsigned int len) 31398e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock, 31498e828a0SKP Singh struct sk_buff *skb, u32 *secid) 31598e828a0SKP Singh LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority) 31698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk) 31798e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk, 31898e828a0SKP Singh struct sock *newsk) 319*5b52ad34SGuillaume Nault LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, const struct sock *sk, u32 *secid) 32098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent) 32141dd9596SFlorian Westphal LSM_HOOK(int, 0, inet_conn_request, const struct sock *sk, struct sk_buff *skb, 32298e828a0SKP Singh struct request_sock *req) 32398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk, 32498e828a0SKP Singh const struct request_sock *req) 32598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk, 32698e828a0SKP Singh struct sk_buff *skb) 32798e828a0SKP Singh LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid) 32898e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void) 32998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void) 33098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req, 3313df98d79SPaul Moore struct flowi_common *flic) 33298e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_alloc_security, void **security) 33398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security) 33498e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_create, void) 33598e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach_queue, void *security) 33698e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security) 33798e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_open, void *security) 338c081d53fSXin Long LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_association *asoc, 33998e828a0SKP Singh struct sk_buff *skb) 34098e828a0SKP Singh LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname, 34198e828a0SKP Singh struct sockaddr *address, int addrlen) 342c081d53fSXin Long LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_association *asoc, 34398e828a0SKP Singh struct sock *sk, struct sock *newsk) 3445e50f5d4SOndrej Mosnacek LSM_HOOK(int, 0, sctp_assoc_established, struct sctp_association *asoc, 3455e50f5d4SOndrej Mosnacek struct sk_buff *skb) 346e3d9387fSPaolo Abeni LSM_HOOK(int, 0, mptcp_add_subflow, struct sock *sk, struct sock *ssk) 34798e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK */ 34898e828a0SKP Singh 34998e828a0SKP Singh #ifdef CONFIG_SECURITY_INFINIBAND 35098e828a0SKP Singh LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey) 35198e828a0SKP Singh LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name, 35298e828a0SKP Singh u8 port_num) 35398e828a0SKP Singh LSM_HOOK(int, 0, ib_alloc_security, void **sec) 35498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec) 35598e828a0SKP Singh #endif /* CONFIG_SECURITY_INFINIBAND */ 35698e828a0SKP Singh 35798e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK_XFRM 35898e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp, 35998e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp) 36098e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx, 36198e828a0SKP Singh struct xfrm_sec_ctx **new_ctx) 36298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security, 36398e828a0SKP Singh struct xfrm_sec_ctx *ctx) 36498e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx) 36598e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x, 36698e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx) 36798e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x, 36898e828a0SKP Singh struct xfrm_sec_ctx *polsec, u32 secid) 36998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x) 37098e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x) 3718a922805SZhongjun Tan LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid) 37298e828a0SKP Singh LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x, 3733df98d79SPaul Moore struct xfrm_policy *xp, const struct flowi_common *flic) 37498e828a0SKP Singh LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid, 37598e828a0SKP Singh int ckall) 37698e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK_XFRM */ 37798e828a0SKP Singh 37898e828a0SKP Singh /* key management security hooks */ 37998e828a0SKP Singh #ifdef CONFIG_KEYS 38098e828a0SKP Singh LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, 38198e828a0SKP Singh unsigned long flags) 38298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) 38398e828a0SKP Singh LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, 3844bc799dcSSami Tolvanen enum key_need_perm need_perm) 385b3816cf8SPaul Moore LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **buffer) 38698e828a0SKP Singh #endif /* CONFIG_KEYS */ 38798e828a0SKP Singh 38898e828a0SKP Singh #ifdef CONFIG_AUDIT 38998e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr, 39098e828a0SKP Singh void **lsmrule) 39198e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule) 39298e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule) 39398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule) 39498e828a0SKP Singh #endif /* CONFIG_AUDIT */ 39598e828a0SKP Singh 39698e828a0SKP Singh #ifdef CONFIG_BPF_SYSCALL 39798e828a0SKP Singh LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size) 39898e828a0SKP Singh LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode) 39998e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog) 40098e828a0SKP Singh LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map) 40198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map) 40298e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux) 40398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) 40498e828a0SKP Singh #endif /* CONFIG_BPF_SYSCALL */ 40598e828a0SKP Singh 40698e828a0SKP Singh LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) 40798e828a0SKP Singh 40898e828a0SKP Singh #ifdef CONFIG_PERF_EVENTS 40998e828a0SKP Singh LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) 41098e828a0SKP Singh LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event) 41198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event) 41298e828a0SKP Singh LSM_HOOK(int, 0, perf_event_read, struct perf_event *event) 41398e828a0SKP Singh LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) 41498e828a0SKP Singh #endif /* CONFIG_PERF_EVENTS */ 415cdc1404aSPaul Moore 416cdc1404aSPaul Moore #ifdef CONFIG_IO_URING 417cdc1404aSPaul Moore LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) 418cdc1404aSPaul Moore LSM_HOOK(int, 0, uring_sqpoll, void) 4192a584012SLuis Chamberlain LSM_HOOK(int, 0, uring_cmd, struct io_uring_cmd *ioucmd) 420cdc1404aSPaul Moore #endif /* CONFIG_IO_URING */ 421