Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\integrity\ima\ima_queue.c Create Date:2022-07-28 19:57:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Add template entry to the measurement list and hash table, and* extend the pcr.* On systems which support carrying the IMA measurement list across* kexec, maintain the total memory size required for serializing the* binary_runtime_measurements.

Proto:int ima_add_template_entry(struct ima_template_entry *entry, int violation, const char *op, struct inode *inode, const unsigned char *filename)

Type:int

Parameter:

TypeParameterName
struct ima_template_entry *entry
intviolation
const char *op
struct inode *inode
const unsigned char *filename
169  audit_cause = "hash_added"
171  audit_info = 1
172  result = 0 , tpmresult = 0
174  mutex_lock( & mutex protects atomicity of extending measurement list* and extending the TPM PCR aggregate. Since tpm_extend can take* long (and the tpm driver uses a mutex), we can't use the spinlock.)
175  If Not violation Then
176  memcpy(digest, sha1 or md5 measurement hash , size of digest )
178  audit_cause = "hash_exists"
179  result = -EEXIST
180  Go to out
184  result = ma_add_template_entry helper function:* - Add template entry to the measurement list and hash table, for* all entries except those carried across kexec.* (Called with ima_extend_list_mutex held.)
185  If result < 0 Then
186  audit_cause = "ENOMEM"
187  audit_info = 0
188  Go to out
191  If violation Then memset(digest, 0xff, size of digest )
194  tpmresult = Return the amount of memory required for serializing the* entire binary_runtime_measurement list, including the ima_kexec_hdr* structure.
195  If tpmresult != 0 Then
196  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
198  audit_cause = tpm_audit_cause
199  audit_info = 0
201  out :
202  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
203  integrity_audit_msg(PCR invalidation msgs , inode, filename, op, audit_cause, result, audit_info)
205  Return result
Caller
NameDescribe
ima_store_templatema_store_template - store ima template measurements* Calculate the hash of a template entry, add the template entry* to an ordered list of measurement entries maintained inside the kernel,* and also update the aggregate integrity value (maintained inside