forked from LSPosed/LSPosed
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook dex2oat functions to remove LSPosed traces
We use the env LD_PRELOAD to hook the execution of `dex2oat`, which can be directly set to be a file descriptor.
- Loading branch information
1 parent
fd25732
commit 40f7e37
Showing
7 changed files
with
84 additions
and
13 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
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
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
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,39 @@ | ||
#include <dlfcn.h> | ||
#include <stdlib.h> | ||
|
||
#include "logging.h" | ||
|
||
typedef void* (*OatHeader_Method)(void*); | ||
static OatHeader_Method real_OatHeader_GetKeyValueStore; | ||
static OatHeader_Method real_OatHeader_GetKeyValueStoreSize; | ||
|
||
__attribute__((visibility("default"))) void* _ZNK3art9OatHeader16GetKeyValueStoreEv(void* header) { | ||
LOGD("OatHeader::GetKeyValueStore() called on object at %p\n", header); | ||
return real_OatHeader_GetKeyValueStore(header); | ||
} | ||
|
||
__attribute__((visibility("default"))) void* _ZNK3art9OatHeader20GetKeyValueStoreSizeEv( | ||
void* header) { | ||
LOGD("OatHeader::GetKeyValueStoreSize() called on object at %p\n", header); | ||
return real_OatHeader_GetKeyValueStoreSize(header); | ||
} | ||
|
||
__attribute__((constructor)) static void hello_world() { | ||
if (!real_OatHeader_GetKeyValueStore) { | ||
real_OatHeader_GetKeyValueStore = | ||
(OatHeader_Method)dlsym(RTLD_NEXT, "_ZNK3art9OatHeader16GetKeyValueStoreEv"); | ||
if (!real_OatHeader_GetKeyValueStore) { | ||
LOGE("Error resolving symbol: _ZNK3art9OatHeader16GetKeyValueStoreEv"); | ||
exit(1); | ||
} | ||
} | ||
|
||
if (!real_OatHeader_GetKeyValueStoreSize) { | ||
real_OatHeader_GetKeyValueStoreSize = | ||
(OatHeader_Method)dlsym(RTLD_NEXT, "_ZNK3art9OatHeader20GetKeyValueStoreSizeEv"); | ||
if (!real_OatHeader_GetKeyValueStoreSize) { | ||
LOGE("Error resolving symbol: _ZNK3art9OatHeader20GetKeyValueStoreSizeEv"); | ||
exit(1); | ||
} | ||
} | ||
} |
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
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
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