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
8c679f1b
Commit
8c679f1b
authored
Nov 16, 2019
by
virjar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stopTheWorld after jit compile to avoid jit compile dead lock
parent
e6bf7f4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
sandhook.cpp
hooklib/src/main/cpp/sandhook.cpp
+2
-3
hide_api.cpp
hooklib/src/main/cpp/utils/hide_api.cpp
+8
-2
No files found.
hooklib/src/main/cpp/sandhook.cpp
View file @
8c679f1b
...
...
@@ -180,9 +180,6 @@ Java_com_swift_sandhook_SandHook_hookMethod(JNIEnv *env, jclass type, jobject or
int
mode
=
reinterpret_cast
<
int
>
(
hookMode
);
//suspend other threads
SandHook
::
StopTheWorld
stopTheWorld
;
if
(
mode
==
INLINE
)
{
if
(
!
origin
->
isCompiled
())
{
if
(
SDK_INT
>=
ANDROID_N
)
{
...
...
@@ -219,6 +216,8 @@ Java_com_swift_sandhook_SandHook_hookMethod(JNIEnv *env, jclass type, jobject or
label_hook
:
//suspend other threads
SandHook
::
StopTheWorld
stopTheWorld
;
if
(
isInlineHook
&&
trampolineManager
.
canSafeInline
(
origin
))
{
return
doHookWithInline
(
env
,
origin
,
hook
,
backup
)
?
INLINE
:
-
1
;
}
else
{
...
...
hooklib/src/main/cpp/utils/hide_api.cpp
View file @
8c679f1b
...
...
@@ -157,17 +157,23 @@ extern "C" {
if
(
jitCompilerHandle
==
nullptr
)
return
false
;
if
(
!
canCompile
())
return
false
;
//backup thread flag and state because of jit compile function will modify thread state
uint32_t
old_flag_and_state
=
*
((
uint32_t
*
)
thread
);
bool
ret
;
if
(
SDK_INT
>=
ANDROID_Q
)
{
if
(
jitCompileMethodQ
==
nullptr
)
{
return
false
;
}
ret
urn
jitCompileMethodQ
(
jitCompilerHandle
,
artMethod
,
thread
,
false
,
false
);
ret
=
jitCompileMethodQ
(
jitCompilerHandle
,
artMethod
,
thread
,
false
,
false
);
}
else
{
if
(
jitCompileMethod
==
nullptr
)
{
return
false
;
}
ret
urn
jitCompileMethod
(
jitCompilerHandle
,
artMethod
,
thread
,
false
);
ret
=
jitCompileMethod
(
jitCompilerHandle
,
artMethod
,
thread
,
false
);
}
memcpy
(
thread
,
&
old_flag_and_state
,
4
);
return
ret
;
}
void
suspendVM
()
{
...
...
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