-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New method for running AddressSanitizer
Old method broke after some CS2 update, because Valve started passing RTLD_DEEPBIND to dlopen themselves. So we have to override all dlopen calls to remove the flag. Credit to Poggu for coming up with dlhook
- Loading branch information
Showing
4 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gcc -fPIC -rdynamic -shared dlhook.c -o libasan.so.dlhook.so |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#define _GNU_SOURCE | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
|
||
void *dlopen(const char *filename, int flags) | ||
{ | ||
printf("CALLED DLOPEN!!\n"); | ||
typedef void *(*dlopen_t)(const char *filename, int flags); | ||
static dlopen_t func; | ||
|
||
if(!func) | ||
func = (dlopen_t)dlsym(RTLD_NEXT, "dlopen"); | ||
|
||
return(func(filename, flags & ~RTLD_DEEPBIND)); | ||
} |