linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Janne Karhunen <janne.karhunen@gmail.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: Re: appraisal reset safety
Date: Tue, 09 Apr 2019 08:04:49 -0400	[thread overview]
Message-ID: <1554811489.4192.15.camel@linux.ibm.com> (raw)
In-Reply-To: <CAE=Ncraz_sDhtmE2RPYxJmo+yRkRK5opDyburk126sCSW-MvbQ@mail.gmail.com>

On Tue, 2019-04-09 at 14:46 +0300, Janne Karhunen wrote:
> On Tue, Apr 9, 2019 at 10:58 AM Janne Karhunen <janne.karhunen@gmail.com> wrote:
> >
> > On Mon, Apr 8, 2019 at 4:11 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > > The question of how much/how little to measure/appraise/audit is based
> > > on policy and affects the integrity of the system and its performance.
> > >  Detecting and updating the file hash each time the file changes would
> > > have major performance repercussions.  Even that wouldn't solve the
> > > problem, as the file change is in cache.  Writing the file hash as an
> > > xattr and making the file change persistent needs to be coordinated,
> > > probably at the filesystem level.
> >
> > As an experiment, I will add 'ima_file_update' function and call it
> > from few strategic spots (such as vfs write) and see how far that can
> > go removing the crash-recovery band-aid.

Remember somehow EVM will need to be updated as well for it to work.

> Adding ima_file_update in there seems to work fine and things stay
> nicely up to date. It is certainly heavy, but maybe this is only
> needed when sync() is intentionally being called for the fd?

I was thinking the same thing.
> 
> void ima_file_update(struct file *file)
> {
>         struct inode *inode = file_inode(file);
>         struct integrity_iint_cache *iint;
> 
>         if (!ima_policy_flag || !S_ISREG(inode->i_mode))
>                 return;
> 
>         iint = integrity_iint_find(inode);
>         if (!iint)
>                 return;
> 
>         iint->flags &= ~IMA_COLLECTED;
>         ima_update_xattr(iint, file);
> }
> 

I would think there needs to be some locking here.  

> It would take an additional integrity hook, of course.

That's fine.

Mimi


  reply	other threads:[~2019-04-09 12:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 12:46 appraisal reset safety Janne Karhunen
2019-04-06  6:16 ` Janne Karhunen
2019-04-08  9:22   ` Janne Karhunen
2019-04-08 13:10     ` Mimi Zohar
2019-04-08 13:57       ` Janne Karhunen
2019-04-09  7:58       ` Janne Karhunen
2019-04-09 11:46         ` Janne Karhunen
2019-04-09 12:04           ` Mimi Zohar [this message]
2019-04-09 12:25             ` Janne Karhunen
2019-04-09 12:32               ` Mimi Zohar
2019-04-11  6:39                 ` Janne Karhunen

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=1554811489.4192.15.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=janne.karhunen@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    /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).