Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/include/libvgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ extern void load_cuda_libraries();

#define FUNC_OVERRIDE_NAME(fname) overrided_##fname

extern void* _dl_sym(void*, const char*, void*);

#if defined(DLSYM_HOOK_DEBUG)
#define DLSYM_HOOK_FUNC(f) \
if (0 == strcmp(symbol, #f)) { \
Expand Down
14 changes: 10 additions & 4 deletions src/libvgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ FUNC_ATTR_VISIBLE void* dlsym(void* handle, const char* symbol) {
}
if (real_dlsym == NULL) {
LOG_ERROR("real dlsym not found");
real_dlsym = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
void *libc_handle = dlopen("libc.so.6", RTLD_LAZY);
if (libc_handle) {
real_dlsym = dlsym(libc_handle, "dlsym");
}
if (real_dlsym == NULL)
LOG_ERROR("real dlsym not found");
LOG_ERROR("real dlsym not found after trying libc.so.6");
}
}
if (handle == RTLD_NEXT) {
Expand Down Expand Up @@ -858,9 +861,12 @@ void preInit(){
real_dlsym = dlvsym(RTLD_NEXT,"dlsym","GLIBC_2.2.5");
if (real_dlsym == NULL) {
LOG_ERROR("real dlsym not found");
real_dlsym = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
if (real_dlsym == NULL)
void *libc_handle = dlopen("libc.so.6", RTLD_LAZY);
if (libc_handle) {
real_dlsym = dlsym(libc_handle, "dlsym");
} else {
LOG_ERROR("real dlsym not found");
}
}
}
real_realpath = NULL;
Expand Down
7 changes: 4 additions & 3 deletions src/nvml/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,17 @@ nvmlReturn_t nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int *index) {
}


extern void* _dl_sym(void*, const char*, void*);

void load_nvml_libraries() {
void *table = NULL;
char driver_filename[FILENAME_MAX];

if (real_dlsym == NULL) {
real_dlsym = dlvsym(RTLD_NEXT,"dlsym","GLIBC_2.2.5");
if (real_dlsym == NULL) {
real_dlsym = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
void *libc_handle = dlopen("libc.so.6", RTLD_LAZY);
if (libc_handle) {
real_dlsym = dlsym(libc_handle, "dlsym");
}
if (real_dlsym == NULL)
LOG_ERROR("real dlsym not found");
}
Expand Down
Loading