提交 a2a2c3c8 编写于 作者: S Sascha Hauer 提交者: Mimi Zohar

ima: Use i_version only when filesystem supports it

i_version is only supported by a filesystem when the SB_I_VERSION
flag is set. This patch tests for the SB_I_VERSION flag before using
i_version. If we can't use i_version to detect a file change then we
must assume the file has changed in the last_writer path and remeasure
it.

On filesystems without i_version support IMA used to measure a file
only once and didn't detect any changes to a file. With this patch
IMA now works properly on these filesystems.
Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
上级 02c324a5
......@@ -133,7 +133,8 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint,
if (atomic_read(&inode->i_writecount) == 1) {
update = test_and_clear_bit(IMA_UPDATE_XATTR,
&iint->atomic_flags);
if ((iint->version != inode->i_version) ||
if (!IS_I_VERSION(inode) ||
(iint->version != inode->i_version) ||
(iint->flags & IMA_NEW_FILE)) {
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
iint->measured_pcrs = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册