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.
Showing the changes to include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -116,5 +116,8 @@ · 115 unmodified lines | ||
| 116 | 116 | #define AT_HANDLE_FID AT_REMOVEDIR /* file handle is needed to |
| 117 | 117 | compare object identity and may not |
| 118 | 118 | be usable to open_by_handle_at(2) */ |
| 119 | +#if defined(__KERNEL__) | |
| 120 | +#define AT_GETATTR_NOSEC 0x80000000 | |
| 121 | +#endif | |
| 119 | 122 | |
| 120 | 123 | #endif /* _UAPI_LINUX_FCNTL_H */ |