Skip to content

Commit b7e27bc

Browse files
author
Mimi Zohar
committed
ima: relax requiring a file signature for new files with zero length
Custom policies can require file signatures based on LSM labels. These files are normally created and only afterwards labeled, requiring them to be signed. Instead of requiring file signatures based on LSM labels, entire filesystems could require file signatures. In this case, we need the ability of writing new files without requiring file signatures. The definition of a "new" file was originally defined as any file with a length of zero. Subsequent patches redefined a "new" file to be based on the FILE_CREATE open flag. By combining the open flag with a file size of zero, this patch relaxes the file signature requirement. Fixes: 1ac202e ima: accept previously set IMA_NEW_FILE Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
1 parent d21bd68 commit b7e27bc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎security/integrity/ima/ima_appraise.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ int ima_appraise_measurement(enum ima_hooks func,
223223
if (opened & FILE_CREATED)
224224
iint->flags |= IMA_NEW_FILE;
225225
if ((iint->flags & IMA_NEW_FILE) &&
226-
!(iint->flags & IMA_DIGSIG_REQUIRED))
226+
(!(iint->flags & IMA_DIGSIG_REQUIRED) ||
227+
(inode->i_size == 0)))
227228
status = INTEGRITY_PASS;
228229
goto out;
229230
}

0 commit comments

Comments
 (0)