Created
December 22, 2015 16:12
-
-
Save dcci/efaea9678788d74769a4 to your computer and use it in GitHub Desktop.
dlopen() deadlock
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
#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