summaryrefslogtreecommitdiff
path: root/dispatch
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-05-23 23:24:13 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-05-23 23:24:13 +0100
commit0e72547039e7633712fada41ef744c60aa7e7ebb (patch)
tree39adb618e19f0e52d98682f9ae920182cd212203 /dispatch
parent6e99925a6e05f83cf989d11ea4d3465de94dbba7 (diff)
glxtrace: Use dlsym protection only on wrappers.
Similar in spirit to the Lawrence Love's pull request #203, but instead of building multiple variants of glproc_gl.cpp simply move the dlsym protection code into wrappers dir.
Diffstat (limited to 'dispatch')
-rw-r--r--dispatch/glproc_gl.cpp54
1 files changed, 1 insertions, 53 deletions
diff --git a/dispatch/glproc_gl.cpp b/dispatch/glproc_gl.cpp
index 0ced2f95..fdbea05c 100644
--- a/dispatch/glproc_gl.cpp
+++ b/dispatch/glproc_gl.cpp
@@ -160,58 +160,6 @@ logSymbol(const char *name, void *ptr) {
}
-#ifdef __GLIBC__
-extern "C" void * __libc_dlsym(void *, const char *);
-#endif
-
-
-/*
- * Protect against dlsym interception.
- *
- * We implement the whole API, so we don't need to intercept dlsym -- dlopen is
- * enough. However we need to protect against other dynamic libraries
- * intercepting dlsym, to prevent infinite recursion,
- *
- * In particular the Steam Community Overlay advertises dlsym. See also
- * http://lists.freedesktop.org/archives/apitrace/2013-March/000573.html
- */
-static inline void *
-_dlsym(void *handle, const char *symbol)
-{
- void *result;
-
-#ifdef __GLIBC__
- /*
- * We rely on glibc's internal __libc_dlsym. See also
- * http://www.linuxforu.com/2011/08/lets-hook-a-library-function/
- *
- * Use use it to obtain the true dlsym. We don't use __libc_dlsym directly
- * because it does not support things such as RTLD_NEXT.
- */
- typedef void * (*PFN_DLSYM)(void *, const char *);
- static PFN_DLSYM dlsym_ptr = NULL;
- if (!dlsym_ptr) {
- void *libdl_handle = _dlopen("libdl.so.2", RTLD_LOCAL | RTLD_NOW);
- if (libdl_handle) {
- dlsym_ptr = (PFN_DLSYM)__libc_dlsym(libdl_handle, "dlsym");
- }
- if (!dlsym_ptr) {
- os::log("apitrace: error: failed to look up real dlsym\n");
- return NULL;
- }
-
- logSymbol("dlsym", (void*)dlsym_ptr);
- }
-
- result = dlsym_ptr(handle, symbol);
-#else
- result = dlsym(handle, symbol);
-#endif
-
- return result;
-}
-
-
/*
* Lookup a libGL symbol
*/
@@ -255,7 +203,7 @@ void * _libgl_sym(const char *symbol)
}
}
- result = _dlsym(_libGlHandle, symbol);
+ result = dlsym(_libGlHandle, symbol);
logSymbol(symbol, result);