diff options
author | Stefan Berger <stefanb@linux.ibm.com> | 2024-02-23 12:25:08 -0500 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2024-04-09 17:14:57 -0400 |
commit | 309e2b775da8b2c28fccc4ac2621801f06920ce0 (patch) | |
tree | aa1300dfdb5b113143fbbdcc4bb7d3db0259b3d8 /security/integrity/ima/ima_api.c | |
parent | faf994811e0548df854e5fd946f3094725fcd9b5 (diff) | |
download | linux-stable-309e2b775da8b2c28fccc4ac2621801f06920ce0.tar.gz linux-stable-309e2b775da8b2c28fccc4ac2621801f06920ce0.tar.bz2 linux-stable-309e2b775da8b2c28fccc4ac2621801f06920ce0.zip |
ima: Move file-change detection variables into new structure
Move all the variables used for file change detection into a structure
that can be used by IMA and EVM. Implement an inline function for storing
the identification of an inode and one for detecting changes to an inode
based on this new structure.
Co-developed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_api.c')
-rw-r--r-- | security/integrity/ima/ima_api.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index 3d286de231e1..984e861f6e33 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c @@ -305,11 +305,11 @@ int ima_collect_measurement(struct ima_iint_cache *iint, struct file *file, iint->ima_hash = tmpbuf; memcpy(iint->ima_hash, &hash, length); - iint->version = i_version; - if (real_inode != inode) { - iint->real_ino = real_inode->i_ino; - iint->real_dev = real_inode->i_sb->s_dev; - } + if (real_inode == inode) + iint->real_inode.version = i_version; + else + integrity_inode_attrs_store(&iint->real_inode, i_version, + real_inode); /* Possibly temporary failure due to type of read (eg. O_DIRECT) */ if (!result) |