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
a9597adf
Commit
a9597adf
authored
Mar 14, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fake dlopen on Android Q
parent
e287e044
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
dlfcn_nougat.cpp
hooklib/src/main/cpp/utils/dlfcn_nougat.cpp
+7
-2
elf_util.cpp
hooklib/src/main/cpp/utils/elf_util.cpp
+12
-2
No files found.
hooklib/src/main/cpp/utils/dlfcn_nougat.cpp
View file @
a9597adf
...
...
@@ -92,8 +92,13 @@ void *fake_dlopen_with_path(const char *libpath, int flags) {
maps
=
fopen
(
"/proc/self/maps"
,
"r"
);
if
(
!
maps
)
fatal
(
"failed to open maps"
);
while
(
!
found
&&
fgets
(
buff
,
sizeof
(
buff
),
maps
))
if
(
strstr
(
buff
,
"r-xp"
)
&&
strstr
(
buff
,
libpath
))
found
=
1
;
while
(
fgets
(
buff
,
sizeof
(
buff
),
maps
))
{
if
((
strstr
(
buff
,
"r-xp"
)
||
strstr
(
buff
,
"r--p"
))
&&
strstr
(
buff
,
libpath
))
{
found
=
1
;
__android_log_print
(
ANDROID_LOG_DEBUG
,
"dlopen"
,
"%s
\n
"
,
buff
);
break
;
}
}
fclose
(
maps
);
...
...
hooklib/src/main/cpp/utils/elf_util.cpp
View file @
a9597adf
...
...
@@ -124,8 +124,18 @@ void *ElfImg::getModuleBase(const char *name) {
off_t
load_addr
;
int
found
=
0
;
maps
=
fopen
(
"/proc/self/maps"
,
"r"
);
while
(
!
found
&&
fgets
(
buff
,
sizeof
(
buff
),
maps
))
if
(
strstr
(
buff
,
"r-xp"
)
&&
strstr
(
buff
,
name
))
found
=
1
;
while
(
fgets
(
buff
,
sizeof
(
buff
),
maps
))
{
if
((
strstr
(
buff
,
"r-xp"
)
||
strstr
(
buff
,
"r--p"
))
&&
strstr
(
buff
,
name
))
{
found
=
1
;
__android_log_print
(
ANDROID_LOG_DEBUG
,
"dlopen"
,
"%s
\n
"
,
buff
);
break
;
}
}
if
(
!
found
)
{
LOGE
(
"failed to read load address for %s"
,
name
);
return
nullptr
;
}
if
(
sscanf
(
buff
,
"%lx"
,
&
load_addr
)
!=
1
)
LOGE
(
"failed to read load address for %s"
,
name
);
...
...
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