Lines Matching refs:file
1742 struct file *file, in file_path_has_perm() argument
1748 ad.u.file = file; in file_path_has_perm()
1749 return inode_has_perm(cred, file_inode(file), av, &ad); in file_path_has_perm()
1753 static int bpf_fd_pass(struct file *file, u32 sid);
1765 struct file *file, in file_has_perm() argument
1768 struct file_security_struct *fsec = selinux_file(file); in file_has_perm()
1769 struct inode *inode = file_inode(file); in file_has_perm()
1775 ad.u.file = file; in file_has_perm()
1788 rc = bpf_fd_pass(file, cred_sid(cred)); in file_has_perm()
2026 static inline u32 file_to_av(struct file *file) in file_to_av() argument
2030 if (file->f_mode & FMODE_READ) in file_to_av()
2032 if (file->f_mode & FMODE_WRITE) { in file_to_av()
2033 if (file->f_flags & O_APPEND) in file_to_av()
2052 static inline u32 open_file_to_av(struct file *file) in open_file_to_av() argument
2054 u32 av = file_to_av(file); in open_file_to_av()
2055 struct inode *inode = file_inode(file); in open_file_to_av()
2104 struct file *file) in selinux_binder_transfer_file() argument
2107 struct file_security_struct *fsec = selinux_file(file); in selinux_binder_transfer_file()
2108 struct dentry *dentry = file->f_path.dentry; in selinux_binder_transfer_file()
2114 ad.u.path = file->f_path; in selinux_binder_transfer_file()
2127 rc = bpf_fd_pass(file, sid); in selinux_binder_transfer_file()
2137 sid, isec->sid, isec->sclass, file_to_av(file), in selinux_binder_transfer_file()
2302 int nosuid = !mnt_may_suid(bprm->file->f_path.mnt); in check_nnp_nosuid()
2357 struct inode *inode = file_inode(bprm->file); in selinux_bprm_creds_for_exec()
2403 ad.u.file = bprm->file; in selinux_bprm_creds_for_exec()
2465 static int match_file(const void *p, struct file *file, unsigned fd) in match_file() argument
2467 return file_has_perm(p, file, file_to_av(file)) ? fd + 1 : 0; in match_file()
2474 struct file *file, *devnull = NULL; in flush_unauthorized_files() local
2492 file = file_priv->file; in flush_unauthorized_files()
2493 if (file_path_has_perm(cred, file, FILE__READ | FILE__WRITE)) in flush_unauthorized_files()
3683 static int selinux_revalidate_file_permission(struct file *file, int mask) in selinux_revalidate_file_permission() argument
3686 struct inode *inode = file_inode(file); in selinux_revalidate_file_permission()
3689 if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE)) in selinux_revalidate_file_permission()
3692 return file_has_perm(cred, file, in selinux_revalidate_file_permission()
3696 static int selinux_file_permission(struct file *file, int mask) in selinux_file_permission() argument
3698 struct inode *inode = file_inode(file); in selinux_file_permission()
3699 struct file_security_struct *fsec = selinux_file(file); in selinux_file_permission()
3713 return selinux_revalidate_file_permission(file, mask); in selinux_file_permission()
3716 static int selinux_file_alloc_security(struct file *file) in selinux_file_alloc_security() argument
3718 struct file_security_struct *fsec = selinux_file(file); in selinux_file_alloc_security()
3731 static int ioctl_has_perm(const struct cred *cred, struct file *file, in ioctl_has_perm() argument
3735 struct file_security_struct *fsec = selinux_file(file); in ioctl_has_perm()
3736 struct inode *inode = file_inode(file); in ioctl_has_perm()
3747 ad.u.op->path = file->f_path; in ioctl_has_perm()
3770 static int selinux_file_ioctl(struct file *file, unsigned int cmd, in selinux_file_ioctl() argument
3782 error = file_has_perm(cred, file, FILE__GETATTR); in selinux_file_ioctl()
3787 error = file_has_perm(cred, file, FILE__SETATTR); in selinux_file_ioctl()
3793 error = file_has_perm(cred, file, 0); in selinux_file_ioctl()
3805 error = ioctl_has_perm(cred, file, FILE__IOCTL, (u16) cmd); in selinux_file_ioctl()
3812 error = ioctl_has_perm(cred, file, FILE__IOCTL, (u16) cmd); in selinux_file_ioctl()
3817 static int selinux_file_ioctl_compat(struct file *file, unsigned int cmd, in selinux_file_ioctl_compat() argument
3841 return selinux_file_ioctl(file, cmd, arg); in selinux_file_ioctl_compat()
3846 static int file_map_prot_check(struct file *file, unsigned long prot, int shared) in file_map_prot_check() argument
3853 (prot & PROT_EXEC) && (!file || IS_PRIVATE(file_inode(file)) || in file_map_prot_check()
3867 if (file) { in file_map_prot_check()
3878 return file_has_perm(cred, file, av); in file_map_prot_check()
3899 static int selinux_mmap_file(struct file *file, unsigned long reqprot, in selinux_mmap_file() argument
3905 if (file) { in selinux_mmap_file()
3907 ad.u.file = file; in selinux_mmap_file()
3908 rc = inode_has_perm(current_cred(), file_inode(file), in selinux_mmap_file()
3917 return file_map_prot_check(file, prot, in selinux_mmap_file()
3963 static int selinux_file_lock(struct file *file, unsigned int cmd) in selinux_file_lock() argument
3967 return file_has_perm(cred, file, FILE__LOCK); in selinux_file_lock()
3970 static int selinux_file_fcntl(struct file *file, unsigned int cmd, in selinux_file_fcntl() argument
3978 if ((file->f_flags & O_APPEND) && !(arg & O_APPEND)) { in selinux_file_fcntl()
3979 err = file_has_perm(cred, file, FILE__WRITE); in selinux_file_fcntl()
3990 err = file_has_perm(cred, file, 0); in selinux_file_fcntl()
4003 err = file_has_perm(cred, file, FILE__LOCK); in selinux_file_fcntl()
4010 static void selinux_file_set_fowner(struct file *file) in selinux_file_set_fowner() argument
4014 fsec = selinux_file(file); in selinux_file_set_fowner()
4021 struct file *file; in selinux_file_send_sigiotask() local
4027 file = container_of(fown, struct file, f_owner); in selinux_file_send_sigiotask()
4029 fsec = selinux_file(file); in selinux_file_send_sigiotask()
4041 static int selinux_file_receive(struct file *file) in selinux_file_receive() argument
4045 return file_has_perm(cred, file, file_to_av(file)); in selinux_file_receive()
4048 static int selinux_file_open(struct file *file) in selinux_file_open() argument
4053 fsec = selinux_file(file); in selinux_file_open()
4054 isec = inode_security(file_inode(file)); in selinux_file_open()
4072 return file_path_has_perm(file->f_cred, file, open_file_to_av(file)); in selinux_file_open()
4173 static int selinux_kernel_module_from_file(struct file *file) in selinux_kernel_module_from_file() argument
4182 if (file == NULL) in selinux_kernel_module_from_file()
4190 ad.u.file = file; in selinux_kernel_module_from_file()
4192 fsec = selinux_file(file); in selinux_kernel_module_from_file()
4200 isec = inode_security(file_inode(file)); in selinux_kernel_module_from_file()
4206 static int selinux_kernel_read_file(struct file *file, in selinux_kernel_read_file() argument
4214 rc = selinux_kernel_module_from_file(contents ? file : NULL); in selinux_kernel_read_file()
6963 static int bpf_fd_pass(struct file *file, u32 sid) in bpf_fd_pass() argument
6970 if (file->f_op == &bpf_map_fops) { in bpf_fd_pass()
6971 map = file->private_data; in bpf_fd_pass()
6975 bpf_map_fmode_to_av(file->f_mode), NULL); in bpf_fd_pass()
6978 } else if (file->f_op == &bpf_prog_fops) { in bpf_fd_pass()
6979 prog = file->private_data; in bpf_fd_pass()