All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Bobrowski <mattbobrowski@google.com>
To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com
Cc: linux-integrity@vger.kernel.org, revest@google.com,
	kpsingh@google.com, roberto.sassu@huawei.com
Subject: Re: [PATCH] ima: return IMA digest value only when IMA_COLLECTED flag is set
Date: Sun, 22 Jan 2023 23:42:34 +0000	[thread overview]
Message-ID: <Y83J6hPruCtA5D93@google.com> (raw)
In-Reply-To: <Y7T1hEhIL5TEmLEN@google.com>

Hey Mimi,

Just a gentle ping on this one.

On Wed, Jan 04, 2023 at 03:41:56AM +0000, Matt Bobrowski wrote:
> The IMA_COLLECTED flag indicates whether the IMA subsystem has
> successfully collected a measurement for a given file object. Ensure
> that we return the respective digest value stored within the iint
> entry only when this flag has been set.
> 
> Failing to check for the presence of this flag exposes consumers of
> this IMA API to receive potentially undesired IMA digest values when
> an erroneous condition has been experienced in some of the lower level
> IMA API code.
> 
> Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
> ---
>  security/integrity/ima/ima_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index b1ae0f2751f1..1d40cdfa23d5 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -563,7 +563,7 @@ static int __ima_inode_hash(struct inode *inode, struct file *file, char *buf,
>  	 * ima_file_hash can be called when ima_collect_measurement has still
>  	 * not been called, we might not always have a hash.
>  	 */
> -	if (!iint->ima_hash) {
> +	if (!iint->ima_hash || !(iint->flags & IMA_COLLECTED)) {
>  		mutex_unlock(&iint->mutex);
>  		return -EOPNOTSUPP;
>  	}
> -- 
> 2.39.0.314.g84b9a713c41-goog

/M

      reply	other threads:[~2023-01-22 23:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  3:41 [PATCH] ima: return IMA digest value only when IMA_COLLECTED flag is set Matt Bobrowski
2023-01-22 23:42 ` Matt Bobrowski [this message]

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=Y83J6hPruCtA5D93@google.com \
    --to=mattbobrowski@google.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=kpsingh@google.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=revest@google.com \
    --cc=roberto.sassu@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.