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
10f5e044
Commit
10f5e044
authored
Feb 15, 2019
by
swift_gan
Committed by
swift_gan
Feb 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
can skip size check
parent
0722234f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
trampoline_manager.h
hooklib/src/main/cpp/includes/trampoline_manager.h
+1
-0
sandhook.cpp
hooklib/src/main/cpp/sandhook.cpp
+6
-0
trampoline_manager.cpp
hooklib/src/main/cpp/trampoline/trampoline_manager.cpp
+5
-0
SandHook.java
hooklib/src/main/java/com/swift/sandhook/SandHook.java
+1
-0
No files found.
hooklib/src/main/cpp/includes/trampoline_manager.h
View file @
10f5e044
...
@@ -86,6 +86,7 @@ namespace SandHook {
...
@@ -86,6 +86,7 @@ namespace SandHook {
}
}
bool
inlineSecurityCheck
=
true
;
bool
inlineSecurityCheck
=
true
;
bool
skipAllCheck
=
false
;
private
:
private
:
Size
quickCompileOffset
;
Size
quickCompileOffset
;
...
...
hooklib/src/main/cpp/sandhook.cpp
View file @
10f5e044
...
@@ -273,6 +273,12 @@ Java_com_swift_sandhook_SandHook_setInlineSafeCheck(JNIEnv *env, jclass type, jb
...
@@ -273,6 +273,12 @@ Java_com_swift_sandhook_SandHook_setInlineSafeCheck(JNIEnv *env, jclass type, jb
trampolineManager
.
inlineSecurityCheck
=
check
;
trampolineManager
.
inlineSecurityCheck
=
check
;
}
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_com_swift_sandhook_SandHook_skipAllSafeCheck
(
JNIEnv
*
env
,
jclass
type
,
jboolean
skip
)
{
trampolineManager
.
skipAllCheck
=
skip
;
}
extern
"C"
extern
"C"
JNIEXPORT
void
JNICALL
JNIEXPORT
void
JNICALL
Java_com_swift_sandhook_test_TestClass_jni_1test
(
JNIEnv
*
env
,
jobject
instance
)
{
Java_com_swift_sandhook_test_TestClass_jni_1test
(
JNIEnv
*
env
,
jobject
instance
)
{
...
...
hooklib/src/main/cpp/trampoline/trampoline_manager.cpp
View file @
10f5e044
...
@@ -69,10 +69,15 @@ namespace SandHook {
...
@@ -69,10 +69,15 @@ namespace SandHook {
};
};
bool
TrampolineManager
::
canSafeInline
(
mirror
::
ArtMethod
*
method
)
{
bool
TrampolineManager
::
canSafeInline
(
mirror
::
ArtMethod
*
method
)
{
if
(
skipAllCheck
)
return
true
;
//check size
//check size
if
(
!
method
->
isNative
())
{
if
(
!
method
->
isNative
())
{
uint32_t
originCodeSize
=
sizeOfEntryCode
(
method
);
uint32_t
originCodeSize
=
sizeOfEntryCode
(
method
);
if
(
originCodeSize
<
SIZE_DIRECT_JUMP_TRAMPOLINE
)
{
if
(
originCodeSize
<
SIZE_DIRECT_JUMP_TRAMPOLINE
)
{
LOGW
(
"can not inline due to origin code is too small(size is %d)"
,
originCodeSize
);
return
false
;
return
false
;
}
}
}
}
...
...
hooklib/src/main/java/com/swift/sandhook/SandHook.java
View file @
10f5e044
...
@@ -242,6 +242,7 @@ public class SandHook {
...
@@ -242,6 +242,7 @@ public class SandHook {
//default on!
//default on!
public
static
native
void
setInlineSafeCheck
(
boolean
check
);
public
static
native
void
setInlineSafeCheck
(
boolean
check
);
public
static
native
void
skipAllSafeCheck
(
boolean
skip
);
private
static
native
int
hookMethod
(
Member
originMethod
,
Method
hookMethod
,
Method
backupMethod
,
int
hookMode
);
private
static
native
int
hookMethod
(
Member
originMethod
,
Method
hookMethod
,
Method
backupMethod
,
int
hookMode
);
...
...
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