fuse: warn if fuse_access is called when idmapped mounts are allowed
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Tue, 3 Sep 2024 15:16:24 +0000 (17:16 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 4 Sep 2024 14:51:11 +0000 (16:51 +0200)
It is not possible with the current fuse code, but let's protect ourselves
from regressions in the future.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dir.c

index 6f289fa..99f9948 100644 (file)
@@ -1474,6 +1474,14 @@ static int fuse_access(struct inode *inode, int mask)
 
        BUG_ON(mask & MAY_NOT_BLOCK);
 
+       /*
+        * We should not send FUSE_ACCESS to the userspace
+        * when idmapped mounts are enabled as for this case
+        * we have fc->default_permissions = 1 and access
+        * permission checks are done on the kernel side.
+        */
+       WARN_ON_ONCE(!(fm->sb->s_iflags & SB_I_NOIDMAP));
+
        if (fm->fc->no_access)
                return 0;