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
88fae36b
Commit
88fae36b
authored
Apr 29, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide sub-services of apps for hiding
Close #383
parent
fc9d4034
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
proc_monitor.c
native/jni/magiskhide/proc_monitor.c
+10
-3
No files found.
native/jni/magiskhide/proc_monitor.c
View file @
88fae36b
...
@@ -61,7 +61,7 @@ static void lazy_unmount(const char* mountpoint) {
...
@@ -61,7 +61,7 @@ static void lazy_unmount(const char* mountpoint) {
LOGD
(
"hide_daemon: Unmounted (%s)
\n
"
,
mountpoint
);
LOGD
(
"hide_daemon: Unmounted (%s)
\n
"
,
mountpoint
);
}
}
static
void
hide_daemon
(
int
pid
,
int
ppid
)
{
static
void
hide_daemon
(
int
pid
)
{
LOGD
(
"hide_daemon: start unmount for pid=[%d]
\n
"
,
pid
);
LOGD
(
"hide_daemon: start unmount for pid=[%d]
\n
"
,
pid
);
strcpy
(
argv0
,
"hide_daemon"
);
strcpy
(
argv0
,
"hide_daemon"
);
...
@@ -202,6 +202,11 @@ void proc_monitor() {
...
@@ -202,6 +202,11 @@ void proc_monitor() {
if
(
ret
!=
2
)
if
(
ret
!=
2
)
continue
;
continue
;
// Allow hiding sub-services of applications
char
*
colon
=
strchr
(
processName
,
':'
);
if
(
colon
)
*
colon
=
'\0'
;
// Critical region
// Critical region
pthread_mutex_lock
(
&
hide_lock
);
pthread_mutex_lock
(
&
hide_lock
);
vec_for_each
(
hide_list
,
line
)
{
vec_for_each
(
hide_list
,
line
)
{
...
@@ -222,15 +227,17 @@ void proc_monitor() {
...
@@ -222,15 +227,17 @@ void proc_monitor() {
// Send pause signal ASAP
// Send pause signal ASAP
if
(
kill
(
pid
,
SIGSTOP
)
==
-
1
)
continue
;
if
(
kill
(
pid
,
SIGSTOP
)
==
-
1
)
continue
;
// Restore the colon so we can log the actual process name
if
(
colon
)
*
colon
=
':'
;
LOGI
(
"proc_monitor: %s (PID=%d ns=%s)
\n
"
,
processName
,
pid
,
ns
);
LOGI
(
"proc_monitor: %s (PID=%d ns=%s)
\n
"
,
processName
,
pid
,
ns
);
/*
/*
* The setns system call do not support multithread processes
* The setns system call do not support multithread processes
* We have to fork a new process, setns, then do the unmounts
* We have to fork a new process, setns, then do the unmounts
*/
*/
int
selfpid
=
getpid
();
if
(
fork_dont_care
()
==
0
)
if
(
fork_dont_care
()
==
0
)
hide_daemon
(
pid
,
selfpid
);
hide_daemon
(
pid
);
break
;
break
;
}
}
...
...
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