From d279bae7774f350aebe9e139b4877487a0318d36 Mon Sep 17 00:00:00 2001 From: Renzheng Wang Date: Sun, 15 Mar 2026 19:55:32 +0800 Subject: [PATCH 1/2] add FUSE_CAP_ALLOW_IDMAP (#1446) * fuse: add FUSE_CAP_ALLOW_IDMAP support Add FUSE_CAP_ALLOW_IDMAP capability flag to indicate that creation of idmapped mounts is allowed. This maps to the kernel's FUSE_ALLOW_IDMAP flag. - Define FUSE_CAP_ALLOW_IDMAP in fuse_common.h using (1ULL << 32) to ensure correct behavior on both 32-bit and 64-bit platforms. - Set the capability in capable_ext when kernel reports FUSE_ALLOW_IDMAP. - Send FUSE_ALLOW_IDMAP to kernel when userspace sets it in want_ext. - Add the new FUSE_CAP_ALLOW_IDMAP capability to the printcap example so it is printed when supported by the kernel. Signed-off-by: Renzheng Wang [Conflict in example/printcap.c: fused does not have the clang-format of the capability table, so only the upstream FUSE_CAP_ALLOW_IDMAP line was added.] (cherry picked from commit 1f4c0608e7c6202f88db791c19cc4bfe60d40edd) Signed-off-by: Mohamad Chaarawi --- example/printcap.c | 1 + include/fuse_common.h | 5 +++++ lib/fuse_lowlevel.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/example/printcap.c b/example/printcap.c index 4c59582f9e..2cc8cd0ee7 100644 --- a/example/printcap.c +++ b/example/printcap.c @@ -65,6 +65,7 @@ static const struct cap_info capabilities[] = { {FUSE_CAP_DIRECT_IO_ALLOW_MMAP, "FUSE_CAP_DIRECT_IO_ALLOW_MMAP"}, {FUSE_CAP_NO_EXPORT_SUPPORT, "FUSE_CAP_NO_EXPORT_SUPPORT"}, {FUSE_CAP_PASSTHROUGH, "FUSE_CAP_PASSTHROUGH"}, + { FUSE_CAP_ALLOW_IDMAP, "FUSE_CAP_ALLOW_IDMAP"}, // Add any new capabilities here {0, NULL} // Sentinel to mark the end of the array }; diff --git a/include/fuse_common.h b/include/fuse_common.h index b6934599e5..b5409890d4 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -520,6 +520,11 @@ struct fuse_loop_config_v1 { */ #define FUSE_CAP_OVER_IO_URING (1UL << 31) +/** + * Indicates that creation of idmapped mounts is allowed + */ +#define FUSE_CAP_ALLOW_IDMAP (1ULL << 32) + /** * Ioctl flags * diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 00c2815029..5592382c43 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2766,6 +2766,8 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in, se->conn.capable_ext |= FUSE_CAP_NO_EXPORT_SUPPORT; if (inargflags & FUSE_OVER_IO_URING) se->conn.capable_ext |= FUSE_CAP_OVER_IO_URING; + if (inargflags & FUSE_ALLOW_IDMAP) + se->conn.capable_ext |= FUSE_CAP_ALLOW_IDMAP; } else { se->conn.max_readahead = 0; @@ -2924,6 +2926,8 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in, outargflags |= FUSE_OVER_IO_URING; enable_io_uring = true; } + if (se->conn.want_ext & FUSE_CAP_ALLOW_IDMAP) + outargflags |= FUSE_ALLOW_IDMAP; if ((inargflags & FUSE_REQUEST_TIMEOUT) && se->conn.request_timeout) { outargflags |= FUSE_REQUEST_TIMEOUT; From bf715b793498734335cecdfdc348b56fa447c567 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Fri, 20 Nov 2026 13:45:32 +0000 Subject: [PATCH 2/2] Bump fused version to 1.2.1 for FUSE_CAP_ALLOW_IDMAP Signed-off-by: Mohamad Chaarawi --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 01cd1a372e..6ea1ad1854 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('libfused', ['c'], - version: '1.2.0', # synced with fuse-3.18.3 + version: '1.2.1', # fuse-3.18.3 + FUSE_CAP_ALLOW_IDMAP meson_version: '>= 0.60.0', default_options: [ 'buildtype=debugoptimized',