summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/filesystems/overlayfs
AgeCommit message (Collapse)Author
2025-05-12selftests/filesystems: move wrapper.h out of overlayfs subdirAmir Goldstein
This is not an overlayfs specific header. Reviewed-by: John Hubbard <jhubbard@nvidia.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Link: https://lore.kernel.org/20250509133240.529330-2-amir73il@gmail.com Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-05-12selftests/mount_settattr: add missing STATX_MNT_ID_UNIQUE defineChristian Brauner
CC mount_setattr_test In file included from mount_setattr_test.c:24: mount_setattr_test.c: In function ‘mount_setattr_mount_detached_mount_on_detached_mount_and_attach’: mount_setattr_test.c:1850:60: error: ‘STATX_MNT_ID_UNIQUE’ undeclared (first use in this function); did you mean ‘STATX_MNT_ID’? 1850 | ASSERT_EQ(statx(fd_tree_subdir, "", AT_EMPTY_PATH, STATX_MNT_ID_UNIQUE, &stx), 0); | ^~~~~~~~~~~~~~~~~~~ ../kselftest_harness.h:757:20: note: in definition of macro ‘__EXPECT’ 757 | __typeof__(_expected) __exp = (_expected); \ | ^~~~~~~~~ mount_setattr_test.c:1850:9: note: in expansion of macro ‘ASSERT_EQ’ 1850 | ASSERT_EQ(statx(fd_tree_subdir, "", AT_EMPTY_PATH, STATX_MNT_ID_UNIQUE, &stx), 0); | ^~~~~~~~~ mount_setattr_test.c:1850:60: note: each undeclared identifier is reported only once for each function it appears in 1850 | ASSERT_EQ(statx(fd_tree_subdir, "", AT_EMPTY_PATH, STATX_MNT_ID_UNIQUE, &stx), 0); | ^~~~~~~~~~~~~~~~~~~ ../kselftest_harness.h:757:20: note: in definition of macro ‘__EXPECT’ 757 | __typeof__(_expected) __exp = (_expected); \ | ^~~~~~~~~ mount_setattr_test.c:1850:9: note: in expansion of macro ‘ASSERT_EQ’ 1850 | ASSERT_EQ(statx(fd_tree_subdir, "", AT_EMPTY_PATH, STATX_MNT_ID_UNIQUE, &stx), 0); | ^~~~~~~~~ Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-03-24Merge tag 'vfs-6.15-rc1.overlayfs' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs Pull vfs overlayfs updates from Christian Brauner: "Currently overlayfs uses the mounter's credentials for its override_creds() calls. That provides a consistent permission model. This patches allows a caller to instruct overlayfs to use its credentials instead. The caller must be located in the same user namespace hierarchy as the user namespace the overlayfs instance will be mounted in. This provides a consistent and simple security model. With this it is possible to e.g., mount an overlayfs instance where the mounter must have CAP_SYS_ADMIN but the credentials used for override_creds() have dropped CAP_SYS_ADMIN. It also allows the usage of custom fs{g,u}id different from the callers and other tweaks" * tag 'vfs-6.15-rc1.overlayfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: selftests/ovl: add third selftest for "override_creds" selftests/ovl: add second selftest for "override_creds" selftests/filesystems: add utils.{c,h} selftests/ovl: add first selftest for "override_creds" ovl: allow to specify override credentials
2025-02-19selftests/ovl: add third selftest for "override_creds"Christian Brauner
Add a simple test to verify that the new "override_creds" option works. Link: https://lore.kernel.org/r/20250219-work-overlayfs-v3-4-46af55e4ceda@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-19selftests/ovl: add second selftest for "override_creds"Christian Brauner
Add a simple test to verify that the new "override_creds" option works. Link: https://lore.kernel.org/r/20250219-work-overlayfs-v3-3-46af55e4ceda@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-19selftests/filesystems: add utils.{c,h}Christian Brauner
Add a new set of helpers that will be used in follow-up patches. Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-19selftests/ovl: add first selftest for "override_creds"Christian Brauner
Add a simple test to verify that the new "override_creds" option works. Link: https://lore.kernel.org/r/20250219-work-overlayfs-v3-2-46af55e4ceda@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-12selftests: add tests for using detached mount with overlayfsChristian Brauner
Test that it is possible to use detached mounts as overlayfs layers. Link: https://lore.kernel.org/r/20250123-erstbesteigung-angeeignet-1d30e64b7df2@brauner Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-02-12selftests/overlayfs: test specifying layers as O_PATH file descriptorsChristian Brauner
Verify that userspace can specify layers via O_PATH file descriptors. Link: https://lore.kernel.org/r/20250210-work-overlayfs-v2-2-ed2a949b674b@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-15selftests: add test for specifying 500 lower layersChristian Brauner
Verify that we can actually specify 500 lower layers and fail at the 501st one. Link: https://lore.kernel.org/r/20241015-leiht-filmabend-a86eed4ff304@brauner Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-14selftests: add overlayfs fd mounting selftestsChristian Brauner
Link: https://lore.kernel.org/r/20241014-work-overlayfs-v3-5-32b3fed1286e@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-14selftests: use shared headerChristian Brauner
So that we don't have to redefine the same system calls over and over. Link: https://lore.kernel.org/r/20241014-work-overlayfs-v3-4-32b3fed1286e@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-05-29selftests/overlayfs: Fix build error on ppc64Michael Ellerman
Fix build error on ppc64: dev_in_maps.c: In function ‘get_file_dev_and_inode’: dev_in_maps.c:60:59: error: format ‘%llu’ expects argument of type ‘long long unsigned int *’, but argument 7 has type ‘__u64 *’ {aka ‘long unsigned int *’} [-Werror=format=] By switching to unsigned long long for u64 for ppc64 builds. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-01-22selftests/filesystems:fix build error in overlayfsHu Yadi
One build issue comes up due to both mount.h included dev_in_maps.c In file included from dev_in_maps.c:10: /usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant 35 | MS_RDONLY = 1, /* Mount read-only. */ | ^~~~~~~~~ In file included from dev_in_maps.c:13: Remove one of them to solve conflict, another error comes up: dev_in_maps.c:170:6: error: implicit declaration of function ‘mount’ [-Werror=implicit-function-declaration] 170 | if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) == -1) { | ^~~~~ cc1: all warnings being treated as errors and then , add sys_mount definition to solve it After both above, dev_in_maps.c can be built correctly on my mache(gcc 10.2,glibc-2.32,kernel-5.10) Signed-off-by: Hu Yadi <hu.yadi@h3c.com> Link: https://lore.kernel.org/r/20240112074059.29673-1-hu.yadi@h3c.com Acked-by: Andrei Vagin <avagin@google.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
2023-12-21selftests/overlayfs: verify device and inode numbers in /proc/pid/mapsAndrei Vagin
When mapping a file on overlayfs, the file stored in ->vm_file is a backing file whose f_inode is on the underlying filesystem. We need to verify that /proc/pid/maps contains numbers of the overlayfs file, but not its backing file. Cc: Amir Goldstein <amir73il@gmail.com> Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com> Signed-off-by: Andrei Vagin <avagin@google.com> Link: https://lore.kernel.org/r/20231214064439.1023011-2-avagin@google.com Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>