Lines Matching refs:iint
107 struct integrity_iint_cache *iint, in ima_rdwr_violation_check() argument
119 if (!iint) in ima_rdwr_violation_check()
120 iint = integrity_iint_find(inode); in ima_rdwr_violation_check()
122 if (iint && test_bit(IMA_MUST_MEASURE, in ima_rdwr_violation_check()
123 &iint->atomic_flags)) in ima_rdwr_violation_check()
128 set_bit(IMA_MUST_MEASURE, &iint->atomic_flags); 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()
146 static void ima_check_last_writer(struct integrity_iint_cache *iint, in ima_check_last_writer() argument
155 mutex_lock(&iint->mutex); in ima_check_last_writer()
158 &iint->atomic_flags); in ima_check_last_writer()
160 !inode_eq_iversion(inode, iint->version) || in ima_check_last_writer()
161 (iint->flags & IMA_NEW_FILE)) { in ima_check_last_writer()
162 iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); in ima_check_last_writer()
163 iint->measured_pcrs = 0; in ima_check_last_writer()
165 ima_update_xattr(iint, file); in ima_check_last_writer()
168 mutex_unlock(&iint->mutex); in ima_check_last_writer()
180 struct integrity_iint_cache *iint; in ima_file_free() local
185 iint = integrity_iint_find(inode); in ima_file_free()
186 if (!iint) in ima_file_free()
189 ima_check_last_writer(iint, inode, file); in ima_file_free()
197 struct integrity_iint_cache *iint = NULL; in process_measurement() local
233 iint = integrity_inode_get(inode); in process_measurement()
234 if (!iint) in process_measurement()
239 ima_rdwr_violation_check(file, iint, action & IMA_MEASURE, in process_measurement()
249 mutex_lock(&iint->mutex); in process_measurement()
251 if (test_and_clear_bit(IMA_CHANGE_ATTR, &iint->atomic_flags)) in process_measurement()
253 iint->flags &= ~(IMA_APPRAISE | IMA_APPRAISED | in process_measurement()
262 if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags) || in process_measurement()
266 iint->flags &= ~IMA_DONE_MASK; in process_measurement()
267 iint->measured_pcrs = 0; in process_measurement()
274 iint->flags |= action; in process_measurement()
276 action &= ~((iint->flags & (IMA_DONE_MASK ^ IMA_MEASURED)) >> 1); in process_measurement()
279 if ((action & IMA_MEASURE) && (iint->measured_pcrs & (0x1 << pcr))) in process_measurement()
284 !(test_bit(IMA_DIGSIG, &iint->atomic_flags))) { in process_measurement()
288 set_bit(IMA_DIGSIG, &iint->atomic_flags); in process_measurement()
289 iint->flags |= IMA_HASHED; in process_measurement()
291 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in process_measurement()
300 rc = ima_get_cache_status(iint, func); in process_measurement()
315 if (iint->flags & IMA_MODSIG_ALLOWED) { in process_measurement()
319 iint->flags & IMA_MEASURED) in process_measurement()
326 rc = ima_collect_measurement(iint, file, buf, size, hash_algo, modsig); 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()
347 ima_audit_measurement(iint, pathname); in process_measurement()
349 if ((file->f_flags & O_DIRECT) && (iint->flags & IMA_PERMIT_DIRECTIO)) in process_measurement()
352 if ((mask & MAY_WRITE) && test_bit(IMA_DIGSIG, &iint->atomic_flags) && in process_measurement()
353 !(iint->flags & IMA_NEW_FILE)) in process_measurement()
355 mutex_unlock(&iint->mutex); in process_measurement()
365 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in process_measurement()
454 struct integrity_iint_cache *iint; in ima_post_create_tmpfile() local
462 iint = integrity_inode_get(inode); in ima_post_create_tmpfile()
463 if (!iint) in ima_post_create_tmpfile()
467 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in ima_post_create_tmpfile()
468 iint->ima_file_status = INTEGRITY_PASS; in ima_post_create_tmpfile()
480 struct integrity_iint_cache *iint; in ima_post_path_mknod() local
489 iint = integrity_inode_get(inode); in ima_post_path_mknod()
490 if (!iint) in ima_post_path_mknod()
494 iint->flags |= IMA_NEW_FILE; in ima_post_path_mknod()
640 struct integrity_iint_cache iint = {}; in process_buffer_measurement() local
641 struct ima_event_data event_data = {.iint = &iint, in process_buffer_measurement()
659 iint.ima_hash = &hash.hdr; in process_buffer_measurement()
660 iint.ima_hash->algo = ima_hash_algo; in process_buffer_measurement()
661 iint.ima_hash->length = hash_digest_size[ima_hash_algo]; in process_buffer_measurement()
663 ret = ima_calc_buffer_hash(buf, size, iint.ima_hash); in process_buffer_measurement()