mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(preload): apps that reload libudev no longer crash in the input wrappers (#3180)
fix(preload): keep libudev loaded while the input wrappers use it Programs that close libudev and open it again crashed in the next wrapped udev call: the wrappers kept function pointers into the unmapped copy. Pin libudev with RTLD_NODELETE when it is opened so those pointers and the stored handle stay valid.
This commit is contained in:
1 parent
906e66e3cf
commit
238ef76c5c
3 files changed
+45
-5
No files matched your search
@@ -419,9 +419,11 @@ static void *real_dlsym(void);
|
||||
* searches, so the handle the program opened is the only way back to the real implementation. */
|
||||
static _Atomic(void *) udev_handle;
|
||||
|
||||
__attribute__((visibility("hidden"))) void bl_inputudev_note_dlopen(const char *path, void *handle) {
|
||||
if (handle != NULL && path != NULL && strstr(path, "libudev") != NULL)
|
||||
atomic_store_explicit(&udev_handle, handle, memory_order_release);
|
||||
__attribute__((visibility("hidden"))) void bl_inputudev_note_dlopen(const char *path, void *handle,
|
||||
void *(*open)(const char *, int)) {
|
||||
if (handle == NULL || path == NULL || strstr(path, "libudev") == NULL) return;
|
||||
if (open(path, RTLD_LAZY | RTLD_NOLOAD | RTLD_NODELETE) == NULL) return;
|
||||
atomic_store_explicit(&udev_handle, handle, memory_order_release);
|
||||
}
|
||||
|
||||
static void *next_symbol(const char *name) {
|
||||
|
||||
Reference in new issue
Block a user