Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock X-Debbugs-Cc: Cyril Brulebois <k...@debian.org> Control: affects -1 + src:fuse3
Hi RMs, Two issues in src:fuse3 I would like to have fixed for Bookworm. [ Reason ] There's a memory leak in the high level API [1] and the fuse CLI doesn't propagate the allowed maximum threads to use [2]. [ Impact ] In special cases like fuse3 would get a signal during its start it would leak some memory. Users can't set usage constraints in terms of threads (CPU) usage. These are not common situations but would be better to handle these. [ Tests ] Upstream test suite. Tested and built correctly in experimental. Waiting for your permission to upload to Sid. [ Risks ] Minimal, the fixes are small and very targeted. Should not affect the installer creation (as it uses the fuse3 udeb), but kibi is also pinged for an extra check. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing unblock fuse3/3.14.0-4 Thanks for considering, Laszlo/GCS [1] https://github.com/libfuse/libfuse/pull/781 [2] https://github.com/libfuse/libfuse/pull/742
diff -Nru fuse3-3.14.0/debian/changelog fuse3-3.14.0/debian/changelog --- fuse3-3.14.0/debian/changelog 2023-03-17 20:51:05.000000000 +0100 +++ fuse3-3.14.0/debian/changelog 2023-04-18 23:07:15.000000000 +0200 @@ -1,3 +1,11 @@ +fuse3 (3.14.0-4) unstable; urgency=medium + + * Backport upstream fixes: + - fix max_threads command line parameter propagation, + - fix memory leak in high level API. + + -- Laszlo Boszormenyi (GCS) <g...@debian.org> Tue, 18 Apr 2023 23:07:15 +0200 + fuse3 (3.14.0-3) unstable; urgency=medium [ Helge Deller <del...@gmx.de> ] diff -Nru fuse3-3.14.0/debian/patches/Fix-max_threads-command-line-parameter-propagation.patch fuse3-3.14.0/debian/patches/Fix-max_threads-command-line-parameter-propagation.patch --- fuse3-3.14.0/debian/patches/Fix-max_threads-command-line-parameter-propagation.patch 1970-01-01 01:00:00.000000000 +0100 +++ fuse3-3.14.0/debian/patches/Fix-max_threads-command-line-parameter-propagation.patch 2023-04-17 21:34:29.000000000 +0200 @@ -0,0 +1,24 @@ +From ab5ca07af03b7dbb33193666c13b938534bde0e4 Mon Sep 17 00:00:00 2001 +From: Sarath Lakshman <sar...@couchbase.com> +Date: Sat, 11 Mar 2023 16:58:31 +0530 +Subject: [PATCH] Fix max_threads command line parameter propagation + +The fuse_main_real() method doesn't apply the max_threads parameter +parsed through the commandline arguments. This commit fixes the wiring +of max_threads argument. +--- + lib/helper.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/helper.c b/lib/helper.c +index 35c6a98c..14a0df33 100644 +--- a/lib/helper.c ++++ b/lib/helper.c +@@ -377,6 +377,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, + fuse_loop_cfg_set_clone_fd(loop_config, opts.clone_fd); + + fuse_loop_cfg_set_idle_threads(loop_config, opts.max_idle_threads); ++ fuse_loop_cfg_set_max_threads(loop_config, opts.max_threads); + res = fuse_loop_mt(fuse, loop_config); + } + if (res) diff -Nru fuse3-3.14.0/debian/patches/Fix_memory_leak_in_high_level_API.patch fuse3-3.14.0/debian/patches/Fix_memory_leak_in_high_level_API.patch --- fuse3-3.14.0/debian/patches/Fix_memory_leak_in_high_level_API.patch 1970-01-01 01:00:00.000000000 +0100 +++ fuse3-3.14.0/debian/patches/Fix_memory_leak_in_high_level_API.patch 2023-04-17 21:34:29.000000000 +0200 @@ -0,0 +1,66 @@ +From fcd293f675fc7bfa0522186c5d68ef932eec6945 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Matthias=20G=C3=B6rgens?= <matthias.goerg...@gmail.com> +Date: Fri, 14 Apr 2023 19:19:03 +0800 +Subject: [PATCH] Fix memory leak in high level API (#781) + +Previously, in the high level API if we received a signal between +setting up signal handlers and processing INIT, we would leak + +``` +$ ./example/hello -s -d -f mountpoint/ +[9/9] Linking target example/hello_ll +FUSE library version: 3.14.1 +nullpath_ok: 0 + +================================================================= +==178330==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 352 byte(s) in 1 object(s) allocated from: + #0 0x7fbb19abf411 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77 + #1 0x7fbb1a0efd3b in fuse_fs_new ../lib/fuse.c:4814 + #2 0x7fbb1a0f02b5 in fuse_new_31 ../lib/fuse.c:4913 + #3 0x7fbb1a10ec5e in fuse_main_real ../lib/helper.c:345 + #4 0x5625db8ab418 in main ../example/hello.c:176 + #5 0x7fbb1983c78f (/usr/lib/libc.so.6+0x2378f) + +SUMMARY: AddressSanitizer: 352 byte(s) leaked in 1 allocation(s). +``` + +That's because `fuse_lowlevel.c`s `fuse_session_destroy` would only call +the user supplied `op.destroy`, if INIT had been processed, but the high +level API relied on `op.destroy` to free `f->fs`. + +This patch moves the freeing into `fuse_destroy` that will always be +called by our high-level API. +--- + lib/fuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/fuse.c b/lib/fuse.c +index 6b42a69c..a7feced6 100644 +--- a/lib/fuse.c ++++ b/lib/fuse.c +@@ -2623,7 +2623,6 @@ void fuse_fs_destroy(struct fuse_fs *fs) + fuse_get_context()->private_data = fs->user_data; + if (fs->op.destroy) + fs->op.destroy(fs->user_data); +- free(fs); + } + + static void fuse_lib_destroy(void *data) +@@ -2632,7 +2631,6 @@ static void fuse_lib_destroy(void *data) + + fuse_create_context(f); + fuse_fs_destroy(f->fs); +- f->fs = NULL; + } + + static void fuse_lib_lookup(fuse_req_t req, fuse_ino_t parent, +@@ -5084,6 +5082,7 @@ void fuse_destroy(struct fuse *f) + free(f->name_table.array); + pthread_mutex_destroy(&f->lock); + fuse_session_destroy(f->se); ++ free(f->fs); + free(f->conf.modules); + free(f); + fuse_delete_context_key(); diff -Nru fuse3-3.14.0/debian/patches/series fuse3-3.14.0/debian/patches/series --- fuse3-3.14.0/debian/patches/series 2023-03-17 20:51:05.000000000 +0100 +++ fuse3-3.14.0/debian/patches/series 2023-04-17 21:34:29.000000000 +0200 @@ -1,2 +1,4 @@ revert_upgrade_of_fuse_kernel.h.patch update_header_name.patch +Fix-max_threads-command-line-parameter-propagation.patch +Fix_memory_leak_in_high_level_API.patch