Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dlopen() deadlock
#include <assert.h>
#include <link.h>
#include <dlfcn.h>
#include <stdio.h>
#include <pthread.h>
static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
void *handle;
handle = dlopen("/usr/lib/libpthread.so", RTLD_LAZY | RTLD_NOLOAD);
//dlsym(handle, ".swift2_protocol_conformances_start");
dlclose(handle);
return (0);
}
void
call_me_maybe(void *args) {
dl_iterate_phdr(callback, 0);
}
int
main(int argc, char *argv[])
{
pthread_t thread1;
pthread_create(&thread1, NULL, (void *) &call_me_maybe, NULL);
pthread_join(thread1, NULL);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.