Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
9ab57b60
Commit
9ab57b60
authored
Feb 28, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DeOpt]pre add
parent
c17f756a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
4 deletions
+79
-4
art_instrumentation.cpp
hooklib/src/main/cpp/art/art_instrumentation.cpp
+12
-0
art_runtime.cpp
hooklib/src/main/cpp/art/art_runtime.cpp
+11
-0
art_instrumentation.h
hooklib/src/main/cpp/includes/art_instrumentation.h
+19
-0
art_runtime.h
hooklib/src/main/cpp/includes/art_runtime.h
+2
-2
cast_runtime.h
hooklib/src/main/cpp/includes/cast_runtime.h
+21
-0
hide_api.h
hooklib/src/main/cpp/includes/hide_api.h
+3
-0
hide_api.cpp
hooklib/src/main/cpp/utils/hide_api.cpp
+11
-2
No files found.
hooklib/src/main/cpp/art/art_instrumentation.cpp
0 → 100644
View file @
9ab57b60
//
// Created by SwiftGan on 2019/2/28.
//
#include "../includes/art_instrumentation.h"
using
namespace
art
;
using
namespace
instrumentation
;
bool
Instrumentation
::
deOptimizeMethod
(
mirror
::
ArtMethod
*
method
)
{
}
\ No newline at end of file
hooklib/src/main/cpp/art/art_runtime.cpp
0 → 100644
View file @
9ab57b60
//
// Created by SwiftGan on 2019/2/28.
//
#include "../includes/art_runtime.h"
using
namespace
art
;
instrumentation
::
Instrumentation
*
Runtime
::
getInstrumentation
()
{
}
hooklib/src/main/cpp/includes/art_instrumentation.h
0 → 100644
View file @
9ab57b60
//
// Created by SwiftGan on 2019/2/28.
//
#ifndef SANDHOOK_ART_INSTRUMENTATION_H
#define SANDHOOK_ART_INSTRUMENTATION_H
#include "art_method.h"
namespace
art
{
namespace
instrumentation
{
class
Instrumentation
{
public
:
bool
deOptimizeMethod
(
mirror
::
ArtMethod
*
method
);
};
}
}
#endif //SANDHOOK_ART_INSTRUMENTATION_H
hooklib/src/main/cpp/includes/art_runtime.h
View file @
9ab57b60
...
...
@@ -6,12 +6,12 @@
#define SANDHOOK_ART_RUNTIME_H
#include "art_jit.h"
#include "art_instrumentation.h"
namespace
art
{
class
Runtime
{
public
:
jit
::
Jit
*
getJit
();
instrumentation
::
Instrumentation
*
getInstrumentation
();
};
}
...
...
hooklib/src/main/cpp/includes/cast_runtime.h
0 → 100644
View file @
9ab57b60
//
// Created by SwiftGan on 2019/2/28.
//
#ifndef SANDHOOK_CAST_RUNTIME_H
#define SANDHOOK_CAST_RUNTIME_H
#include "art_runtime.h"
#include "art_instrumentation.h"
#include "cast.h"
namespace
SandHook
{
class
CastRuntime
{
static
void
init
(
JNIEnv
*
jniEnv
);
static
IMember
<
art
::
Runtime
,
art
::
instrumentation
::
Instrumentation
*>*
instrumentation
;
};
}
#endif //SANDHOOK_CAST_RUNTIME_H
hooklib/src/main/cpp/includes/hide_api.h
View file @
9ab57b60
...
...
@@ -11,6 +11,7 @@
#include <memory>
#include "../includes/art_compiler_options.h"
#include "../includes/art_jit.h"
#include "../includes/art_runtime.h"
extern
"C"
{
...
...
@@ -31,6 +32,8 @@ extern "C" {
bool
disableJitInline
(
art
::
CompilerOptions
*
compilerOptions
);
art
::
Runtime
*
getRuntime
();
}
#endif //SANDHOOK_HIDE_API_H
hooklib/src/main/cpp/utils/hide_api.cpp
View file @
9ab57b60
...
...
@@ -19,6 +19,7 @@ extern "C" {
jobject
(
*
addWeakGlobalRef
)(
JavaVM
*
,
void
*
,
void
*
)
=
nullptr
;
art
::
jit
::
JitCompiler
**
globalJitCompileHandlerAddr
=
nullptr
;
art
::
Runtime
**
globalRuntimeAddr
=
nullptr
;
...
...
@@ -76,14 +77,16 @@ extern "C" {
}
else
{
handle
=
fake_dlopen
(
"/system/lib/libart.so"
,
RTLD_NOW
);
}
const
char
*
addWeak
Gloabl
ReferenceSymbol
=
SDK_INT
<=
25
const
char
*
addWeakReferenceSymbol
=
SDK_INT
<=
25
?
"_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE"
:
"_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadENS_6ObjPtrINS_6mirror6ObjectEEE"
;
addWeakGlobalRef
=
(
jobject
(
*
)(
JavaVM
*
,
void
*
,
void
*
))
fake_dlsym
(
handle
,
addWeak
Gloabl
ReferenceSymbol
);
addWeakReferenceSymbol
);
//try disable inline !
globalJitCompileHandlerAddr
=
reinterpret_cast
<
art
::
jit
::
JitCompiler
**>
(
fake_dlsym
(
handle
,
"_ZN3art3jit3Jit20jit_compiler_handle_E"
));
globalRuntimeAddr
=
reinterpret_cast
<
art
::
Runtime
**>
(
fake_dlsym
(
handle
,
"_ZN3art7Runtime9instance_E"
));
}
}
...
...
@@ -161,5 +164,11 @@ extern "C" {
}
}
art
::
Runtime
*
getRuntime
()
{
if
(
globalRuntimeAddr
==
nullptr
||
globalRuntimeAddr
<=
0
)
return
nullptr
;
return
*
globalRuntimeAddr
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment