Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297443

Re: [Linux-ima-devel] [PATCH] IMA: policy can be updated zero times

From Mimi Zohar <zohar@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [Linux-ima-devel] [PATCH] IMA: policy can be updated zero times
Date 2015-12-23 13:50 +0100
Message-ID <qIR1F-1bM-35@gated-at.bofh.it> (permalink)
References (1 earlier) <qIBge-8do-13@gated-at.bofh.it> <qID8m-TR-29@gated-at.bofh.it> <qID8m-TR-27@gated-at.bofh.it> <qIQ5B-Cl-21@gated-at.bofh.it> <qIQIi-158-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2015-12-23 at 07:24 -0500, Mimi Zohar wrote:
> On Wed, 2015-12-23 at 13:47 +0200, Petko Manolov wrote:
> 
> > On 15-12-22 16:50:01, Sasha Levin wrote:
> > > On 12/22/2015 04:40 PM, Petko Manolov wrote:
> > > >> 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?
> > > > 
> > > > As far as I can say we can't get to ima_update_policy() with empty 
> > > > ima_temp_rules because ima_write_policy() will set valid_policy to 0 in case 
> > > > of an empty rule.  I'll double check it tomorrow, but please you do that 
> > > > too.
> > > 
> > > This is based on an actual crash rather than code analysis.
> > 
> > I was able to reproduce the crash with: echo "" > /sys/kernel/security/ima/policy
> > 
> > It turns out ima_parse_add_rule() returns 1, even though the string is empty 
> > This logic may be part of "empty policy is a valid policy" or something else.  
> > As it is more dangerous to change the behavior at this point i assume your patch 
> > is the right solution for the problem.
> > 
> > Acked-by: Petko Manolov <petkan@mip-labs.com>
> > 
> > Mimi, shall we change ima_parse_add_rule's behavior in the future or it's too 
> > much work?
> 
> ima_parse_add_rules() has no way of knowing if the policy as a whole is
> valid.  I would define a new function in ima_policy.c to return the
> number of rules being added and call it at the beginning of
> ima_release_policy() before the status message.  That way the number of
> rules added can be included in the status message.
> 
> For now, the function could just return have rules or no rules, instead
> of the number of rules.

Sasha, could you make your fix a separate function (above
ima_update_policy) and call it from ima_release_policy()?

Thanks!

Mimi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] IMA: policy can be updated zero times Sasha Levin <sasha.levin@oracle.com> - 2015-12-22 15:00 +0100
  Re: [PATCH] IMA: policy can be updated zero times Mimi Zohar <zohar@linux.vnet.ibm.com> - 2015-12-22 21:00 +0100
    Re: [PATCH] IMA: policy can be updated zero times Sasha Levin <sasha.levin@oracle.com> - 2015-12-22 23:00 +0100
      Re: [PATCH] IMA: policy can be updated zero times Petko Manolov <petkan@mip-labs.com> - 2015-12-23 12:50 +0100
        Re: [PATCH] IMA: policy can be updated zero times Mimi Zohar <zohar@linux.vnet.ibm.com> - 2015-12-23 13:30 +0100
          Re: [Linux-ima-devel] [PATCH] IMA: policy can be updated zero times Mimi Zohar <zohar@linux.vnet.ibm.com> - 2015-12-23 13:50 +0100
    Re: [PATCH] IMA: policy can be updated zero times Petko Manolov <petkan@mip-labs.com> - 2015-12-22 23:20 +0100

csiph-web