fix loading of modules
(cherry picked from commit 05750945e6dce554ff520b6c5be42f83a6fe6fa4)
This commit is contained in:
parent
c8b8dffad1
commit
57193db7ad
52
0009-Fix-loading-of-FUSE-modules.patch
Normal file
52
0009-Fix-loading-of-FUSE-modules.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From d1097c2bdb45e9f40fbc8c5887e61df4897274ff Mon Sep 17 00:00:00 2001
|
||||
From: Goswin von Brederlow <goswin-v-b@web.de>
|
||||
Date: Fri, 13 Jan 2023 10:36:52 +0100
|
||||
Subject: [PATCH] Fix loading of FUSE modules
|
||||
|
||||
dlsym returns the address of the module factory symbol, not the actual function (#722)
|
||||
pointer. Change the type of `factory` to `fuse_module_factory_t*` to reflect
|
||||
this and then dereference it when registering the module.
|
||||
|
||||
This is a followup to d92bf83, which introduced a NULL pointer dereference
|
||||
when dlsym returns NULL, and 8ec7fd9, which reverted it back to not
|
||||
dereferencing the symbol at all.
|
||||
|
||||
Fixes: #721
|
||||
|
||||
Co-authored-by: Goswin von Brederlow <brederlo@q-leap.de>
|
||||
---
|
||||
lib/fuse.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/fuse.c b/lib/fuse.c
|
||||
index 5099601..31d5c58 100644
|
||||
--- a/lib/fuse.c
|
||||
+++ b/lib/fuse.c
|
||||
@@ -252,7 +252,7 @@ static int fuse_load_so_module(const char *module)
|
||||
int ret = -1;
|
||||
char *tmp;
|
||||
struct fusemod_so *so;
|
||||
- fuse_module_factory_t factory;
|
||||
+ fuse_module_factory_t *factory;
|
||||
|
||||
tmp = malloc(strlen(module) + 64);
|
||||
if (!tmp) {
|
||||
@@ -274,13 +274,13 @@ static int fuse_load_so_module(const char *module)
|
||||
}
|
||||
|
||||
sprintf(tmp, "fuse_module_%s_factory", module);
|
||||
- *(void**)(&factory) = dlsym(so->handle, tmp);
|
||||
+ factory = (fuse_module_factory_t*)dlsym(so->handle, tmp);
|
||||
if (factory == NULL) {
|
||||
fuse_log(FUSE_LOG_ERR, "fuse: symbol <%s> not found in module: %s\n",
|
||||
tmp, dlerror());
|
||||
goto out_dlclose;
|
||||
}
|
||||
- ret = fuse_register_module(module, factory, so);
|
||||
+ ret = fuse_register_module(module, *factory, so);
|
||||
if (ret)
|
||||
goto out_dlclose;
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: fuse3
|
||||
Version: %{fuse3ver}
|
||||
Release: 8
|
||||
Release: 9
|
||||
Summary: User space File System of fuse3
|
||||
License: GPL+ and LGPLv2+
|
||||
URL: http://fuse.sf.net
|
||||
@ -17,6 +17,7 @@ Patch5: 0005-Fix-use-after-free-warning.patch
|
||||
Patch6: 0006-Disable-leak-suppression-773.patch
|
||||
Patch7: 0007-Fix-memory-leak-in-high-level-API-781.patch
|
||||
Patch8: 0008-Fix-file-leak-in-high-level-API.patch
|
||||
Patch9: 0009-Fix-loading-of-FUSE-modules.patch
|
||||
|
||||
BuildRequires: libselinux-devel, pkgconfig, systemd-udev, meson, fdupes
|
||||
BuildRequires: autoconf, automake, libtool, gettext-devel, ninja-build
|
||||
@ -107,6 +108,9 @@ install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Mon Apr 1 2024 yangyun <yangyun50@huawei.com> -3.10.5-9
|
||||
- fix loading of modules
|
||||
|
||||
* Sat Mar 30 2024 yangyun <yangyun50@huawei.com> -3.10.5-8
|
||||
- fix file leak in high level API
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user