linux-stable/fs/overlayfs
Christian Brauner cce9107c31 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:50:32 +02:00
..
copy_up.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:21:33 +02:00
dir.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:21:33 +02:00
export.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:21:33 +02:00
file.c ovl: update ->f_iocb_flags when ovl_change_flags() modifies ->f_flags 2023-01-04 11:29:00 +01:00
inode.c ovl: fix null pointer dereference in ovl_get_acl_rcu() 2023-07-23 13:49:28 +02:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06: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:21:33 +02:00
overlayfs.h ovl: let helper ovl_i_path_real() return the realinode 2023-07-23 13:49:28 +02:00
ovl_entry.h ovl: check type and offset of struct vfsmount in ovl_entry 2023-07-27 08:50:32 +02:00
readdir.c whack-a-mole: constifying struct path * 2022-10-06 17:31:02 -07:00
super.c ovl: update of dentry revalidate flags after copy up 2023-07-19 16:21:33 +02:00
util.c ovl: let helper ovl_i_path_real() return the realinode 2023-07-23 13:49:28 +02:00