linux/tools/testing/selftests/filesystems
Amir Goldstein 9acb102522 selftests/fuse: add ACL_DONT_CACHE regression test
Add a test that reproduces the stale ACL bug fixed by:
  "fs: preserve ACL_DONT_CACHE state in forget_cached_acl()"

A FUSE mount that does not negotiate FUSE_POSIX_ACL initialises inodes
with i_acl = ACL_DONT_CACHE.  Before the fix, calling
forget_all_cached_acls() (e.g. from fuse_update_get_attr() on a
statx(AT_STATX_FORCE_SYNC)) would silently replace ACL_DONT_CACHE with
ACL_NOT_CACHED, enabling the kernel ACL cache.  A subsequent getxattr
would populate the cache, and because fuse_set_acl() skips
forget_all_cached_acls() for !fc->posix_acl, later ACL changes were
not visible to callers — getxattr returned stale data.

The test mounts a minimal libfuse3 lowlevel filesystem (no
FUSE_POSIX_ACL negotiated) and:
  1. Issues two getxattrs — both must reach the daemon, proving
     ACL_DONT_CACHE suppresses caching before any trigger.
  2. Calls statx(AT_STATX_FORCE_SYNC) to trigger forget_all_cached_acls().
  3. Issues another getxattr (populates the cache on a buggy kernel).
  4. Switches the daemon to a different-sized ACL (ACL_B).
  5. Issues a final getxattr — expects ACL_B (44 bytes) and daemon
     call count 4; a buggy kernel returns stale ACL_A (28 bytes).

fuse_acl_cache_test is only built when libfuse3 is detected via
pkg-config.

Christian Brauner <brauner@kernel.org> says:
Changed do_force_statx() to call the statx() libc wrapper instead of
syscall(SYS_statx, ...) as requested by Amir after review feedback from
Luis Henriques, and dropped the now unused <sys/syscall.h> include.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20260713220932.413004-3-amir73il@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-21 22:04:02 +02:00
..
binderfs selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
empty_mntns selftests/empty_mntns: fix wrong CLONE_EMPTY_MNTNS hex value in comment 2026-04-14 09:30:57 +02:00
epoll selftests/eventpoll: Add test for multiple waiters 2026-06-04 10:25:10 +02:00
eventfd selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
fat selftests/filesystems: Add six consecutive 'x' characters to mktemp 2023-08-16 10:10:39 -06:00
fsmount_ns selftests/fsmount_ns: add missing TARGETS and fix cap test 2026-04-14 09:31:07 +02:00
fuse selftests/fuse: add ACL_DONT_CACHE regression test 2026-07-21 22:04:02 +02:00
mount-notify selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
move_mount selftests/filesystems: add MOVE_MOUNT_BENEATH rootfs tests 2026-03-12 13:34:59 +01:00
nsfs selftests: fix mntns iteration selftests 2026-02-27 22:00:11 +01:00
open_tree_ns selftests: add FSMOUNT_NAMESPACE tests 2026-03-12 13:33:54 +01:00
openat2 selftests: openat2: port emptypath_test to kselftest harness 2026-05-21 15:33:48 +02:00
overlayfs selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
statmount selftests/statmount: remove duplicate wait_for_pid() 2026-04-14 09:30:31 +02:00
xattr selftests/xattr: test xattrs on various socket families 2026-03-02 11:06:43 +01:00
.gitignore selftests/filesystems: test O_TMPFILE creation on idmapped mounts 2026-07-01 15:26:18 +02:00
anon_inode_test.c kselftest/anon_inode: replace null pointers with empty arrays 2025-12-31 10:50:13 -07:00
devpts_pts.c selftests/filesystems: Assume that TIOCGPTPEER is defined 2026-03-02 11:08:20 +01:00
dnotify_test.c
fclog.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
file_stressor.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
idmapped_tmpfile.c selftests/filesystems: test O_TMPFILE creation on idmapped mounts 2026-07-01 15:26:18 +02:00
kernfs_test.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
Makefile selftests/filesystems: test O_TMPFILE creation on idmapped mounts 2026-07-01 15:26:18 +02:00
utils.c selftests/filesystems: add tests for empty mount namespaces 2026-03-12 13:33:55 +01:00
utils.h selftests/filesystems: add tests for empty mount namespaces 2026-03-12 13:33:55 +01:00
wrappers.h selftests/pidfd: move syscall definitions into wrappers.h 2025-05-12 11:40:12 +02:00