forked from opensvc/multipath-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libmultipath: prevent DSO unloading with astray checker threads
The multipathd tur checker thread is designed to be able to finish at any time, even after the tur checker itself has been freed. The multipathd shutdown code makes sure all the checkers have been freed before freeing the checker_class and calling dlclose() to unload the DSO, but this doesn't guarantee that the checker threads have finished. If one hasn't, the DSO will get unloaded while the thread still running code from it, causing a segfault. This patch fixes the issue by further incrementing the DSO's refcount for every running thread. To avoid race conditions leading to segfaults, the thread's entrypoint must be in libmultipath, not in the DSO itself. Therefore we add a new optional checker method, libcheck_thread(). Checkers defining this method may create a detached thread with entrypoint checker_thread_entry(), which will call the DSO's libcheck_thread and take care of the refcount handling. Reported-by: Benjamin Marzinski <[email protected]> Reviewed-by: Benjamin Marzinski <[email protected]>
- Loading branch information
Showing
4 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters