public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: dmitry.kasatkin@gmail.com, james.l.morris@oracle.com,
	serge@hallyn.com, linux-ima-devel@lists.sourceforge.net,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, petkan@mip-labs.com
Subject: Re: [PATCH] IMA: policy can be updated zero times
Date: Tue, 22 Dec 2015 14:56:28 -0500	[thread overview]
Message-ID: <1450814188.2774.9.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1450792283-8702-1-git-send-email-sasha.levin@oracle.com>

On Tue, 2015-12-22 at 08:51 -0500, Sasha Levin wrote:
> Commit "IMA: policy can now be updated multiple times" assumed that the
> policy would be updated at least once.
> 
> If there are zero updates, the temporary list head object will get added
> to the policy list, and later dereferenced as an IMA policy object, which
> means that invalid memory will be accessed.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  security/integrity/ima/ima_policy.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index ba5d2fc..9b958b8 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -431,6 +431,9 @@ void ima_update_policy(void)
>  {
>  	struct list_head *first, *last, *policy;
> 
> +	if (list_empty(&ima_temp_rules))
> +		return;
> +
>  	/* append current policy with the new rules */
>  	first = (&ima_temp_rules)->next;
>  	last = (&ima_temp_rules)->prev;

Thanks, Sasha.  By the time ima_update_policy() is called
ima_release_policy() has already output the policy update status
message.  I guess an empty policy could be considered a valid policy.
Could you add a msg indicating that the new policy was empty?

Mimi


  reply	other threads:[~2015-12-22 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 13:51 [PATCH] IMA: policy can be updated zero times Sasha Levin
2015-12-22 19:56 ` Mimi Zohar [this message]
2015-12-22 21:40   ` Petko Manolov
2015-12-22 21:50     ` Sasha Levin
2015-12-23 11:47       ` Petko Manolov
2015-12-23 12:24         ` Mimi Zohar
2015-12-23 12:47           ` [Linux-ima-devel] " Mimi Zohar

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=1450814188.2774.9.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=petkan@mip-labs.com \
    --cc=sasha.levin@oracle.com \
    --cc=serge@hallyn.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