All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't access dlclose'd dynamic ioengine object after close
@ 2021-05-07 21:13 Eric Sandeen
  2021-05-08 16:18 ` Alexey Dobriyan
  2021-05-09  4:13 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2021-05-07 21:13 UTC (permalink / raw)
  To: fio; +Cc: Jens Axboe, Alexey Dobriyan

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 <adobriyan@gmail.com>
Fixes: f6931a1 ("fio: move dynamic library handle to io_ops structure")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Please, somebody who is better than I am at this review it to see
if I'm just causing more problems.  ;)

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;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-09  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 21:13 [PATCH] don't access dlclose'd dynamic ioengine object after close Eric Sandeen
2021-05-08 16:18 ` Alexey Dobriyan
2021-05-09  4:13 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.