diff --git a/0007-Fix-use-after-free-warning.patch b/0007-Fix-use-after-free-warning.patch new file mode 100644 index 0000000000000000000000000000000000000000..fafba42a415ad8933c8ee1397f211dd7918e57a7 --- /dev/null +++ b/0007-Fix-use-after-free-warning.patch @@ -0,0 +1,51 @@ +From f2144c6c3a0d4eda5f8384b56cdeb5193a3c06ef Mon Sep 17 00:00:00 2001 +From: Matthias Goergens +Date: Tue, 28 Mar 2023 13:35:56 +0800 +Subject: [PATCH] Fix use-after-free warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building, I get the following warning: + +```bash +$ ninja +[18/71] Compiling C object lib/libfuse3.so.3.14.1.p/modules_iconv.c.o +../lib/modules/iconv.c: In function ‘iconv_convpath’: +../lib/modules/iconv.c:85:38: warning: pointer ‘newpath’ may be used after ‘realloc’ [-Wuse-after-free] + 85 | p = tmp + (p - newpath); + | ~~~^~~~~~~~~~ +../lib/modules/iconv.c:80:31: note: call to ‘realloc’ here + 80 | tmp = realloc(newpath, newpathlen + 1); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[71/71] Linking target example/passthrough_hp +``` + +It's a false positive, I thinks. But it's also easy to silence this +warning with a small refactor. +--- + lib/modules/iconv.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/modules/iconv.c b/lib/modules/iconv.c +index 3d18a36..a0bf72b 100644 +--- a/lib/modules/iconv.c ++++ b/lib/modules/iconv.c +@@ -77,12 +77,13 @@ static int iconv_convpath(struct iconv *ic, const char *path, char **newpathp, + + inc = (pathlen + 1) * 4; + newpathlen += inc; ++ int dp = p - newpath; + tmp = realloc(newpath, newpathlen + 1); + err = -ENOMEM; + if (!tmp) + goto err; + +- p = tmp + (p - newpath); ++ p = tmp + dp; + plen += inc; + newpath = tmp; + } +-- +2.41.0 + diff --git a/0008-Disable-leak-suppression-773.patch b/0008-Disable-leak-suppression-773.patch new file mode 100644 index 0000000000000000000000000000000000000000..d7c9ada258064b06097a22306d96b236a416829a --- /dev/null +++ b/0008-Disable-leak-suppression-773.patch @@ -0,0 +1,30 @@ +From 34d9d2abf1da37961d4f0a2ad55dcf11ed46a33e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Matthias=20G=C3=B6rgens?= +Date: Wed, 12 Apr 2023 15:40:18 +0800 +Subject: [PATCH] Disable leak suppression (#773) + +Conflict: they -> the + +--- + test/lsan_suppress.txt | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/test/lsan_suppress.txt b/test/lsan_suppress.txt +index e054e7c..44703fc 100644 +--- a/test/lsan_suppress.txt ++++ b/test/lsan_suppress.txt +@@ -1,11 +1 @@ + # Suppression file for address sanitizer. +- +-# There are some leaks in command line option parsing. They should be +-# fixed at some point, but are harmless since the consume just a small, +-# constant amount of memory and do not grow. +-leak:fuse_opt_parse +- +- +-# Leaks in fusermount3 are harmless as well (it's a short-lived +-# process) - but patches are welcome! +-leak:fusermount.c +-- +2.41.0 + diff --git a/fuse3.spec b/fuse3.spec index aca013ace65a438f216f39398af68f13e20ec3bf..07a7f8d205b63fdb7397a2f0242e484f3f83bf1b 100644 --- a/fuse3.spec +++ b/fuse3.spec @@ -2,7 +2,7 @@ Name: fuse3 Version: %{fuse3ver} -Release: 10 +Release: 11 Summary: User space File System of fuse3 License: GPL+ and LGPLv2+ URL: http://fuse.sf.net @@ -15,6 +15,8 @@ Patch3: 0003-fuse_lowlevel-Move-assert-for-se-before-dereferencin.patch Patch4: 0004-revert-fuse_daemonize-chdir-to-even-if-not-run.patch Patch5: 0005-Correct-errno-comparison-571.patch Patch6: 0006-Fix-fd-leak-with-clone_fd.patch +Patch7: 0007-Fix-use-after-free-warning.patch +Patch8: 0008-Disable-leak-suppression-773.patch BuildRequires: libselinux-devel, pkgconfig, systemd-udev, meson, fdupes BuildRequires: autoconf, automake, libtool, gettext-devel, ninja-build @@ -105,6 +107,9 @@ install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir} %{_mandir}/man8/* %changelog +* Wed Jul 12 2023 Zhiqiang Liu -3.9.2-11 +- backport two upstream patches + * Wed Dec 7 2022 Zhiqiang Liu -3.9.2-10 - fix fd leak with clone_fd