IMA: use vfs_getattr_nosec to get the i_version
authorJeff Layton <jlayton@kernel.org>
Mon, 17 Apr 2023 16:55:51 +0000 (12:55 -0400)
committerMimi Zohar <zohar@linux.ibm.com>
Tue, 23 May 2023 22:07:34 +0000 (18:07 -0400)
commitdb1d1e8b9867aae5c3e61ad7859abfcc4a6fd6c7
treee8383eaf530258062aa0aa585adef06b5f9c3f38
parentf1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6
IMA: use vfs_getattr_nosec to get the i_version

IMA currently accesses the i_version out of the inode directly when it
does a measurement. This is fine for most simple filesystems, but can be
problematic with more complex setups (e.g. overlayfs).

Make IMA instead call vfs_getattr_nosec to get this info. This allows
the filesystem to determine whether and how to report the i_version, and
should allow IMA to work properly with a broader class of filesystems in
the future.

Reported-and-Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/ima/ima_api.c
security/integrity/ima/ima_main.c