[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60339e3bd08a18358ac8c8a16dc67c74eb8ba756.camel@kernel.org>
Date: Thu, 06 Apr 2023 15:37:53 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Stefan Berger <stefanb@...ux.ibm.com>,
Christian Brauner <brauner@...nel.org>,
Paul Moore <paul@...l-moore.com>
Cc: zohar@...ux.ibm.com, linux-integrity@...r.kernel.org,
miklos@...redi.hu, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-unionfs@...r.kernel.org,
amir73il@...il.com
Subject: Re: [PATCH] overlayfs: Trigger file re-evaluation by IMA / EVM
after writes
On Thu, 2023-04-06 at 15:11 -0400, Stefan Berger wrote:
>
> On 4/6/23 14:46, Jeff Layton wrote:
> > On Thu, 2023-04-06 at 17:01 +0200, Christian Brauner wrote:
> > > On Thu, Apr 06, 2023 at 10:36:41AM -0400, Paul Moore wrote:
>
> >
> > Correct. As long as IMA is also measuring the upper inode then it seems
> > like you shouldn't need to do anything special here.
>
> Unfortunately IMA does not notice the changes. With the patch provided in the other email IMA works as expected.
>
It looks like remeasurement is usually done in ima_check_last_writer.
That gets called from __fput which is called when we're releasing the
last reference to the struct file.
You've hooked into the ->release op, which gets called whenever
filp_close is called, which happens when we're disassociating the file
from the file descriptor table.
So...I don't get it. Is ima_file_free not getting called on your file
for some reason when you go to close it? It seems like that should be
handling this.
In any case, I think this could use a bit more root-cause analysis.
> >
> > What sort of fs are you using for the upper layer?
>
> jffs2:
>
> /dev/mtdblock4 on /run/initramfs/ro type squashfs (ro,relatime,errors=continue)
> /dev/mtdblock5 on /run/initramfs/rw type jffs2 (rw,relatime)
> cow on / type overlay (rw,relatime,lowerdir=run/initramfs/ro,upperdir=run/initramfs/rw/cow,workdir=run/initramfs/rw/work)
>
jffs2 does not have a proper i_version counter, I'm afraid. But, IMA
should handle that OK (by assuming that it always needs to remeasure
when there is no i_version counter).
--
Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists