Lines Matching refs:file
76 static int mmap_violation_check(enum ima_hooks func, struct file *file, in mmap_violation_check() argument
83 if ((func == MMAP_CHECK) && mapping_writably_mapped(file->f_mapping)) { in mmap_violation_check()
85 inode = file_inode(file); in mmap_violation_check()
88 *pathname = ima_d_path(&file->f_path, pathbuf, in mmap_violation_check()
106 static void ima_rdwr_violation_check(struct file *file, in ima_rdwr_violation_check() argument
113 struct inode *inode = file_inode(file); in ima_rdwr_violation_check()
114 fmode_t mode = file->f_mode; in ima_rdwr_violation_check()
136 *pathname = ima_d_path(&file->f_path, pathbuf, filename); in ima_rdwr_violation_check()
139 ima_add_violation(file, *pathname, iint, in ima_rdwr_violation_check()
142 ima_add_violation(file, *pathname, iint, in ima_rdwr_violation_check()
147 struct inode *inode, struct file *file) in ima_check_last_writer() argument
149 fmode_t mode = file->f_mode; in ima_check_last_writer()
165 ima_update_xattr(iint, file); in ima_check_last_writer()
177 void ima_file_free(struct file *file) in ima_file_free() argument
179 struct inode *inode = file_inode(file); in ima_file_free()
189 ima_check_last_writer(iint, inode, file); in ima_file_free()
192 static int process_measurement(struct file *file, const struct cred *cred, in process_measurement() argument
196 struct inode *inode = file_inode(file); in process_measurement()
239 ima_rdwr_violation_check(file, iint, action & IMA_MEASURE, in process_measurement()
285 xattr_len = ima_read_xattr(file_dentry(file), &xattr_value); in process_measurement()
297 rc = mmap_violation_check(func, file, &pathbuf, in process_measurement()
308 xattr_len = ima_read_xattr(file_dentry(file), &xattr_value); in process_measurement()
326 rc = ima_collect_measurement(iint, file, buf, size, hash_algo, modsig); in process_measurement()
331 pathname = ima_d_path(&file->f_path, &pathbuf, filename); in process_measurement()
334 ima_store_measurement(iint, file, pathname, in process_measurement()
339 rc = ima_appraise_measurement(func, iint, file, pathname, in process_measurement()
343 rc = mmap_violation_check(func, file, &pathbuf, in process_measurement()
349 if ((file->f_flags & O_DIRECT) && (iint->flags & IMA_PERMIT_DIRECTIO)) in process_measurement()
364 if (file->f_mode & FMODE_WRITE) in process_measurement()
381 int ima_file_mmap(struct file *file, unsigned long prot) in ima_file_mmap() argument
385 if (file && (prot & PROT_EXEC)) { in ima_file_mmap()
387 return process_measurement(file, current_cred(), secid, NULL, in ima_file_mmap()
413 ret = process_measurement(bprm->file, current_cred(), secid, NULL, 0, in ima_bprm_check()
419 return process_measurement(bprm->file, bprm->cred, secid, NULL, 0, in ima_bprm_check()
433 int ima_file_check(struct file *file, int mask) in ima_file_check() argument
438 return process_measurement(file, current_cred(), secid, NULL, 0, in ima_file_check()
508 int ima_read_file(struct file *file, enum kernel_read_file_id read_id) in ima_read_file() argument
543 int ima_post_read_file(struct file *file, void *buf, loff_t size, in ima_post_read_file() argument
549 if (!file && read_id == READING_FIRMWARE) { in ima_post_read_file()
559 if (!file && read_id == READING_X509_CERTIFICATE) in ima_post_read_file()
562 if (!file || !buf || size == 0) { /* should never happen */ in ima_post_read_file()
570 return process_measurement(file, current_cred(), secid, buf, size, in ima_post_read_file()