Lines Matching refs:iint
111 struct integrity_iint_cache *iint, in ima_rdwr_violation_check() argument
123 if (!iint) in ima_rdwr_violation_check()
124 iint = integrity_iint_find(inode); in ima_rdwr_violation_check()
126 if (iint && test_bit(IMA_MUST_MEASURE, in ima_rdwr_violation_check()
127 &iint->atomic_flags)) in ima_rdwr_violation_check()
132 set_bit(IMA_MUST_MEASURE, &iint->atomic_flags); in ima_rdwr_violation_check()
143 ima_add_violation(file, *pathname, iint, in ima_rdwr_violation_check()
146 ima_add_violation(file, *pathname, iint, in ima_rdwr_violation_check()
150 static void ima_check_last_writer(struct integrity_iint_cache *iint, in ima_check_last_writer() argument
159 mutex_lock(&iint->mutex); in ima_check_last_writer()
162 &iint->atomic_flags); in ima_check_last_writer()
164 !inode_eq_iversion(inode, iint->version) || in ima_check_last_writer()
165 (iint->flags & IMA_NEW_FILE)) { in ima_check_last_writer()
166 iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); in ima_check_last_writer()
167 iint->measured_pcrs = 0; in ima_check_last_writer()
169 ima_update_xattr(iint, file); in ima_check_last_writer()
172 mutex_unlock(&iint->mutex); in ima_check_last_writer()
184 struct integrity_iint_cache *iint; in ima_file_free() local
189 iint = integrity_iint_find(inode); in ima_file_free()
190 if (!iint) in ima_file_free()
193 ima_check_last_writer(iint, inode, file); in ima_file_free()
201 struct integrity_iint_cache *iint = NULL; in process_measurement() local
237 iint = integrity_inode_get(inode); in process_measurement()
238 if (!iint) in process_measurement()
243 ima_rdwr_violation_check(file, iint, action & IMA_MEASURE, in process_measurement()
253 mutex_lock(&iint->mutex); in process_measurement()
255 if (test_and_clear_bit(IMA_CHANGE_ATTR, &iint->atomic_flags)) in process_measurement()
257 iint->flags &= ~(IMA_APPRAISE | IMA_APPRAISED | in process_measurement()
266 if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags) || in process_measurement()
270 iint->flags &= ~IMA_DONE_MASK; in process_measurement()
271 iint->measured_pcrs = 0; in process_measurement()
278 iint->flags |= action; in process_measurement()
280 action &= ~((iint->flags & (IMA_DONE_MASK ^ IMA_MEASURED)) >> 1); in process_measurement()
283 if ((action & IMA_MEASURE) && (iint->measured_pcrs & (0x1 << pcr))) in process_measurement()
288 !(test_bit(IMA_DIGSIG, &iint->atomic_flags))) { in process_measurement()
292 set_bit(IMA_DIGSIG, &iint->atomic_flags); in process_measurement()
293 iint->flags |= IMA_HASHED; in process_measurement()
295 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in process_measurement()
304 rc = ima_get_cache_status(iint, func); in process_measurement()
319 if (iint->flags & IMA_MODSIG_ALLOWED) { in process_measurement()
323 iint->flags & IMA_MEASURED) in process_measurement()
330 rc = ima_collect_measurement(iint, file, buf, size, hash_algo, modsig); in process_measurement()
338 ima_store_measurement(iint, file, pathname, in process_measurement()
342 rc = ima_check_blacklist(iint, modsig, pcr); in process_measurement()
345 rc = ima_appraise_measurement(func, iint, file, in process_measurement()
355 ima_audit_measurement(iint, pathname); in process_measurement()
357 if ((file->f_flags & O_DIRECT) && (iint->flags & IMA_PERMIT_DIRECTIO)) in process_measurement()
360 if ((mask & MAY_WRITE) && test_bit(IMA_DIGSIG, &iint->atomic_flags) && in process_measurement()
361 !(iint->flags & IMA_NEW_FILE)) in process_measurement()
363 mutex_unlock(&iint->mutex); in process_measurement()
373 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in process_measurement()
525 struct integrity_iint_cache *iint; in ima_file_hash() local
535 iint = integrity_iint_find(inode); in ima_file_hash()
536 if (!iint) in ima_file_hash()
539 mutex_lock(&iint->mutex); in ima_file_hash()
545 if (!iint->ima_hash) { in ima_file_hash()
546 mutex_unlock(&iint->mutex); in ima_file_hash()
553 copied_size = min_t(size_t, iint->ima_hash->length, buf_size); in ima_file_hash()
554 memcpy(buf, iint->ima_hash->digest, copied_size); in ima_file_hash()
556 hash_algo = iint->ima_hash->algo; in ima_file_hash()
557 mutex_unlock(&iint->mutex); in ima_file_hash()
573 struct integrity_iint_cache *iint; in ima_post_create_tmpfile() local
581 iint = integrity_inode_get(inode); in ima_post_create_tmpfile()
582 if (!iint) in ima_post_create_tmpfile()
586 set_bit(IMA_UPDATE_XATTR, &iint->atomic_flags); in ima_post_create_tmpfile()
587 iint->ima_file_status = INTEGRITY_PASS; in ima_post_create_tmpfile()
599 struct integrity_iint_cache *iint; in ima_post_path_mknod() local
608 iint = integrity_inode_get(inode); in ima_post_path_mknod()
609 if (!iint) in ima_post_path_mknod()
613 iint->flags |= IMA_NEW_FILE; in ima_post_path_mknod()
801 struct integrity_iint_cache iint = {}; in process_buffer_measurement() local
802 struct ima_event_data event_data = {.iint = &iint, in process_buffer_measurement()
849 iint.ima_hash = &hash.hdr; in process_buffer_measurement()
850 iint.ima_hash->algo = ima_hash_algo; in process_buffer_measurement()
851 iint.ima_hash->length = hash_digest_size[ima_hash_algo]; in process_buffer_measurement()
853 ret = ima_calc_buffer_hash(buf, size, iint.ima_hash); in process_buffer_measurement()