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
f65fd71c
Commit
f65fd71c
authored
Feb 21, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into method_stubs
parents
cc279210
60d2f219
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
art_method.cpp
hooklib/src/main/cpp/art/art_method.cpp
+9
-3
art_method.h
hooklib/src/main/cpp/includes/art_method.h
+1
-0
sandhook.cpp
hooklib/src/main/cpp/sandhook.cpp
+12
-0
No files found.
hooklib/src/main/cpp/art/art_method.cpp
View file @
f65fd71c
...
@@ -47,6 +47,11 @@ bool ArtMethod::isNative() {
...
@@ -47,6 +47,11 @@ bool ArtMethod::isNative() {
return
((
accessFlags
&
0x0100
)
!=
0
);
return
((
accessFlags
&
0x0100
)
!=
0
);
}
}
bool
ArtMethod
::
isStatic
()
{
uint32_t
accessFlags
=
getAccessFlags
();
return
((
accessFlags
&
0x0008
)
!=
0
);
}
bool
ArtMethod
::
isCompiled
()
{
bool
ArtMethod
::
isCompiled
()
{
return
getQuickCodeEntry
()
!=
SandHook
::
CastArtMethod
::
quickToInterpreterBridge
;
return
getQuickCodeEntry
()
!=
SandHook
::
CastArtMethod
::
quickToInterpreterBridge
;
}
}
...
@@ -65,8 +70,9 @@ void ArtMethod::setAccessFlags(uint32_t flags) {
...
@@ -65,8 +70,9 @@ void ArtMethod::setAccessFlags(uint32_t flags) {
void
ArtMethod
::
setPrivate
()
{
void
ArtMethod
::
setPrivate
()
{
uint32_t
accessFlag
=
getAccessFlags
();
uint32_t
accessFlag
=
getAccessFlags
();
accessFlag
&=
~
0x1
;
accessFlag
&=
~
0x0001
;
accessFlag
|=
0x2
;
accessFlag
&=
~
0x0004
;
accessFlag
|=
0x0002
;
setAccessFlags
(
accessFlag
);
setAccessFlags
(
accessFlag
);
}
}
...
@@ -138,4 +144,4 @@ void ArtMethod::backup(ArtMethod *backup) {
...
@@ -138,4 +144,4 @@ void ArtMethod::backup(ArtMethod *backup) {
Size
ArtMethod
::
size
()
{
Size
ArtMethod
::
size
()
{
return
CastArtMethod
::
size
;
return
CastArtMethod
::
size
;
}
}
\ No newline at end of file
hooklib/src/main/cpp/includes/art_method.h
View file @
f65fd71c
...
@@ -47,6 +47,7 @@ public:
...
@@ -47,6 +47,7 @@ public:
bool
isAbstract
();
bool
isAbstract
();
bool
isNative
();
bool
isNative
();
bool
isStatic
();
bool
isCompiled
();
bool
isCompiled
();
bool
isThumbCode
();
bool
isThumbCode
();
...
...
hooklib/src/main/cpp/sandhook.cpp
View file @
f65fd71c
...
@@ -75,6 +75,9 @@ void ensureMethodDeclaringClass(art::mirror::ArtMethod *origin, art::mirror::Art
...
@@ -75,6 +75,9 @@ void ensureMethodDeclaringClass(art::mirror::ArtMethod *origin, art::mirror::Art
if
(
SDK_INT
>=
ANDROID_O
)
{
if
(
SDK_INT
>=
ANDROID_O
)
{
backup
->
disableInterpreterForO
();
backup
->
disableInterpreterForO
();
}
}
if
(
!
backup
->
isStatic
())
{
backup
->
setPrivate
();
}
backup
->
tryDisableInline
();
backup
->
tryDisableInline
();
}
else
if
(
trampoline
->
replacement
!=
nullptr
)
{
}
else
if
(
trampoline
->
replacement
!=
nullptr
)
{
origin
->
backup
(
backup
);
origin
->
backup
(
backup
);
...
@@ -89,6 +92,9 @@ void ensureMethodDeclaringClass(art::mirror::ArtMethod *origin, art::mirror::Art
...
@@ -89,6 +92,9 @@ void ensureMethodDeclaringClass(art::mirror::ArtMethod *origin, art::mirror::Art
if
(
SDK_INT
>=
ANDROID_O
)
{
if
(
SDK_INT
>=
ANDROID_O
)
{
backup
->
disableInterpreterForO
();
backup
->
disableInterpreterForO
();
}
}
if
(
!
backup
->
isStatic
())
{
backup
->
setPrivate
();
}
backup
->
tryDisableInline
();
backup
->
tryDisableInline
();
}
else
{
}
else
{
return
;
return
;
...
@@ -117,6 +123,9 @@ bool doHookWithReplacement(JNIEnv* env,
...
@@ -117,6 +123,9 @@ bool doHookWithReplacement(JNIEnv* env,
backupMethod
->
disableInterpreterForO
();
backupMethod
->
disableInterpreterForO
();
}
}
backupMethod
->
tryDisableInline
();
backupMethod
->
tryDisableInline
();
if
(
!
backupMethod
->
isStatic
())
{
backupMethod
->
setPrivate
();
}
backupMethod
->
flushCache
();
backupMethod
->
flushCache
();
}
}
...
@@ -183,6 +192,9 @@ bool doHookWithInline(JNIEnv* env,
...
@@ -183,6 +192,9 @@ bool doHookWithInline(JNIEnv* env,
backupMethod
->
disableInterpreterForO
();
backupMethod
->
disableInterpreterForO
();
}
}
backupMethod
->
tryDisableInline
();
backupMethod
->
tryDisableInline
();
if
(
!
backupMethod
->
isStatic
())
{
backupMethod
->
setPrivate
();
}
backupMethod
->
flushCache
();
backupMethod
->
flushCache
();
}
}
return
true
;
return
true
;
...
...
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