lkml.org 
[lkml]   [2013]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC][PATCH 1/4] ima: added error messages to template-related functions
    Date
    This patch adds some error messages to inform users about the following
    events: template descriptor not found, template field not found, and
    template initialization failed.

    Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
    ---
    security/integrity/ima/ima_template.c | 12 ++++++++++--
    1 file changed, 10 insertions(+), 2 deletions(-)

    diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
    index 4e5da99..7bcff5c 100644
    --- a/security/integrity/ima/ima_template.c
    +++ b/security/integrity/ima/ima_template.c
    @@ -49,8 +49,11 @@ static int __init ima_template_setup(char *str)
    * If not, use CONFIG_IMA_DEFAULT_TEMPLATE.
    */
    template_desc = lookup_template_desc(str);
    - if (!template_desc)
    + if (!template_desc) {
    + pr_err("IMA: template %s not found, using %s\n",
    + str, CONFIG_IMA_DEFAULT_TEMPLATE);
    return 1;
    + }

    /*
    * Verify whether the current hash algorithm is supported
    @@ -127,6 +130,7 @@ static int template_desc_init_fields(char *template_fmt,
    struct ima_template_field *f = lookup_template_field(c);

    if (!f) {
    + pr_err("IMA: field '%s' not found\n", c);
    result = -ENOENT;
    goto out;
    }
    @@ -152,8 +156,12 @@ static int init_defined_templates(void)
    result = template_desc_init_fields(template->fmt,
    &(template->fields),
    &(template->num_fields));
    - if (result < 0)
    + if (result < 0) {
    + pr_err("IMA: template %s init failed, result: %d\n",
    + (strlen(template->name) ?
    + template->name : template->fmt), result);
    return result;
    + }
    }
    return result;
    }
    --
    1.8.1.4
    [unhandled content-type:application/x-pkcs7-signature]
    \
     
     \ /
      Last update: 2013-11-07 15:21    [W:2.211 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site