fuse: fix up uid/gid mount option handling
Subsystems (2)
cover fuse: fix up uid/gid mount option handling
This short series fixes up fuse uid/gid mount option handling.
First, as was done for tmpfs in0200679fc795 ("tmpfs: verify {g,u}id mount options correctly") it validates that the requested uid and/or gid is representable in the filesystem's idmapping. I've shamelessly copied commit description and code from that commit.
Second, it is switched to use the uid/gid mount helpers proposed at
https://lore.kernel.org/linux-fsdevel/[email protected]/T/#t
Both of these are compile-tested only.
Thanks,
-Eric
PATCH 1/2 fuse: verify {g,u}id mount options correctly
As was done in0200679fc795 ("tmpfs: verify {g,u}id mount options correctly") we need to validate that the requested uid and/or gid is representable in the filesystem's idmapping.
Cribbing from the above commit log,
The contract for {g,u}id mount options and {g,u}id values in general set from userspace has always been that they are translated according to the caller's idmapping. In so far, fuse has been doing the correct thing. But since fuse is mountable in unprivileged contexts it is also necessary to verify that the resulting {k,g}uid is representable in the namespace of the superblock.
---
p.s. sorry for the delay getting this posted
fs/fuse/inode.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
fs/fuse/inode.c +20 -4
@@ -755,6 +755,8 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)struct fs_parse_result result;struct fuse_fs_context *ctx = fsc->fs_private;int opt; +kuid_t kuid; +kgid_t kgid;if (fsc->purpose ==FS_CONTEXT_FOR_RECONFIGURE ) {/*
@@ -799,16 +801,30 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)break ;case OPT_USER_ID : - ctx->user_id =make_kuid (fsc->user_ns, result.uint_32); -if (!uid_valid (ctx->user_id)) + kuid =make_kuid (fsc->user_ns, result.uint_32); +if (!uid_valid (kuid))return invalfc (fsc,"Invalid user_id" ); +/* +* The requested uid must be representable in the +* filesystem's idmapping. +*/ +if (!kuid_has_mapping (fsc->user_ns, kuid)) +return invalfc (fsc,"Invalid user_id" ); + ctx->user_id = kuid; ctx->user_id_present = true;break ;case OPT_GROUP_ID : - ctx->group_id =make_kgid (fsc->user_ns, result.uint_32); -if (!gid_valid (ctx->group_id)) + kgid =make_kgid (fsc->user_ns, result.uint_32);; +if (!gid_valid (kgid)) +return invalfc (fsc,"Invalid group_id" ); +/* +* The requested gid must be representable in the +* filesystem's idmapping. +*/ +if (!kgid_has_mapping (fsc->user_ns, kgid))return invalfc (fsc,"Invalid group_id" ); + ctx->group_id = kgid; ctx->group_id_present = true;break ;
Signature · 1 line
2.45.2
PATCH 2/2 fuse: Convert to new uid/gid option parsing helpers
In reply to Eric SandeenConvert to new uid/gid option parsing helpers
--- fs/fuse/inode.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/fuse/inode.c +4 -8
@@ -740,8 +740,8 @@ static const struct fs_parameter_spec fuse_fs_parameters[] = {fsparam_string ("source" ,OPT_SOURCE ),fsparam_u32 ("fd" ,OPT_FD ),fsparam_u32oct ("rootmode" ,OPT_ROOTMODE ), -fsparam_u32 ("user_id" ,OPT_USER_ID ), -fsparam_u32 ("group_id" ,OPT_GROUP_ID ), +fsparam_uid ("user_id" ,OPT_USER_ID ), +fsparam_gid ("group_id" ,OPT_GROUP_ID ),fsparam_flag ("default_permissions" ,OPT_DEFAULT_PERMISSIONS ),fsparam_flag ("allow_other" ,OPT_ALLOW_OTHER ), fsparam_u32 ("max_read", OPT_MAX_READ),
@@ -801,9 +801,7 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)break ;case OPT_USER_ID : - kuid =make_kuid (fsc->user_ns, result.uint_32); -if (!uid_valid (kuid)) -return invalfc (fsc,"Invalid user_id" ); + kuid = result.uid;/* * The requested uid must be representable in the * filesystem's idmapping.
@@ -815,9 +813,7 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)break ;case OPT_GROUP_ID : - kgid =make_kgid (fsc->user_ns, result.uint_32);; -if (!gid_valid (kgid)) -return invalfc (fsc,"Invalid group_id" ); + kgid = result.gid;/* * The requested gid must be representable in the * filesystem's idmapping.
Signature · 1 line
2.45.2
kernel test robot
build botRe: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers
kernel test robot noticed the following build errors:
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on mszeredi-fuse/for-next]
[also build test ERROR on linus/master v6.10-rc6 next-20240703] [cannot apply to brauner-vfs/vfs.all]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Sandeen/fuse-verify-g-u-id-mount-options-correctly/20240703-162239 base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next patch link: https://lore.kernel.org/r/4e1a4efa-4ca5-4358-acee-40efd07c3c44%40redhat.com patch subject: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers config: m68k-atari_defconfig (https://download.01.org/0day-ci/archive/20240704/[email protected]/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240704/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
>> fs/fuse/inode.c:743:9: error: implicit declaration of function 'fsparam_uid'; did you mean 'fsparam_u32'? [-Werror=implicit-function-declaration]
743 | fsparam_uid ("user_id", OPT_USER_ID),
| ^~~~~~~~~~~
| fsparam_u32
>> fs/fuse/inode.c:743:9: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
fs/fuse/inode.c:743:9: note: (near initialization for 'fuse_fs_parameters[3].name')
>> fs/fuse/inode.c:743:9: error: initializer element is not constant
fs/fuse/inode.c:743:9: note: (near initialization for 'fuse_fs_parameters[3].name')
>> fs/fuse/inode.c:744:9: error: implicit declaration of function 'fsparam_gid'; did you mean 'fsparam_fd'? [-Werror=implicit-function-declaration]
744 | fsparam_gid ("group_id", OPT_GROUP_ID),
| ^~~~~~~~~~~
| fsparam_fd
>> fs/fuse/inode.c:744:9: warning: initialization of 'int (*)(struct p_log *, const struct fs_parameter_spec *, struct fs_parameter *, struct fs_parse_result *)' from 'int' makes pointer from integer without a cast [-Wint-conversion]
fs/fuse/inode.c:744:9: note: (near initialization for 'fuse_fs_parameters[3].type')
fs/fuse/inode.c:744:9: error: initializer element is not constant
fs/fuse/inode.c:744:9: note: (near initialization for 'fuse_fs_parameters[3].type')
>> fs/fuse/inode.c:745:9: warning: braces around scalar initializer
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
fs/fuse/inode.c:745:9: note: (near initialization for 'fuse_fs_parameters[3].opt')
In file included from fs/fuse/inode.c:19:
>> include/linux/fs_parser.h:109:17: error: field name not in record or union initializer
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:109:17: note: (near initialization for 'fuse_fs_parameters[3].opt')
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
>> fs/fuse/inode.c:745:26: warning: initialization of 'u8' {aka 'unsigned char'} from 'char *' makes integer from pointer without a cast [-Wint-conversion]
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
fs/fuse/inode.c:745:26: note: (near initialization for 'fuse_fs_parameters[3].opt')
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
>> fs/fuse/inode.c:745:26: error: initializer element is not computable at load time
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
fs/fuse/inode.c:745:26: note: (near initialization for 'fuse_fs_parameters[3].opt')
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:17: error: field name not in record or union initializer
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:17: note: (near initialization for 'fuse_fs_parameters[3].opt')
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
>> fs/fuse/inode.c:745:49: warning: excess elements in scalar initializer
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
fs/fuse/inode.c:745:49: note: (near initialization for 'fuse_fs_parameters[3].opt')
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:111:17: error: field name not in record or union initializer
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:111:17: note: (near initialization for 'fuse_fs_parameters[3].opt')
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
include/linux/fs_parser.h:116:43: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].opt')
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
include/linux/fs_parser.h:116:43: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:112:17: error: field name not in record or union initializer
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:112:17: note: (near initialization for 'fuse_fs_parameters[3].opt')
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
>> include/linux/fs_parser.h:116:60: warning: excess elements in scalar initializer
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:116:60: note: (near initialization for 'fuse_fs_parameters[3].opt')
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:113:17: error: field name not in record or union initializer
113 | .data = DATA \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:113:17: note: (near initialization for 'fuse_fs_parameters[3].opt')
113 | .data = DATA \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:116:63: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].opt')
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:116:63: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:745:9: note: in expansion of macro 'fsparam_flag'
745 | fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:9: warning: braces around scalar initializer
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:9: note: (near initialization for 'fuse_fs_parameters[3].flags')
>> include/linux/fs_parser.h:109:17: error: field name not in record or union initializer
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:109:17: note: (near initialization for 'fuse_fs_parameters[3].flags')
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
>> fs/fuse/inode.c:746:26: warning: initialization of 'short unsigned int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:26: note: (near initialization for 'fuse_fs_parameters[3].flags')
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:26: error: initializer element is not computable at load time
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:26: note: (near initialization for 'fuse_fs_parameters[3].flags')
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~
include/linux/fs_parser.h:109:25: note: in definition of macro '__fsparam'
109 | .name = NAME, \
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:17: error: field name not in record or union initializer
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:17: note: (near initialization for 'fuse_fs_parameters[3].flags')
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:49: warning: excess elements in scalar initializer
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:746:49: note: (near initialization for 'fuse_fs_parameters[3].flags')
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:111:17: error: field name not in record or union initializer
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:111:17: note: (near initialization for 'fuse_fs_parameters[3].flags')
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
include/linux/fs_parser.h:116:43: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].flags')
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
include/linux/fs_parser.h:116:43: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:112:17: error: field name not in record or union initializer
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:112:17: note: (near initialization for 'fuse_fs_parameters[3].flags')
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
>> include/linux/fs_parser.h:116:60: warning: excess elements in scalar initializer
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:116:60: note: (near initialization for 'fuse_fs_parameters[3].flags')
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:113:17: error: field name not in record or union initializer
113 | .data = DATA \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:113:17: note: (near initialization for 'fuse_fs_parameters[3].flags')
113 | .data = DATA \
| ^
include/linux/fs_parser.h:116:33: note: in expansion of macro '__fsparam'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:116:63: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].flags')
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:116:63: note: in expansion of macro 'NULL'
116 | #define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:746:9: note: in expansion of macro 'fsparam_flag'
746 | fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
| ^~~~~~~~~~~~
fs/fuse/inode.c:747:9: warning: braces around scalar initializer
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
fs/fuse/inode.c:747:9: note: (near initialization for 'fuse_fs_parameters[3].data')
>> include/linux/fs_parser.h:109:17: error: field name not in record or union initializer
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:109:17: note: (near initialization for 'fuse_fs_parameters[3].data')
109 | .name = NAME, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:110:17: error: field name not in record or union initializer
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:110:17: note: (near initialization for 'fuse_fs_parameters[3].data')
110 | .opt = OPT, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
fs/fuse/inode.c:747:49: warning: excess elements in scalar initializer
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
fs/fuse/inode.c:747:49: note: (near initialization for 'fuse_fs_parameters[3].data')
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~~
include/linux/fs_parser.h:110:24: note: in definition of macro '__fsparam'
110 | .opt = OPT, \
| ^~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:111:17: error: field name not in record or union initializer
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:111:17: note: (near initialization for 'fuse_fs_parameters[3].data')
111 | .type = TYPE, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:120:43: warning: excess elements in scalar initializer
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~~~~~~~
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:120:43: note: (near initialization for 'fuse_fs_parameters[3].data')
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~~~~~~~
include/linux/fs_parser.h:111:25: note: in definition of macro '__fsparam'
111 | .type = TYPE, \
| ^~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:112:17: error: field name not in record or union initializer
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:112:17: note: (near initialization for 'fuse_fs_parameters[3].data')
112 | .flags = FLAGS, \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:120:71: warning: excess elements in scalar initializer
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:120:71: note: (near initialization for 'fuse_fs_parameters[3].data')
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^
include/linux/fs_parser.h:112:26: note: in definition of macro '__fsparam'
112 | .flags = FLAGS, \
| ^~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:113:17: error: field name not in record or union initializer
113 | .data = DATA \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/fs_parser.h:113:17: note: (near initialization for 'fuse_fs_parameters[3].data')
113 | .data = DATA \
| ^
include/linux/fs_parser.h:120:33: note: in expansion of macro '__fsparam'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~~~~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:120:74: note: in expansion of macro 'NULL'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].data')
8 | #define NULL ((void *)0)
| ^
include/linux/fs_parser.h:113:25: note: in definition of macro '__fsparam'
113 | .data = DATA \
| ^~~~
include/linux/fs_parser.h:120:74: note: in expansion of macro 'NULL'
120 | #define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
| ^~~~
fs/fuse/inode.c:747:9: note: in expansion of macro 'fsparam_u32'
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| ^~~~~~~~~~~
>> fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
739 | static const struct fs_parameter_spec fuse_fs_parameters[] = {
| ^
......
743 | fsparam_uid ("user_id", OPT_USER_ID),
| {
>> fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
739 | static const struct fs_parameter_spec fuse_fs_parameters[] = {
| ^
......
743 | fsparam_uid ("user_id", OPT_USER_ID),
| {
......
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| }
>> fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
739 | static const struct fs_parameter_spec fuse_fs_parameters[] = {
| ^
......
743 | fsparam_uid ("user_id", OPT_USER_ID),
| {
......
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| }
>> fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
739 | static const struct fs_parameter_spec fuse_fs_parameters[] = {
| ^
......
743 | fsparam_uid ("user_id", OPT_USER_ID),
| {
......
747 | fsparam_u32 ("max_read", OPT_MAX_READ),
| }
fs/fuse/inode.c: In function 'fuse_parse_param':
>> fs/fuse/inode.c:804:30: error: 'struct fs_parse_result' has no member named 'uid'
804 | kuid = result.uid;
| ^
fs/fuse/inode.c:816:30: error: 'struct fs_parse_result' has no member named 'gid'
816 | kgid = result.gid;
| ^cc1: some warnings being treated as errors
vim +743 fs/fuse/inode.c
738
> 739 static const struct fs_parameter_spec fuse_fs_parameters[] = {
740 fsparam_string ("source", OPT_SOURCE),
741 fsparam_u32 ("fd", OPT_FD),
742 fsparam_u32oct ("rootmode", OPT_ROOTMODE),
> 743 fsparam_uid ("user_id", OPT_USER_ID),
> 744 fsparam_gid ("group_id", OPT_GROUP_ID),
> 745 fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
> 746 fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
> 747 fsparam_u32 ("max_read", OPT_MAX_READ),
748 fsparam_u32 ("blksize", OPT_BLKSIZE),
749 fsparam_string ("subtype", OPT_SUBTYPE),
750 {}
751 };
752
753 static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)
754 {
755 struct fs_parse_result result;
756 struct fuse_fs_context *ctx = fsc->fs_private;
757 int opt;
758 kuid_t kuid;
759 kgid_t kgid;
760
761 if (fsc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
762 /*
763 * Ignore options coming from mount(MS_REMOUNT) for backward
764 * compatibility.
765 */
766 if (fsc->oldapi)
767 return 0;
768
769 return invalfc(fsc, "No changes allowed in reconfigure");
770 }
771
772 opt = fs_parse(fsc, fuse_fs_parameters, param, &result);
773 if (opt < 0)
774 return opt;
775
776 switch (opt) {
777 case OPT_SOURCE:
778 if (fsc->source)
779 return invalfc(fsc, "Multiple sources specified");
780 fsc->source = param->string;
781 param->string = NULL;
782 break;
783
784 case OPT_SUBTYPE:
785 if (ctx->subtype)
786 return invalfc(fsc, "Multiple subtypes specified");
787 ctx->subtype = param->string;
788 param->string = NULL;
789 return 0;
790
791 case OPT_FD:
792 ctx->fd = result.uint_32;
793 ctx->fd_present = true;
794 break;
795
796 case OPT_ROOTMODE:
797 if (!fuse_valid_type(result.uint_32))
798 return invalfc(fsc, "Invalid rootmode");
799 ctx->rootmode = result.uint_32;
800 ctx->rootmode_present = true;
801 break;
802
803 case OPT_USER_ID:
> 804 kuid = result.uid;
805 /*
806 * The requested uid must be representable in the
807 * filesystem's idmapping.
808 */
809 if (!kuid_has_mapping(fsc->user_ns, kuid))
810 return invalfc(fsc, "Invalid user_id");
811 ctx->user_id = kuid;
812 ctx->user_id_present = true;
813 break;
814
815 case OPT_GROUP_ID:
> 816 kgid = result.gid; 817 /*
818 * The requested gid must be representable in the
819 * filesystem's idmapping.
820 */
821 if (!kgid_has_mapping(fsc->user_ns, kgid))
822 return invalfc(fsc, "Invalid group_id");
823 ctx->group_id = kgid;
824 ctx->group_id_present = true;
825 break;
826
827 case OPT_DEFAULT_PERMISSIONS:
828 ctx->default_permissions = true;
829 break;
830
831 case OPT_ALLOW_OTHER:
832 ctx->allow_other = true;
833 break;
834
835 case OPT_MAX_READ:
836 ctx->max_read = result.uint_32;
837 break;
838
839 case OPT_BLKSIZE:
840 if (!ctx->is_bdev)
841 return invalfc(fsc, "blksize only supported for fuseblk");
842 ctx->blksize = result.uint_32;
843 break;
844
845 default:
846 return -EINVAL;
847 }
848
849 return 0;
850 }
851
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers
In reply to Eric Sandeenkernel test robot noticed the following build errors:
Hi Eric,
kernel test robot noticed the following build errors:
[auto build test ERROR on mszeredi-fuse/for-next]
[also build test ERROR on linus/master vfs-idmapping/for-next v6.10-rc6 next-20240703] [cannot apply to brauner-vfs/vfs.all]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Sandeen/fuse-verify-g-u-id-mount-options-correctly/20240703-162239 base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next patch link: https://lore.kernel.org/r/4e1a4efa-4ca5-4358-acee-40efd07c3c44%40redhat.com patch subject: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers config: mips-mtx1_defconfig (https://download.01.org/0day-ci/archive/20240704/[email protected]/config) compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240704/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
fs/fuse/inode.c:743:2: error: call to undeclared function 'fsparam_uid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
fsparam_uid ("user_id", OPT_USER_ID),
^
fs/fuse/inode.c:744:2: error: call to undeclared function 'fsparam_gid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
fsparam_gid ("group_id", OPT_GROUP_ID),
^
fs/fuse/inode.c:743:2: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
fsparam_uid ("user_id", OPT_USER_ID),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fuse/inode.c:744:2: error: incompatible integer to pointer conversion initializing 'fs_param_type *' (aka 'int (*)(struct p_log *, const struct fs_parameter_spec *, struct fs_parameter *, struct fs_parse_result *)') with an expression of type 'int' [-Wint-conversion]
fsparam_gid ("group_id", OPT_GROUP_ID),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/fuse/inode.c:745:2: error: designator in initializer for scalar type 'u8' (aka 'unsigned char')
fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:116:33: note: expanded from macro 'fsparam_flag'
#define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:3: note: expanded from macro '__fsparam'
.name = NAME, \
^~~~~~~~~~~~
>> fs/fuse/inode.c:746:2: error: designator in initializer for scalar type 'unsigned short'
fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:116:33: note: expanded from macro 'fsparam_flag'
#define fsparam_flag(NAME, OPT) __fsparam(NULL, NAME, OPT, 0, NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:3: note: expanded from macro '__fsparam'
.name = NAME, \
^~~~~~~~~~~~
>> fs/fuse/inode.c:747:2: error: designator in initializer for scalar type 'const void *'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:120:32: note: expanded from macro 'fsparam_u32'
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fs_parser.h:109:3: note: expanded from macro '__fsparam'
.name = NAME, \
^~~~~~~~~~~~
fs/fuse/inode.c:743:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
fsparam_uid ("user_id", OPT_USER_ID),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
fs/fuse/inode.c:804:17: error: no member named 'uid' in 'struct fs_parse_result'
kuid = result.uid;
~~~~~~ ^
fs/fuse/inode.c:816:17: error: no member named 'gid' in 'struct fs_parse_result'
kgid = result.gid;
~~~~~~ ^1 warning and 9 errors generated.
vim +745 fs/fuse/inode.c
d8a5ba45457e4a Miklos Szeredi 2005-09-09 738
d7167b149943e3 Al Viro 2019-09-07 739 static const struct fs_parameter_spec fuse_fs_parameters[] = {
c30da2e981a703 David Howells 2019-03-25 740 fsparam_string ("source", OPT_SOURCE),
c30da2e981a703 David Howells 2019-03-25 741 fsparam_u32 ("fd", OPT_FD),
c30da2e981a703 David Howells 2019-03-25 742 fsparam_u32oct ("rootmode", OPT_ROOTMODE),
b382c6a31542e9 Eric Sandeen 2024-07-02 743 fsparam_uid ("user_id", OPT_USER_ID),
b382c6a31542e9 Eric Sandeen 2024-07-02 744 fsparam_gid ("group_id", OPT_GROUP_ID),
c30da2e981a703 David Howells 2019-03-25 @745 fsparam_flag ("default_permissions", OPT_DEFAULT_PERMISSIONS),
c30da2e981a703 David Howells 2019-03-25 @746 fsparam_flag ("allow_other", OPT_ALLOW_OTHER),
c30da2e981a703 David Howells 2019-03-25 @747 fsparam_u32 ("max_read", OPT_MAX_READ),
c30da2e981a703 David Howells 2019-03-25 748 fsparam_u32 ("blksize", OPT_BLKSIZE),
c7eb6869632a5d David Howells 2019-03-25 749 fsparam_string ("subtype", OPT_SUBTYPE),
c30da2e981a703 David Howells 2019-03-25 750 {}
d8a5ba45457e4a Miklos Szeredi 2005-09-09 751 };d8a5ba45457e4a Miklos Szeredi 2005-09-09 752
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers
In reply to Eric Sandeenkernel test robot noticed the following build warnings:
Hi Eric,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mszeredi-fuse/for-next]
[also build test WARNING on linus/master v6.10-rc6 next-20240703] [cannot apply to brauner-vfs/vfs.all]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Sandeen/fuse-verify-g-u-id-mount-options-correctly/20240703-162239 base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next patch link: https://lore.kernel.org/r/4e1a4efa-4ca5-4358-acee-40efd07c3c44%40redhat.com patch subject: [PATCH 2/2] fuse: Convert to new uid/gid option parsing helpers config: i386-randconfig-053-20240704 (https://download.01.org/0day-ci/archive/20240704/[email protected]/config) compiler: gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240704/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
include/linux/fs_parser.h:120:70: warning: excess elements in scalar initializer
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^
include/linux/fs_parser.h:112:12: note: in definition of macro '__fsparam'
.flags = FLAGS, \
^~~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
include/linux/fs_parser.h:120:70: note: (near initialization for 'fuse_fs_parameters[3].data')
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^
include/linux/fs_parser.h:112:12: note: in definition of macro '__fsparam'
.flags = FLAGS, \
^~~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
include/linux/fs_parser.h:113:3: error: field name not in record or union initializer
.data = DATA \
^
include/linux/fs_parser.h:120:32: note: in expansion of macro '__fsparam'
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^~~~~~~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
include/linux/fs_parser.h:113:3: note: (near initialization for 'fuse_fs_parameters[3].data')
.data = DATA \
^
include/linux/fs_parser.h:120:32: note: in expansion of macro '__fsparam'
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^~~~~~~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
include/linux/stddef.h:8:14: warning: excess elements in scalar initializer
#define NULL ((void *)0)
^
include/linux/fs_parser.h:113:11: note: in definition of macro '__fsparam'
.data = DATA \
^~~~
include/linux/fs_parser.h:120:73: note: in expansion of macro 'NULL'
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
include/linux/stddef.h:8:14: note: (near initialization for 'fuse_fs_parameters[3].data')
#define NULL ((void *)0)
^
include/linux/fs_parser.h:113:11: note: in definition of macro '__fsparam'
.data = DATA \
^~~~
include/linux/fs_parser.h:120:73: note: in expansion of macro 'NULL'
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
^~~~
fs/fuse/inode.c:747:2: note: in expansion of macro 'fsparam_u32'
fsparam_u32 ("max_read", OPT_MAX_READ),
^~~~~~~~~~~
fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
static const struct fs_parameter_spec fuse_fs_parameters[] = {
^
fs/fuse/inode.c:743:2:
fsparam_uid ("user_id", OPT_USER_ID),
{
fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
static const struct fs_parameter_spec fuse_fs_parameters[] = {
^
fs/fuse/inode.c:743:2:
fsparam_uid ("user_id", OPT_USER_ID),
{
fs/fuse/inode.c:747:41:
fsparam_u32 ("max_read", OPT_MAX_READ),
}
fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
static const struct fs_parameter_spec fuse_fs_parameters[] = {
^
fs/fuse/inode.c:743:2:
fsparam_uid ("user_id", OPT_USER_ID),
{
fs/fuse/inode.c:747:41:
fsparam_u32 ("max_read", OPT_MAX_READ),
}
fs/fuse/inode.c:739:62: warning: missing braces around initializer [-Wmissing-braces]
static const struct fs_parameter_spec fuse_fs_parameters[] = {
^
fs/fuse/inode.c:743:2:
fsparam_uid ("user_id", OPT_USER_ID),
{
fs/fuse/inode.c:747:41:
fsparam_u32 ("max_read", OPT_MAX_READ),
}
fs/fuse/inode.c: In function 'fuse_parse_param':
fs/fuse/inode.c:804:16: error: 'struct fs_parse_result' has no member named 'uid'
kuid = result.uid;
^
fs/fuse/inode.c:804:8: error: incompatible types when assigning to type 'kuid_t' {aka 'struct <anonymous>'} from type 'const struct fs_parameter_spec *'
kuid = result.uid;
^
>> fs/fuse/inode.c:804:3: warning: statement with no effect [-Wunused-value]
kuid = result.uid;
^~~~
fs/fuse/inode.c:816:16: error: 'struct fs_parse_result' has no member named 'gid'
kgid = result.gid;
^
fs/fuse/inode.c:816:8: error: incompatible types when assigning to type 'kgid_t' {aka 'struct <anonymous>'} from type 'const struct fs_parameter_spec *'
kgid = result.gid;
^
fs/fuse/inode.c:816:3: warning: statement with no effect [-Wunused-value]
kgid = result.gid;
^~~~cc1: some warnings being treated as errors
vim +804 fs/fuse/inode.c
752
753 static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)
754 {
755 struct fs_parse_result result;
756 struct fuse_fs_context *ctx = fsc->fs_private;
757 int opt;
758 kuid_t kuid;
759 kgid_t kgid;
760
761 if (fsc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
762 /*
763 * Ignore options coming from mount(MS_REMOUNT) for backward
764 * compatibility.
765 */
766 if (fsc->oldapi)
767 return 0;
768
769 return invalfc(fsc, "No changes allowed in reconfigure");
770 }
771
772 opt = fs_parse(fsc, fuse_fs_parameters, param, &result);
773 if (opt < 0)
774 return opt;
775
776 switch (opt) {
777 case OPT_SOURCE:
778 if (fsc->source)
779 return invalfc(fsc, "Multiple sources specified");
780 fsc->source = param->string;
781 param->string = NULL;
782 break;
783
784 case OPT_SUBTYPE:
785 if (ctx->subtype)
786 return invalfc(fsc, "Multiple subtypes specified");
787 ctx->subtype = param->string;
788 param->string = NULL;
789 return 0;
790
791 case OPT_FD:
792 ctx->fd = result.uint_32;
793 ctx->fd_present = true;
794 break;
795
796 case OPT_ROOTMODE:
797 if (!fuse_valid_type(result.uint_32))
798 return invalfc(fsc, "Invalid rootmode");
799 ctx->rootmode = result.uint_32;
800 ctx->rootmode_present = true;
801 break;
802
803 case OPT_USER_ID:
> 804 kuid = result.uid;
805 /*
806 * The requested uid must be representable in the
807 * filesystem's idmapping.
808 */
809 if (!kuid_has_mapping(fsc->user_ns, kuid))
810 return invalfc(fsc, "Invalid user_id");
811 ctx->user_id = kuid;
812 ctx->user_id_present = true;
813 break;
814
815 case OPT_GROUP_ID:
816 kgid = result.gid;
817 /*
818 * The requested gid must be representable in the
819 * filesystem's idmapping.
820 */
821 if (!kgid_has_mapping(fsc->user_ns, kgid))
822 return invalfc(fsc, "Invalid group_id");
823 ctx->group_id = kgid;
824 ctx->group_id_present = true;
825 break;
826
827 case OPT_DEFAULT_PERMISSIONS:
828 ctx->default_permissions = true;
829 break;
830
831 case OPT_ALLOW_OTHER:
832 ctx->allow_other = true;
833 break;
834
835 case OPT_MAX_READ:
836 ctx->max_read = result.uint_32;
837 break;
838
839 case OPT_BLKSIZE:
840 if (!ctx->is_bdev)
841 return invalfc(fsc, "blksize only supported for fuseblk");
842 ctx->blksize = result.uint_32;
843 break;
844
845 default:
846 return -EINVAL;
847 }
848
849 return 0;
850 }
851
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 10 lines · Eric Sandeen
This short series fixes up fuse uid/gid mount option handling.
First, as was done for tmpfs in
0200679fc795("tmpfs: verify {g,u}id mount options correctly") it validates that the requested uid and/or gid is representable in the filesystem's idmapping. I've shamelessly copied commit description and code from that commit.Second, it is switched to use the uid/gid mount helpers proposed at
https://lore.kernel.org/linux-fsdevel/[email protected]/T/#t
Quoted 8 lines · Eric Sandeen
This short series fixes up fuse uid/gid mount option handling.
First, as was done for tmpfs in
0200679fc795("tmpfs: verify {g,u}id mount options correctly") it validates that the requested uid and/or gid is representable in the filesystem's idmapping. I've shamelessly copied commit description and code from that commit.
Quoted 4 lines
Second, it is switched to use the uid/gid mount helpers proposed at
https://lore.kernel.org/linux-fsdevel/[email protected]/T/#tBoth of these are compile-tested only.
Thanks,
Josef
Quoted 9 lines · Eric Sandeen
This short series fixes up fuse uid/gid mount option handling.
First, as was done for tmpfs in
0200679fc795("tmpfs: verify {g,u}id mount options correctly") it validates that the requested uid and/or gid is representable in the filesystem's idmapping. I've shamelessly copied commit description and code from that commit.[...]
Miklos, I've taken this because I have the required helper in vfs.mount.api. But if you want to take it just tell me then I can give you a stable branch so that you can pull the helper.
---
Applied to the vfs.mount.api branch of the vfs/vfs.git tree. Patches in the vfs.mount.api branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.mount.api
[1/2] fuse: verify {g,u}id mount options correctly
https://git.kernel.org/vfs/vfs/c/525bd65aa759 [2/2] fuse: Convert to new uid/gid option parsing helpers https://git.kernel.org/vfs/vfs/c/eea6a8322efd