commit | 5a5b1e7dac9b7b7090c71899d63aaacc35db2f7e | [log] [tgz] |
---|---|---|
author | Stefan Berger <[email protected]> | Mon Oct 02 08:57:33 2023 -0400 |
committer | COS Cherry Picker <[email protected]> | Mon Dec 18 19:35:59 2023 -0800 |
tree | a720db87d27f7f5c80a8f0a53aadd88f1128e5af | |
parent | 24f4cdd83ebb3650a41ada434d950399124eb59d [diff] |
fs: Pass AT_GETATTR_NOSEC flag to getattr interface function Commit 8a924db2d7b5eb69ba08b1a0af46e9f1359a9bdf upstream. When vfs_getattr_nosec() calls a filesystem's getattr interface function then the 'nosec' should propagate into this function so that vfs_getattr_nosec() can again be called from the filesystem's gettattr rather than vfs_getattr(). The latter would add unnecessary security checks that the initial vfs_getattr_nosec() call wanted to avoid. Therefore, introduce the getattr flag GETATTR_NOSEC and allow to pass with the new getattr_flags parameter to the getattr interface function. In overlayfs and ecryptfs use this flag to determine which one of the two functions to call. In a recent code change introduced to IMA vfs_getattr_nosec() ended up calling vfs_getattr() in overlayfs, which in turn called security_inode_getattr() on an exiting process that did not have current->fs set anymore, which then caused a kernel NULL pointer dereference. With this change the call to security_inode_getattr() can be avoided, thus avoiding the NULL pointer dereference. BUG=b/314212897 TEST=presubmit RELEASE_NOTE=None cos-patch: bug Reported-by: <[email protected]> Fixes: db1d1e8b9867 ("IMA: use vfs_getattr_nosec to get the i_version") Cc: Alexander Viro <[email protected]> Cc: <[email protected]> Cc: Miklos Szeredi <[email protected]> Cc: Amir Goldstein <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: Mimi Zohar <[email protected]> Suggested-by: Christian Brauner <[email protected]> Co-developed-by: Amir Goldstein <[email protected]> Signed-off-by: Stefan Berger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Amir Goldstein <[email protected]> Signed-off-by: Christian Brauner <[email protected]> (cherry picked from commit 8a924db2d7b5eb69ba08b1a0af46e9f1359a9bdf) Signed-off-by: Robert Kolchmeyer <[email protected]> Change-Id: I83a788b630f6ad5d49de03cf4614ffa6ccf55355 Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/62537 Reviewed-by: Oleksandr Tymoshenko <[email protected]> Tested-by: Cusky Presubmit Bot <[email protected]> Main-Branch-Verified: Cusky Presubmit Bot <[email protected]>