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
f6c7aa65
Commit
f6c7aa65
authored
May 23, 2019
by
swift_gan
Committed by
swift_gan
May 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]fix adrp decode & update test case
parent
e85c7f8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
inst_arm64.cpp
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.cpp
+6
-5
sandhook_native.cpp
nativehook/src/main/cpp/sandhook_native.cpp
+9
-2
No files found.
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.cpp
View file @
f6c7aa65
...
...
@@ -71,16 +71,17 @@ A64_ADR_ADRP::A64_ADR_ADRP(A64_ADR_ADRP::OP op, XRegister &rd, Label &label) {
Off
A64_ADR_ADRP
::
getImmPCOffset
()
{
U32
hi
=
get
()
->
immhi
;
U32
lo
=
get
()
->
immlo
;
Off
offset
=
signExtend64
(
IMM_LO_W
+
IMM_HI_W
,
COMBINE
(
hi
,
lo
,
IMM_LO_W
)
);
U64
imm
=
COMBINE
(
hi
,
lo
,
IMM_LO_W
);
if
(
isADRP
())
{
offset
*=
P_SIZE
;
return
signExtend64
(
IMM_HI_W
+
IMM_LO_W
+
PAGE_OFFSET
,
imm
<<
PAGE_OFFSET
);
}
else
{
return
signExtend64
(
IMM_HI_W
+
IMM_LO_W
,
imm
);
}
return
offset
;
}
Addr
A64_ADR_ADRP
::
getImmPCOffsetTarget
()
{
void
*
base
=
AlignDown
(
getPC
(),
P_SIZE
);
return
getImmPCOffset
()
+
reinterpret_cast
<
Addr
>
(
base
);
return
offset
+
reinterpret_cast
<
Addr
>
(
base
);
}
void
A64_ADR_ADRP
::
assembler
()
{
...
...
@@ -90,7 +91,7 @@ void A64_ADR_ADRP::assembler() {
void
A64_ADR_ADRP
::
decode
(
STRUCT_A64
(
ADR_ADRP
)
*
inst
)
{
offset
=
getImmPCOffset
();
DECODE_RD
(
XReg
);
op
=
OP
(
get
()
->
op
)
;
DECODE_OP
;
}
//Mov Wide
...
...
nativehook/src/main/cpp/sandhook_native.cpp
View file @
f6c7aa65
...
...
@@ -15,6 +15,12 @@ using namespace SandHook::Decoder;
using
namespace
SandHook
::
Hook
;
using
namespace
SandHook
::
AsmA64
;
int
m1
=
5
;
int
m3
=
5
;
int
m2
=
4
;
int
m4
=
5
;
void
(
*
dosth3Backup
)(
int
,
int
)
=
nullptr
;
void
(
*
dosth4Backup
)()
=
nullptr
;
void
(
*
dosth4Backup2
)()
=
nullptr
;
...
...
@@ -51,6 +57,9 @@ void do5() {
}
void
do4
()
{
if
(
m2
>
m3
)
{
return
;
}
int
a
=
1
+
1
;
int
b
=
a
+
1
;
int
d
=
a
+
1
;
...
...
@@ -134,8 +143,6 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
InlineHookArm64Android
inlineHookArm64Android
=
InlineHookArm64Android
();
do4
();
dosth4Backup
=
reinterpret_cast
<
void
(
*
)()
>
(
inlineHookArm64Android
.
inlineHook
(
reinterpret_cast
<
void
*>
(
do4
),
reinterpret_cast
<
void
*>
(
do4replace
)));
...
...
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