MCPcopy Create free account
hub / github.com/R-Fuzz/symsan / GetFuncAddr

Function GetFuncAddr

runtime/interception/interception_linux.cpp:36–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#endif
35
36static void *GetFuncAddr(const char *name, uptr wrapper_addr) {
37#if SANITIZER_NETBSD
38 // FIXME: Find a better way to handle renames
39 if (StrCmp(name, "sigaction"))
40 name = "__sigaction14";
41#endif
42 void *addr = dlsym(RTLD_NEXT, name);
43 if (!addr) {
44 // If the lookup using RTLD_NEXT failed, the sanitizer runtime library is
45 // later in the library search order than the DSO that we are trying to
46 // intercept, which means that we cannot intercept this function. We still
47 // want the address of the real definition, though, so look it up using
48 // RTLD_DEFAULT.
49 addr = dlsym(RTLD_DEFAULT, name);
50
51 // In case `name' is not loaded, dlsym ends up finding the actual wrapper.
52 // We don't want to intercept the wrapper and have it point to itself.
53 if ((uptr)addr == wrapper_addr)
54 addr = nullptr;
55 }
56 return addr;
57}
58
59bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func,
60 uptr wrapper) {

Callers 1

InterceptFunctionFunction · 0.85

Calls 1

StrCmpFunction · 0.85

Tested by

no test coverage detected