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
c17f756a
Commit
c17f756a
authored
Feb 27, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak disable jit
parent
f009483a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
10 deletions
+30
-10
hide_api.h
hooklib/src/main/cpp/includes/hide_api.h
+4
-0
sandhook.cpp
hooklib/src/main/cpp/sandhook.cpp
+1
-8
hide_api.cpp
hooklib/src/main/cpp/utils/hide_api.cpp
+25
-2
No files found.
hooklib/src/main/cpp/includes/hide_api.h
View file @
c17f756a
...
@@ -25,8 +25,12 @@ extern "C" {
...
@@ -25,8 +25,12 @@ extern "C" {
art
::
jit
::
JitCompiler
*
getGlobalJitCompiler
();
art
::
jit
::
JitCompiler
*
getGlobalJitCompiler
();
art
::
CompilerOptions
*
getCompilerOptions
(
art
::
jit
::
JitCompiler
*
compiler
);
art
::
CompilerOptions
*
getGlobalCompilerOptions
();
art
::
CompilerOptions
*
getGlobalCompilerOptions
();
bool
disableJitInline
(
art
::
CompilerOptions
*
compilerOptions
);
}
}
#endif //SANDHOOK_HIDE_API_H
#endif //SANDHOOK_HIDE_API_H
hooklib/src/main/cpp/sandhook.cpp
View file @
c17f756a
...
@@ -354,14 +354,7 @@ Java_com_swift_sandhook_SandHook_disableVMInline(JNIEnv *env, jclass type) {
...
@@ -354,14 +354,7 @@ Java_com_swift_sandhook_SandHook_disableVMInline(JNIEnv *env, jclass type) {
art
::
CompilerOptions
*
compilerOptions
=
getGlobalCompilerOptions
();
art
::
CompilerOptions
*
compilerOptions
=
getGlobalCompilerOptions
();
if
(
compilerOptions
==
nullptr
)
if
(
compilerOptions
==
nullptr
)
return
JNI_FALSE
;
return
JNI_FALSE
;
size_t
originOptions
=
compilerOptions
->
getInlineMaxCodeUnits
();
return
static_cast
<
jboolean
>
(
disableJitInline
(
compilerOptions
));
//maybe a real inlineMaxCodeUnits
if
(
originOptions
>
0
&&
originOptions
<
10000
)
{
compilerOptions
->
setInlineMaxCodeUnits
(
0
);
return
JNI_TRUE
;
}
else
{
return
JNI_FALSE
;
}
}
}
extern
"C"
extern
"C"
...
...
hooklib/src/main/cpp/utils/hide_api.cpp
View file @
c17f756a
...
@@ -35,6 +35,13 @@ extern "C" {
...
@@ -35,6 +35,13 @@ extern "C" {
jitLoad
=
reinterpret_cast
<
void
*
(
*
)(
bool
*
)
>
(
fake_dlsym
(
jit_lib
,
"jit_load"
));
jitLoad
=
reinterpret_cast
<
void
*
(
*
)(
bool
*
)
>
(
fake_dlsym
(
jit_lib
,
"jit_load"
));
bool
generate_debug_info
=
false
;
bool
generate_debug_info
=
false
;
jitCompilerHandle
=
(
jitLoad
)(
&
generate_debug_info
);
jitCompilerHandle
=
(
jitLoad
)(
&
generate_debug_info
);
if
(
jitCompilerHandle
!=
nullptr
&&
jitCompilerHandle
>
0
)
{
art
::
CompilerOptions
*
compilerOptions
=
getCompilerOptions
(
reinterpret_cast
<
art
::
jit
::
JitCompiler
*>
(
jitCompilerHandle
));
disableJitInline
(
compilerOptions
);
}
}
}
//init suspend
//init suspend
void
*
art_lib
;
void
*
art_lib
;
...
@@ -131,12 +138,28 @@ extern "C" {
...
@@ -131,12 +138,28 @@ extern "C" {
return
*
globalJitCompileHandlerAddr
;
return
*
globalJitCompileHandlerAddr
;
}
}
art
::
CompilerOptions
*
getGlobalCompilerOptions
()
{
art
::
CompilerOptions
*
getCompilerOptions
(
art
::
jit
::
JitCompiler
*
compiler
)
{
art
::
jit
::
JitCompiler
*
compiler
=
getGlobalJitCompiler
();
if
(
compiler
==
nullptr
)
if
(
compiler
==
nullptr
)
return
nullptr
;
return
nullptr
;
return
compiler
->
compilerOptions
.
get
();
return
compiler
->
compilerOptions
.
get
();
}
}
art
::
CompilerOptions
*
getGlobalCompilerOptions
()
{
return
getCompilerOptions
(
getGlobalJitCompiler
());
}
bool
disableJitInline
(
art
::
CompilerOptions
*
compilerOptions
)
{
if
(
compilerOptions
==
nullptr
||
compilerOptions
<=
0
)
return
false
;
size_t
originOptions
=
compilerOptions
->
getInlineMaxCodeUnits
();
//maybe a real inlineMaxCodeUnits
if
(
originOptions
>
0
&&
originOptions
<=
1024
)
{
compilerOptions
->
setInlineMaxCodeUnits
(
0
);
return
true
;
}
else
{
return
false
;
}
}
}
}
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