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 */ 2998e828a0SKP Singh LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr) 3098e828a0SKP Singh LSM_HOOK(int, 0, binder_transaction, struct task_struct *from, 3198e828a0SKP Singh struct task_struct *to) 3298e828a0SKP Singh LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from, 3398e828a0SKP Singh struct task_struct *to) 3498e828a0SKP Singh LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from, 3598e828a0SKP Singh struct task_struct *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, sb_add_mnt_opt, const char *option, const char *val, 8298e828a0SKP Singh int len, void **mnt_opts) 8398e828a0SKP Singh LSM_HOOK(int, 0, move_mount, const struct path *from_path, 8498e828a0SKP Singh const struct path *to_path) 8598e828a0SKP Singh LSM_HOOK(int, 0, dentry_init_security, struct dentry *dentry, 8698e828a0SKP Singh int mode, const struct qstr *name, 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, 10498e828a0SKP Singh struct dentry *new_dentry) 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) 11598e828a0SKP Singh LSM_HOOK(int, 0, inode_init_security, struct inode *inode, 11698e828a0SKP Singh struct inode *dir, const struct qstr *qstr, const char **name, 11798e828a0SKP Singh void **value, size_t *len) 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) 14071bc356fSChristian Brauner LSM_HOOK(int, 0, inode_setxattr, struct user_namespace *mnt_userns, 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) 14771bc356fSChristian Brauner LSM_HOOK(int, 0, inode_removexattr, struct user_namespace *mnt_userns, 14871bc356fSChristian Brauner struct dentry *dentry, const char *name) 14998e828a0SKP Singh LSM_HOOK(int, 0, inode_need_killpriv, struct dentry *dentry) 15071bc356fSChristian Brauner LSM_HOOK(int, 0, inode_killpriv, struct user_namespace *mnt_userns, 15171bc356fSChristian Brauner struct dentry *dentry) 15271bc356fSChristian Brauner LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct user_namespace *mnt_userns, 15371bc356fSChristian Brauner struct inode *inode, const char *name, void **buffer, bool alloc) 15498e828a0SKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_setsecurity, struct inode *inode, 15598e828a0SKP Singh const char *name, const void *value, size_t size, int flags) 15698e828a0SKP Singh LSM_HOOK(int, 0, inode_listsecurity, struct inode *inode, char *buffer, 15798e828a0SKP Singh size_t buffer_size) 15898e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_getsecid, struct inode *inode, u32 *secid) 15998e828a0SKP Singh LSM_HOOK(int, 0, inode_copy_up, struct dentry *src, struct cred **new) 16023e390cdSKP Singh LSM_HOOK(int, -EOPNOTSUPP, inode_copy_up_xattr, const char *name) 16198e828a0SKP Singh LSM_HOOK(int, 0, kernfs_init_security, struct kernfs_node *kn_dir, 16298e828a0SKP Singh struct kernfs_node *kn) 16398e828a0SKP Singh LSM_HOOK(int, 0, file_permission, struct file *file, int mask) 16498e828a0SKP Singh LSM_HOOK(int, 0, file_alloc_security, struct file *file) 16598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) 16698e828a0SKP Singh LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, 16798e828a0SKP Singh unsigned long arg) 16898e828a0SKP Singh LSM_HOOK(int, 0, mmap_addr, unsigned long addr) 16998e828a0SKP Singh LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, 17098e828a0SKP Singh unsigned long prot, unsigned long flags) 17198e828a0SKP Singh LSM_HOOK(int, 0, file_mprotect, struct vm_area_struct *vma, 17298e828a0SKP Singh unsigned long reqprot, unsigned long prot) 17398e828a0SKP Singh LSM_HOOK(int, 0, file_lock, struct file *file, unsigned int cmd) 17498e828a0SKP Singh LSM_HOOK(int, 0, file_fcntl, struct file *file, unsigned int cmd, 17598e828a0SKP Singh unsigned long arg) 17698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, file_set_fowner, struct file *file) 17798e828a0SKP Singh LSM_HOOK(int, 0, file_send_sigiotask, struct task_struct *tsk, 17898e828a0SKP Singh struct fown_struct *fown, int sig) 17998e828a0SKP Singh LSM_HOOK(int, 0, file_receive, struct file *file) 18098e828a0SKP Singh LSM_HOOK(int, 0, file_open, struct file *file) 18198e828a0SKP Singh LSM_HOOK(int, 0, task_alloc, struct task_struct *task, 18298e828a0SKP Singh unsigned long clone_flags) 18398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task) 18498e828a0SKP Singh LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp) 18598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred) 18698e828a0SKP Singh LSM_HOOK(int, 0, cred_prepare, struct cred *new, const struct cred *old, 18798e828a0SKP Singh gfp_t gfp) 18898e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_transfer, struct cred *new, 18998e828a0SKP Singh const struct cred *old) 19098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, cred_getsecid, const struct cred *c, u32 *secid) 19198e828a0SKP Singh LSM_HOOK(int, 0, kernel_act_as, struct cred *new, u32 secid) 19298e828a0SKP Singh LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode) 19398e828a0SKP Singh LSM_HOOK(int, 0, kernel_module_request, char *kmod_name) 194b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents) 195b64fcae7SKees Cook LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size, 196200da27aSNathan Chancellor enum kernel_load_data_id id, char *description) 19798e828a0SKP Singh LSM_HOOK(int, 0, kernel_read_file, struct file *file, 1982039bda1SKees Cook enum kernel_read_file_id id, bool contents) 19998e828a0SKP Singh LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf, 20098e828a0SKP Singh loff_t size, enum kernel_read_file_id id) 20198e828a0SKP Singh LSM_HOOK(int, 0, task_fix_setuid, struct cred *new, const struct cred *old, 20298e828a0SKP Singh int flags) 20339030e13SThomas Cedeno LSM_HOOK(int, 0, task_fix_setgid, struct cred *new, const struct cred * old, 20439030e13SThomas Cedeno int flags) 20598e828a0SKP Singh LSM_HOOK(int, 0, task_setpgid, struct task_struct *p, pid_t pgid) 20698e828a0SKP Singh LSM_HOOK(int, 0, task_getpgid, struct task_struct *p) 20798e828a0SKP Singh LSM_HOOK(int, 0, task_getsid, struct task_struct *p) 2084ebd7651SPaul Moore LSM_HOOK(void, LSM_RET_VOID, task_getsecid_subj, 2094ebd7651SPaul Moore struct task_struct *p, u32 *secid) 2104ebd7651SPaul Moore LSM_HOOK(void, LSM_RET_VOID, task_getsecid_obj, 2114ebd7651SPaul Moore struct task_struct *p, u32 *secid) 21298e828a0SKP Singh LSM_HOOK(int, 0, task_setnice, struct task_struct *p, int nice) 21398e828a0SKP Singh LSM_HOOK(int, 0, task_setioprio, struct task_struct *p, int ioprio) 21498e828a0SKP Singh LSM_HOOK(int, 0, task_getioprio, struct task_struct *p) 21598e828a0SKP Singh LSM_HOOK(int, 0, task_prlimit, const struct cred *cred, 21698e828a0SKP Singh const struct cred *tcred, unsigned int flags) 21798e828a0SKP Singh LSM_HOOK(int, 0, task_setrlimit, struct task_struct *p, unsigned int resource, 21898e828a0SKP Singh struct rlimit *new_rlim) 21998e828a0SKP Singh LSM_HOOK(int, 0, task_setscheduler, struct task_struct *p) 22098e828a0SKP Singh LSM_HOOK(int, 0, task_getscheduler, struct task_struct *p) 22198e828a0SKP Singh LSM_HOOK(int, 0, task_movememory, struct task_struct *p) 22298e828a0SKP Singh LSM_HOOK(int, 0, task_kill, struct task_struct *p, struct kernel_siginfo *info, 22398e828a0SKP Singh int sig, const struct cred *cred) 22498e828a0SKP Singh LSM_HOOK(int, -ENOSYS, task_prctl, int option, unsigned long arg2, 22598e828a0SKP Singh unsigned long arg3, unsigned long arg4, unsigned long arg5) 22698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p, 22798e828a0SKP Singh struct inode *inode) 22898e828a0SKP Singh LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag) 22998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp, 23098e828a0SKP Singh u32 *secid) 23198e828a0SKP Singh LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg) 23298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg) 23398e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm) 23498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, msg_queue_free_security, 23598e828a0SKP Singh struct kern_ipc_perm *perm) 23698e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_associate, struct kern_ipc_perm *perm, int msqflg) 23798e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgctl, struct kern_ipc_perm *perm, int cmd) 23898e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgsnd, struct kern_ipc_perm *perm, 23998e828a0SKP Singh struct msg_msg *msg, int msqflg) 24098e828a0SKP Singh LSM_HOOK(int, 0, msg_queue_msgrcv, struct kern_ipc_perm *perm, 24198e828a0SKP Singh struct msg_msg *msg, struct task_struct *target, long type, int mode) 24298e828a0SKP Singh LSM_HOOK(int, 0, shm_alloc_security, struct kern_ipc_perm *perm) 24398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, shm_free_security, struct kern_ipc_perm *perm) 24498e828a0SKP Singh LSM_HOOK(int, 0, shm_associate, struct kern_ipc_perm *perm, int shmflg) 24598e828a0SKP Singh LSM_HOOK(int, 0, shm_shmctl, struct kern_ipc_perm *perm, int cmd) 24698e828a0SKP Singh LSM_HOOK(int, 0, shm_shmat, struct kern_ipc_perm *perm, char __user *shmaddr, 24798e828a0SKP Singh int shmflg) 24898e828a0SKP Singh LSM_HOOK(int, 0, sem_alloc_security, struct kern_ipc_perm *perm) 24998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sem_free_security, struct kern_ipc_perm *perm) 25098e828a0SKP Singh LSM_HOOK(int, 0, sem_associate, struct kern_ipc_perm *perm, int semflg) 25198e828a0SKP Singh LSM_HOOK(int, 0, sem_semctl, struct kern_ipc_perm *perm, int cmd) 25298e828a0SKP Singh LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops, 25398e828a0SKP Singh unsigned nsops, int alter) 25498e828a0SKP Singh LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb) 25598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry, 25698e828a0SKP Singh struct inode *inode) 25798e828a0SKP Singh LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name, 25898e828a0SKP Singh char **value) 25998e828a0SKP Singh LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) 26098e828a0SKP Singh LSM_HOOK(int, 0, ismaclabel, const char *name) 261625236baSAnders Roxell LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata, 26298e828a0SKP Singh u32 *seclen) 26398e828a0SKP Singh LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) 26498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen) 26598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) 26698e828a0SKP Singh LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) 26798e828a0SKP Singh LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) 26898e828a0SKP Singh LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx, 26998e828a0SKP Singh u32 *ctxlen) 27098e828a0SKP Singh 271344fa64eSDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) 272344fa64eSDavid Howells LSM_HOOK(int, 0, post_notification, const struct cred *w_cred, 273344fa64eSDavid Howells const struct cred *cred, struct watch_notification *n) 274998f5040SDavid Howells #endif /* CONFIG_SECURITY && CONFIG_WATCH_QUEUE */ 275998f5040SDavid Howells 276998f5040SDavid Howells #if defined(CONFIG_SECURITY) && defined(CONFIG_KEY_NOTIFICATIONS) 277998f5040SDavid Howells LSM_HOOK(int, 0, watch_key, struct key *key) 278344fa64eSDavid Howells #endif /* CONFIG_SECURITY && CONFIG_KEY_NOTIFICATIONS */ 279344fa64eSDavid Howells 28098e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK 28198e828a0SKP Singh LSM_HOOK(int, 0, unix_stream_connect, struct sock *sock, struct sock *other, 28298e828a0SKP Singh struct sock *newsk) 28398e828a0SKP Singh LSM_HOOK(int, 0, unix_may_send, struct socket *sock, struct socket *other) 28498e828a0SKP Singh LSM_HOOK(int, 0, socket_create, int family, int type, int protocol, int kern) 28598e828a0SKP Singh LSM_HOOK(int, 0, socket_post_create, struct socket *sock, int family, int type, 28698e828a0SKP Singh int protocol, int kern) 28798e828a0SKP Singh LSM_HOOK(int, 0, socket_socketpair, struct socket *socka, struct socket *sockb) 28898e828a0SKP Singh LSM_HOOK(int, 0, socket_bind, struct socket *sock, struct sockaddr *address, 28998e828a0SKP Singh int addrlen) 29098e828a0SKP Singh LSM_HOOK(int, 0, socket_connect, struct socket *sock, struct sockaddr *address, 29198e828a0SKP Singh int addrlen) 29298e828a0SKP Singh LSM_HOOK(int, 0, socket_listen, struct socket *sock, int backlog) 29398e828a0SKP Singh LSM_HOOK(int, 0, socket_accept, struct socket *sock, struct socket *newsock) 29498e828a0SKP Singh LSM_HOOK(int, 0, socket_sendmsg, struct socket *sock, struct msghdr *msg, 29598e828a0SKP Singh int size) 29698e828a0SKP Singh LSM_HOOK(int, 0, socket_recvmsg, struct socket *sock, struct msghdr *msg, 29798e828a0SKP Singh int size, int flags) 29898e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockname, struct socket *sock) 29998e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeername, struct socket *sock) 30098e828a0SKP Singh LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) 30198e828a0SKP Singh LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname) 30298e828a0SKP Singh LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how) 30398e828a0SKP Singh LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb) 30498e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock, 30598e828a0SKP Singh char __user *optval, int __user *optlen, unsigned len) 30698e828a0SKP Singh LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock, 30798e828a0SKP Singh struct sk_buff *skb, u32 *secid) 30898e828a0SKP Singh LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority) 30998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk) 31098e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_clone_security, const struct sock *sk, 31198e828a0SKP Singh struct sock *newsk) 31298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sk_getsecid, struct sock *sk, u32 *secid) 31398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sock_graft, struct sock *sk, struct socket *parent) 31441dd9596SFlorian Westphal LSM_HOOK(int, 0, inet_conn_request, const struct sock *sk, struct sk_buff *skb, 31598e828a0SKP Singh struct request_sock *req) 31698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_csk_clone, struct sock *newsk, 31798e828a0SKP Singh const struct request_sock *req) 31898e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, inet_conn_established, struct sock *sk, 31998e828a0SKP Singh struct sk_buff *skb) 32098e828a0SKP Singh LSM_HOOK(int, 0, secmark_relabel_packet, u32 secid) 32198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_inc, void) 32298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, secmark_refcount_dec, void) 32398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, req_classify_flow, const struct request_sock *req, 3243df98d79SPaul Moore struct flowi_common *flic) 32598e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_alloc_security, void **security) 32698e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, tun_dev_free_security, void *security) 32798e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_create, void) 32898e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach_queue, void *security) 32998e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security) 33098e828a0SKP Singh LSM_HOOK(int, 0, tun_dev_open, void *security) 33198e828a0SKP Singh LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep, 33298e828a0SKP Singh struct sk_buff *skb) 33398e828a0SKP Singh LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname, 33498e828a0SKP Singh struct sockaddr *address, int addrlen) 33598e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_endpoint *ep, 33698e828a0SKP Singh struct sock *sk, struct sock *newsk) 33798e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK */ 33898e828a0SKP Singh 33998e828a0SKP Singh #ifdef CONFIG_SECURITY_INFINIBAND 34098e828a0SKP Singh LSM_HOOK(int, 0, ib_pkey_access, void *sec, u64 subnet_prefix, u16 pkey) 34198e828a0SKP Singh LSM_HOOK(int, 0, ib_endport_manage_subnet, void *sec, const char *dev_name, 34298e828a0SKP Singh u8 port_num) 34398e828a0SKP Singh LSM_HOOK(int, 0, ib_alloc_security, void **sec) 34498e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, ib_free_security, void *sec) 34598e828a0SKP Singh #endif /* CONFIG_SECURITY_INFINIBAND */ 34698e828a0SKP Singh 34798e828a0SKP Singh #ifdef CONFIG_SECURITY_NETWORK_XFRM 34898e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_alloc_security, struct xfrm_sec_ctx **ctxp, 34998e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp) 35098e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_clone_security, struct xfrm_sec_ctx *old_ctx, 35198e828a0SKP Singh struct xfrm_sec_ctx **new_ctx) 35298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_policy_free_security, 35398e828a0SKP Singh struct xfrm_sec_ctx *ctx) 35498e828a0SKP Singh LSM_HOOK(int, 0, xfrm_policy_delete_security, struct xfrm_sec_ctx *ctx) 35598e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc, struct xfrm_state *x, 35698e828a0SKP Singh struct xfrm_user_sec_ctx *sec_ctx) 35798e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_alloc_acquire, struct xfrm_state *x, 35898e828a0SKP Singh struct xfrm_sec_ctx *polsec, u32 secid) 35998e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, xfrm_state_free_security, struct xfrm_state *x) 36098e828a0SKP Singh LSM_HOOK(int, 0, xfrm_state_delete_security, struct xfrm_state *x) 361*8a922805SZhongjun Tan LSM_HOOK(int, 0, xfrm_policy_lookup, struct xfrm_sec_ctx *ctx, u32 fl_secid) 36298e828a0SKP Singh LSM_HOOK(int, 1, xfrm_state_pol_flow_match, struct xfrm_state *x, 3633df98d79SPaul Moore struct xfrm_policy *xp, const struct flowi_common *flic) 36498e828a0SKP Singh LSM_HOOK(int, 0, xfrm_decode_session, struct sk_buff *skb, u32 *secid, 36598e828a0SKP Singh int ckall) 36698e828a0SKP Singh #endif /* CONFIG_SECURITY_NETWORK_XFRM */ 36798e828a0SKP Singh 36898e828a0SKP Singh /* key management security hooks */ 36998e828a0SKP Singh #ifdef CONFIG_KEYS 37098e828a0SKP Singh LSM_HOOK(int, 0, key_alloc, struct key *key, const struct cred *cred, 37198e828a0SKP Singh unsigned long flags) 37298e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, key_free, struct key *key) 37398e828a0SKP Singh LSM_HOOK(int, 0, key_permission, key_ref_t key_ref, const struct cred *cred, 3744bc799dcSSami Tolvanen enum key_need_perm need_perm) 37598e828a0SKP Singh LSM_HOOK(int, 0, key_getsecurity, struct key *key, char **_buffer) 37698e828a0SKP Singh #endif /* CONFIG_KEYS */ 37798e828a0SKP Singh 37898e828a0SKP Singh #ifdef CONFIG_AUDIT 37998e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_init, u32 field, u32 op, char *rulestr, 38098e828a0SKP Singh void **lsmrule) 38198e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_known, struct audit_krule *krule) 38298e828a0SKP Singh LSM_HOOK(int, 0, audit_rule_match, u32 secid, u32 field, u32 op, void *lsmrule) 38398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, audit_rule_free, void *lsmrule) 38498e828a0SKP Singh #endif /* CONFIG_AUDIT */ 38598e828a0SKP Singh 38698e828a0SKP Singh #ifdef CONFIG_BPF_SYSCALL 38798e828a0SKP Singh LSM_HOOK(int, 0, bpf, int cmd, union bpf_attr *attr, unsigned int size) 38898e828a0SKP Singh LSM_HOOK(int, 0, bpf_map, struct bpf_map *map, fmode_t fmode) 38998e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog, struct bpf_prog *prog) 39098e828a0SKP Singh LSM_HOOK(int, 0, bpf_map_alloc_security, struct bpf_map *map) 39198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_map_free_security, struct bpf_map *map) 39298e828a0SKP Singh LSM_HOOK(int, 0, bpf_prog_alloc_security, struct bpf_prog_aux *aux) 39398e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux) 39498e828a0SKP Singh #endif /* CONFIG_BPF_SYSCALL */ 39598e828a0SKP Singh 39698e828a0SKP Singh LSM_HOOK(int, 0, locked_down, enum lockdown_reason what) 39798e828a0SKP Singh 39898e828a0SKP Singh #ifdef CONFIG_PERF_EVENTS 39998e828a0SKP Singh LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type) 40098e828a0SKP Singh LSM_HOOK(int, 0, perf_event_alloc, struct perf_event *event) 40198e828a0SKP Singh LSM_HOOK(void, LSM_RET_VOID, perf_event_free, struct perf_event *event) 40298e828a0SKP Singh LSM_HOOK(int, 0, perf_event_read, struct perf_event *event) 40398e828a0SKP Singh LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) 40498e828a0SKP Singh #endif /* CONFIG_PERF_EVENTS */ 405