linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Tushar Sugandhi <tusharsu@linux.microsoft.com>,
	zohar@linux.ibm.com, skhan@linuxfoundation.org,
	linux-integrity@vger.kernel.org
Cc: sashal@kernel.org, nramas@linux.microsoft.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] IMA: Add log statements for failure conditions.
Date: Tue, 11 Feb 2020 12:09:50 -0800	[thread overview]
Message-ID: <5c6098c369de85abc5273fdda5da4e1dc5228dc9.camel@perches.com> (raw)
In-Reply-To: <ca5e6f88-6946-92ae-d4ac-0f07df54876a@linux.microsoft.com>

On Tue, 2020-02-11 at 11:14 -0800, Tushar Sugandhi wrote:
> Hi Joe,

Rehi Tushar.

> On 2020-02-10 7:23 p.m., Joe Perches wrote:
> > On Mon, 2020-02-10 at 18:47 -0800, Tushar Sugandhi wrote:
> > > process_buffer_measurement() and ima_alloc_key_entry()
> > > functions do not have log messages for failure conditions.
[]
> > > diff --git a/security/integrity/ima/ima_queue_keys.c b/security/integrity/ima/ima_queue_keys.c
> > []
> > > @@ -90,6 +90,7 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring,
> > >   
> > >   out:
> > >   	if (rc) {
> > > +		pr_err("Key entry allocation failed, result: %d\n", rc);
> > >   		ima_free_key_entry(entry);
> > >   		entry = NULL;
> > >   	}
> > 
> > Likely the pr_err is unnecessary here as kmalloc, kstrdup
> > and kmemdup all emit a dump_stack() on allocation failure.
> Thanks for pointing out kmalloc, kstrdup, and kmemdup emit a 
> dump_stack(). But keeping the above pr_err() will help associate the 
> failure with IMA.
> For instance - "dmesg | grep ima:" will include this error.
> Perhaps I should add __func__ here as well.
> And since we are redefining the pr_fmt to prefix module and base names, 
> it will help further to pinpoint where exactly the failure is coming from.

The dump_stack is preferred over a single printk message
and the association isn't particularly useful.

> Thanks again. This recommended change certainly makes the code more 
> readable. But again, I am not sure if this patchset is the right one for 
> this proposed change.
> Perhaps I can create another patchset for the above two recommended 
> changes, and only focus on improving logging in this patchset?

Your choice.



  reply	other threads:[~2020-02-11 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11  2:47 [PATCH v2 1/3] IMA: Update KBUILD_MODNAME for IMA files to ima Tushar Sugandhi
2020-02-11  2:47 ` [PATCH v2 2/3] IMA: Add log statements for failure conditions Tushar Sugandhi
2020-02-11  3:23   ` Joe Perches
2020-02-11 19:14     ` Tushar Sugandhi
2020-02-11 20:09       ` Joe Perches [this message]
2020-02-11  2:47 ` [PATCH v2 3/3] IMA: Add module name and base name prefix to log Tushar Sugandhi
2020-02-11  3:09 ` [PATCH v2 1/3] IMA: Update KBUILD_MODNAME for IMA files to ima Joe Perches
2020-02-11 17:36   ` Lakshmi Ramasubramanian
2020-02-11 17:55     ` Tushar Sugandhi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c6098c369de85abc5273fdda5da4e1dc5228dc9.camel@perches.com \
    --to=joe@perches.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nramas@linux.microsoft.com \
    --cc=sashal@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tusharsu@linux.microsoft.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).