linux-stable/fs/overlayfs
Christian Brauner da2b6f919a ovl: check type and offset of struct vfsmount in ovl_entry
[ Upstream commit f723edb8a5 ]

Porting overlayfs to the new amount api I started experiencing random
crashes that couldn't be explained easily. So after much debugging and
reasoning it became clear that struct ovl_entry requires the point to
struct vfsmount to be the first member and of type struct vfsmount.

During the port I added a new member at the beginning of struct
ovl_entry which broke all over the place in the form of random crashes
and cache corruptions. While there's a comment in ovl_free_fs() to the
effect of "Hack! Reuse ofs->layers as a vfsmount array before freeing
it" there's no such comment on struct ovl_entry which makes this easy to
trip over.

Add a comment and two static asserts for both the offset and the type of
pointer in struct ovl_entry.

Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-27 08:56:44 +02:00
..
copy_up.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:36:07 +02:00
dir.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:36:07 +02:00
export.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:36:07 +02:00
file.c fs: port inode_owner_or_capable() to mnt_idmap 2023-01-19 09:24:29 +01:00
inode.c ovl: fix null pointer dereference in ovl_get_acl_rcu() 2023-07-19 16:37:00 +02:00
Kconfig ovl: Kconfig: Fix spelling mistake "undelying" -> "underlying" 2022-12-08 10:49:46 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:36:07 +02:00
overlayfs.h ovl: let helper ovl_i_path_real() return the realinode 2023-07-19 16:37:00 +02:00
ovl_entry.h ovl: check type and offset of struct vfsmount in ovl_entry 2023-07-27 08:56:44 +02:00
readdir.c fs: port ->permission() to pass mnt_idmap 2023-01-19 09:24:28 +01:00
super.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:36:07 +02:00
util.c ovl: let helper ovl_i_path_real() return the realinode 2023-07-19 16:37:00 +02:00