fuse: Add module param for CAP_SYS_ADMIN access bypassing allow_other
Subsystems (2)
PATCH v3 1/1 fuse: Add module param for CAP_SYS_ADMIN access bypassing allow_other
Since commit 73f03c2b4b52 ("fuse: Restrict allow_other to the superblock's namespace or a descendant"), access to allow_other FUSE filesystems has been limited to users in the mounting user namespace or descendants. This prevents a process that is privileged in its userns - but not its parent namespaces - from mounting a FUSE fs w/ allow_other that is accessible to processes in parent namespaces.
While this restriction makes sense overall it breaks a legitimate
usecase: I have a tracing daemon which needs to peek into process' open files in order to symbolicate - similar to 'perf'. The daemon is a privileged process in the root userns, but is unable to peek into FUSE filesystems mounted by processes in child namespaces.
This patch adds a module param, allow_sys_admin_access, to act as an escape hatch for this descendant userns logic and for the allow_other mount option in general. Setting allow_sys_admin_access allows processes with CAP_SYS_ADMIN in the initial userns to access FUSE filesystems irrespective of the mounting userns or whether allow_other was set. A sysadmin setting this param must trust FUSEs on the host to not DoS processes as described in 73f03c2b4b52.
---
v2 -> v3: lore.kernel.org/linux-fsdevel/[email protected]
* Module param now allows initial userns CAP_SYS_ADMIN to bypass allow_other check entirely
v1 -> v2: lore.kernel.org/linux-fsdevel/[email protected]
* Use module param instead of capability check
fs/fuse/dir.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/fuse/dir.c +10 -0
@@ -11,6 +11,7 @@#include <linux/pagemap.h> #include <linux/file.h> #include <linux/fs_context.h> +#include <linux/moduleparam.h> #include <linux/sched.h> #include <linux/namei.h> #include <linux/slab.h>
@@ -21,6 +22,12 @@#include <linux/types.h> #include <linux/kernel.h> +static bool __read_mostly allow_sys_admin_access; +module_param (allow_sys_admin_access, bool,0644 ); +MODULE_PARM_DESC (allow_sys_admin_access, +"Allow users with CAP_SYS_ADMIN in initial userns " +"to bypass allow_other access check" ); +static void fuse_advise_use_readdirplus (struct inode *dir) {struct fuse_inode *fi =get_fuse_inode (dir);
@@ -1229,6 +1236,9 @@ int fuse_allow_current_process(struct fuse_conn *fc) {const struct cred *cred; +if (allow_sys_admin_access &&capable (CAP_SYS_ADMIN )) +return 1 ; +if (fc->allow_other)return current_in_userns (fc->user_ns);
Signature · 1 line
2.30.2
Christian Brauner
maintainerQuoted 21 lines · Dave Marchevsky
Since commit
73f03c2b4b52("fuse: Restrictallow_otherto the superblock's namespace or a descendant"), access toallow_otherFUSE filesystems has been limited to users in the mounting user namespace or descendants. This prevents a process that is privileged in its userns - but not its parent namespaces - from mounting a FUSE fs w/allow_otherthat is accessible to processes in parent namespaces.While this restriction makes sense overall it breaks a legitimate
usecase: I have a tracing daemon which needs to peek into process' open files in order to symbolicate - similar to 'perf'. The daemon is a privileged process in the root userns, but is unable to peek into FUSE filesystems mounted by processes in child namespaces.This patch adds a module param,
allow_sys_admin_access, to act as an escape hatch for this descendant userns logic and for theallow_othermount option in general. Settingallow_sys_admin_accessallows processes withCAP_SYS_ADMINin the initial userns to access FUSE filesystems irrespective of the mounting userns or whetherallow_otherwas set. A sysadmin setting this param must trust FUSEs on the host to not DoS processes as described in73f03c2b4b52.
Quoted 2 lines
Signed-off-by Dave Marchevsky <[email protected]>---
Could you please add a patch to Documentation/filesystems/fuse.rst and add the module option somwhere in there?
There should also be a comment added how this relates to points 2/i and 2/ii in section "How are requirements fulfilled?".