From b11b07b18d13e6db4ecd2cf63577b802e97dd928 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: May 18 2021 14:28:25 +0000 Subject: Another fix for dynamic engines (#1956963) --- diff --git a/0001-don-t-access-dlclose-d-dynamic-ioengine-object-after.patch b/0001-don-t-access-dlclose-d-dynamic-ioengine-object-after.patch new file mode 100644 index 0000000..a6fa98a --- /dev/null +++ b/0001-don-t-access-dlclose-d-dynamic-ioengine-object-after.patch @@ -0,0 +1,42 @@ +From 79f488cbd95ca6989031a7ace5ec382313d31b3c Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Fri, 7 May 2021 16:13:05 -0500 +Subject: [PATCH] don't access dlclose'd dynamic ioengine object after close + +Alexey reported this bug when using dynamically loaded IO engines; +a segfault on the line where we set the dlhandle to NULL after +the dlclose. + +I think this is because ops points to the thing we obtained from dlsym: + + ops = dlsym(dlhandle, engine_lib); + +and after the final dlclose, the object no longer exists and efforts +to set the handle within it will fail for obvious reasons. +I'm not sure why I hadn't seen this before. + +Fixes-RH-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1956963 +Reported-by: Alexey Dobriyan +Fixes: f6931a1 ("fio: move dynamic library handle to io_ops structure") +Tested-by: Alexey Dobriyan +Signed-off-by: Eric Sandeen +Signed-off-by: Jens Axboe +--- + ioengines.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ioengines.c b/ioengines.c +index 3561bb4e..dd61af07 100644 +--- a/ioengines.c ++++ b/ioengines.c +@@ -234,7 +234,6 @@ void free_ioengine(struct thread_data *td) + if (td->io_ops->dlhandle) { + dprint(FD_IO, "dlclose ioengine %s\n", td->io_ops->name); + dlclose(td->io_ops->dlhandle); +- td->io_ops->dlhandle = NULL; + } + + td->io_ops = NULL; +-- +2.26.2 + diff --git a/fio.spec b/fio.spec index d50d054..fccc84b 100644 --- a/fio.spec +++ b/fio.spec @@ -1,11 +1,12 @@ Name: fio Version: 3.26 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Multithreaded IO generation tool License: GPLv2 URL: http://git.kernel.dk/?p=fio.git;a=summary Source: http://brick.kernel.dk/snaps/%{name}-%{version}.tar.bz2 +Patch0: 0001-don-t-access-dlclose-d-dynamic-ioengine-object-after.patch BuildRequires: gcc BuildRequires: libaio-devel @@ -207,6 +208,9 @@ make install prefix=%{_prefix} mandir=%{_mandir} libdir=%{_libdir}/fio DESTDIR=$ %endif %changelog +* Tue May 18 2021 Eric Sandeen 3.26-2 +- Another fix for dynamic engines (#1956963) + * Fri Mar 12 2021 Eric Sandeen 3.26-1 - New upstream version