ima: use full pathnames in measurement list
Subsystems (3)
PATCH 1/1 ima: use full pathnames in measurement list
The IMA measurement list contains filename hints, which can be ambigious without the full pathname. This patch replaces the filename hint with the full pathname, simplifying for userspace the correlating of file hash measurements with files.
Change log v1:
- Revert to short filenames, when full pathname is longer than IMA measurement buffer size. (Based on Dmitry's review)
Signed-off-by Mimi Zohar <[email protected]>
--- security/integrity/ima/ima_api.c | 4 ++- security/integrity/ima/ima_main.c | 42 +++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-)
security/integrity/ima/ima_api.c +3 -1
@@ -175,7 +175,9 @@ void ima_store_measurement(struct integrity_iint_cache *iint, }memset (&entry->template,0 ,sizeof (entry->template));memcpy (entry->template.digest, iint->digest,IMA_DIGEST_SIZE ); -strncpy (entry->template.file_name, filename,IMA_EVENT_NAME_LEN_MAX ); +strcpy (entry->template.file_name, + (strlen (filename) >IMA_EVENT_NAME_LEN_MAX ) ? + file->f_dentry->d_name.name : filename); result =ima_store_template (entry, violation, inode);if (!result || result == -EEXIST )
security/integrity/ima/ima_main.c +36 -6
68 lines not on this page · raw message
Signature · 1 line
1.7.7.6