summaryrefslogtreecommitdiff
path: root/security/integrity/ima/ima_template.c
diff options
context:
space:
mode:
authorRoberto Sassu <roberto.sassu@polito.it>2014-10-13 12:08:39 (GMT)
committerMimi Zohar <zohar@linux.vnet.ibm.com>2014-10-13 12:39:01 (GMT)
commit7dbdb4206bd69bf518fd76e01f4c5c64cda96455 (patch)
tree29e4d56591d813bfffaf7172ec98b760c9a9fc5a /security/integrity/ima/ima_template.c
parent71fed2eee0ea76b236f491006078c9d636323184 (diff)
downloadlinux-7dbdb4206bd69bf518fd76e01f4c5c64cda96455.tar.xz
ima: display template format in meas. list if template name length is zero
With the introduction of the 'ima_template_fmt' kernel cmdline parameter, a user can define a new template descriptor with custom format. However, in this case, userspace tools will be unable to parse the measurements list because the new template is unknown. For this reason, this patch modifies the current IMA behavior to display in the list the template format instead of the name (only if the length of the latter is zero) so that a tool can extract needed information if it can handle listed fields. This patch also correctly displays the error log message in ima_init_template() if the selected template cannot be initialized. Changelog: - v3: - check the first byte of 'e->template_desc->name' instead of using strlen() in ima_fs.c (suggested by Mimi Zohar) - v2: - print the template format in ima_init_template(), if the selected template is custom (Roberto Sassu) - v1: - fixed patch description (Roberto Sassu, suggested by Mimi Zohar) - set 'template_name' variable in ima_fs.c only once (Roberto Sassu, suggested by Mimi Zohar) Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_template.c')
-rw-r--r--security/integrity/ima/ima_template.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 1310afc..b7b359c 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -176,7 +176,9 @@ int __init ima_init_template(void)
&(template->fields),
&(template->num_fields));
if (result < 0)
- pr_err("template %s init failed, result: %d\n", template->name);
+ pr_err("template %s init failed, result: %d\n",
+ (strlen(template->name) ?
+ template->name : template->fmt), result);
return result;
}