ovl: Always reevaluate the file signature for IMA
authorEric Snowberg <eric.snowberg@oracle.com>
Tue, 25 Jul 2023 21:56:46 +0000 (17:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:23 +0000 (09:42 +0200)
commitfbf4048d8fba044b4601792bf747dc14fbebe66d
treef56f6bfb6a65e3ae2dbbc9e172782896e9a3475a
parentae1cb9656ef4c7aa366d1201d366866bc0989df7
ovl: Always reevaluate the file signature for IMA

[ Upstream commit 18b44bc5a67275641fb26f2c54ba7eef80ac5950 ]

Commit db1d1e8b9867 ("IMA: use vfs_getattr_nosec to get the i_version")
partially closed an IMA integrity issue when directly modifying a file
on the lower filesystem.  If the overlay file is first opened by a user
and later the lower backing file is modified by root, but the extended
attribute is NOT updated, the signature validation succeeds with the old
original signature.

Update the super_block s_iflags to SB_I_IMA_UNVERIFIABLE_SIGNATURE to
force signature reevaluation on every file access until a fine grained
solution can be found.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/overlayfs/super.c