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
b0e49a4c
Commit
b0e49a4c
authored
Jun 27, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kill blastula pool when magiskhide init
parent
1e94517a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
29 deletions
+11
-29
build.gradle
build.gradle
+1
-1
hide_utils.cpp
native/jni/magiskhide/hide_utils.cpp
+10
-28
No files found.
build.gradle
View file @
b0e49a4c
...
...
@@ -15,7 +15,7 @@ buildscript {
maven
{
url
'https://kotlin.bintray.com/kotlinx'
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:3.5.0-beta0
4
'
classpath
'com.android.tools.build:gradle:3.5.0-beta0
5
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
...
...
native/jni/magiskhide/hide_utils.cpp
View file @
b0e49a4c
...
...
@@ -6,7 +6,6 @@
#include <fcntl.h>
#include <dirent.h>
#include <string.h>
#include <libgen.h>
#include <magisk.h>
#include <utils.h>
...
...
@@ -37,45 +36,22 @@ void crawl_procfs(DIR *dir, const function<bool (int)> &fn) {
static
bool
proc_name_match
(
int
pid
,
const
char
*
name
)
{
char
buf
[
4019
];
FILE
*
f
;
#if 0
sprintf(buf, "/proc/%d/comm", pid);
if ((f = fopen(buf, "re"))) {
fgets(buf, sizeof(buf), f);
fclose(f);
if (strcmp(buf, name) == 0)
return true;
} else {
// The PID is already killed
return false;
}
#endif
sprintf
(
buf
,
"/proc/%d/cmdline"
,
pid
);
if
((
f
=
fopen
(
buf
,
"re"
)))
{
if
(
FILE
*
f
;
(
f
=
fopen
(
buf
,
"re"
)))
{
fgets
(
buf
,
sizeof
(
buf
),
f
);
fclose
(
f
);
if
(
strcmp
(
b
asename
(
buf
)
,
name
)
==
0
)
if
(
strcmp
(
b
uf
,
name
)
==
0
)
return
true
;
}
return
false
;
#if 0
sprintf(buf, "/proc/%d/exe", pid);
ssize_t len;
if ((len = readlink(buf, buf, sizeof(buf))) < 0)
return false;
buf[len] = '\0';
return strcmp(basename(buf), name) == 0;
#endif
}
static
void
kill_process
(
const
char
*
name
)
{
static
void
kill_process
(
const
char
*
name
,
bool
multi
=
false
)
{
crawl_procfs
([
=
](
int
pid
)
->
bool
{
if
(
proc_name_match
(
pid
,
name
))
{
if
(
kill
(
pid
,
SIGTERM
)
==
0
)
LOGD
(
"hide_utils: killed PID=[%d] (%s)
\n
"
,
pid
,
name
);
return
false
;
return
multi
;
}
return
true
;
});
...
...
@@ -177,6 +153,12 @@ bool init_list() {
});
db_err_cmd
(
err
,
return
false
);
// If Android Q+, also kill blastula pool
if
(
SDK_INT
>=
29
)
{
kill_process
(
"usap32"
,
true
);
kill_process
(
"usap64"
,
true
);
}
// Migrate old hide list into database
if
(
access
(
LEGACY_LIST
,
R_OK
)
==
0
)
{
file_readline
(
LEGACY_LIST
,
[](
string_view
s
)
->
bool
{
...
...
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