Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
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
Magisk
Commits
838f3cc0
Commit
838f3cc0
authored
Jun 16, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify hiding conditions
parent
4d584133
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
17 deletions
+7
-17
proc_monitor.c
native/jni/magiskhide/proc_monitor.c
+5
-17
misc.c
native/jni/utils/misc.c
+2
-0
No files found.
native/jni/magiskhide/proc_monitor.c
View file @
838f3cc0
...
...
@@ -63,7 +63,6 @@ static void lazy_unmount(const char* mountpoint) {
static
void
hide_daemon
(
int
pid
)
{
LOGD
(
"hide_daemon: start unmount for pid=[%d]
\n
"
,
pid
);
strcpy
(
argv0
,
"hide_daemon"
);
char
*
line
,
buffer
[
PATH_MAX
];
struct
vector
mount_list
;
...
...
@@ -90,19 +89,9 @@ static void hide_daemon(int pid) {
has_cache
=
0
;
}
// Unmout cache mounts
if
(
has_cache
)
{
// Unmount dummy skeletons and /sbin links
vec_for_each
(
&
mount_list
,
line
)
{
if
(
strstr
(
line
,
cache_block
)
&&
(
strstr
(
line
,
" /system/"
)
||
strstr
(
line
,
" /vendor/"
)))
{
sscanf
(
line
,
"%*s %4096s"
,
buffer
);
lazy_unmount
(
buffer
);
}
}
}
// Unmount dummy skeletons, /sbin links
vec_for_each
(
&
mount_list
,
line
)
{
if
(
strstr
(
line
,
"tmpfs /system"
)
||
strstr
(
line
,
"tmpfs /vendor"
)
||
strstr
(
line
,
"tmpfs /sbin"
))
{
if
(
strstr
(
line
,
"tmpfs /system/"
)
||
strstr
(
line
,
"tmpfs /vendor/"
)
||
strstr
(
line
,
"tmpfs /sbin"
))
{
sscanf
(
line
,
"%*s %4096s"
,
buffer
);
lazy_unmount
(
buffer
);
}
...
...
@@ -115,20 +104,19 @@ static void hide_daemon(int pid) {
vec_init
(
&
mount_list
);
file_to_vector
(
buffer
,
&
mount_list
);
// Unmount
any
loop mounts
// Unmount
everything under /system, /vendor, and
loop mounts
vec_for_each
(
&
mount_list
,
line
)
{
if
(
strstr
(
line
,
"/dev/block/loop"
))
{
if
(
strstr
(
line
,
"/dev/block/loop"
)
||
strstr
(
line
,
" /system/"
)
||
strstr
(
line
,
" /vendor/"
)
)
{
sscanf
(
line
,
"%*s %4096s"
,
buffer
);
lazy_unmount
(
buffer
);
}
free
(
line
);
}
vec_destroy
(
&
mount_list
);
exit:
// Send resume signal
kill
(
pid
,
SIGCONT
);
// Free up memory
vec_destroy
(
&
mount_list
);
_exit
(
0
);
}
...
...
native/jni/utils/misc.c
View file @
838f3cc0
...
...
@@ -87,6 +87,8 @@ int check_data() {
/* All the string should be freed manually!! */
int
file_to_vector
(
const
char
*
filename
,
struct
vector
*
v
)
{
if
(
access
(
filename
,
R_OK
)
!=
0
)
return
1
;
char
*
line
=
NULL
;
size_t
len
=
0
;
ssize_t
read
;
...
...
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