Skip to content

Commit 5d05360

Browse files
coibymimizohar
authored andcommitted
ima: Add code comments to explain IMA iint cache atomic_flags
Explain these atomic flags to improve code readability. For example, the flag IMA_DIGSIG is to indicate we mustn't update a file's security.ima on close because the file already has IMA signature. The code comments for the first three flags come from commit 0d73a55 ("ima: re-introduce own integrity cache lock") with a minor tweak. Signed-off-by: Coiby Xu <coxu@redhat.com> [zohar@linux.ibm.com: remove duplicate "integrity violation", unnecessary commas] Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent d7bd8cf commit 5d05360

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

  • security/integrity/ima

security/integrity/ima/ima.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,32 @@ struct ima_kexec_hdr {
177177
IMA_BPRM_APPRAISED | IMA_READ_APPRAISED | \
178178
IMA_CREDS_APPRAISED)
179179

180-
/* IMA iint cache atomic_flags */
180+
/*
181+
* IMA iint cache atomic_flags
182+
*
183+
* IMA_CHANGE_ATTR - indicates that chATTR() was called (chmod, chown, chgrp)
184+
* and file attributes have changed. On file open, it causes IMA to clear
185+
* iint->flags to re-evaluate policy and perform IMA functions again.
186+
*
187+
* IMA_CHANGE_XATTR - indicates that setxattr or removexattr was called and
188+
* extended attributes have changed. On file open, it causes IMA to clear
189+
* iint->flags IMA_DONE_MASK to re-appraise.
190+
*
191+
* IMA_UPDATE_XATTR - indicates that security.ima needs to be updated. It is
192+
* cleared if file policy changes and no update is needed.
193+
*
194+
* IMA_DIGSIG - indicates that file security.ima has signature and file
195+
* security.ima must not update on file close.
196+
*
197+
* IMA_MAY_EMIT_TOMTOU - indicates to add Time-of-Measure-Time-of-Use (ToMToU)
198+
* integrity violation (a file that is already opened for read is opened for
199+
* write) to the measurement list and to also emit an audit message.
200+
*
201+
* IMA_EMITTED_OPENWRITERS - indicates to add open-writers integrity violation
202+
* (a file that is already opened for write is opened for read) to the
203+
* measurement list and to also emit an audit message.
204+
*
205+
*/
181206
#define IMA_CHANGE_XATTR 0
182207
#define IMA_UPDATE_XATTR 1
183208
#define IMA_CHANGE_ATTR 2

0 commit comments

Comments
 (0)