mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-25 18:07:25 +00:00
Kill blastula pool when magiskhide init
This commit is contained in:
parent
1e94517a72
commit
b0e49a4cc8
@ -15,7 +15,7 @@ buildscript {
|
|||||||
maven { url 'https://kotlin.bintray.com/kotlinx' }
|
maven { url 'https://kotlin.bintray.com/kotlinx' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.0-beta04'
|
classpath 'com.android.tools.build:gradle:3.5.0-beta05'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libgen.h>
|
|
||||||
|
|
||||||
#include <magisk.h>
|
#include <magisk.h>
|
||||||
#include <utils.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) {
|
static bool proc_name_match(int pid, const char *name) {
|
||||||
char buf[4019];
|
char buf[4019];
|
||||||
FILE *f;
|
sprintf(buf, "/proc/%d/cmdline", pid);
|
||||||
#if 0
|
if (FILE *f; (f = fopen(buf, "re"))) {
|
||||||
sprintf(buf, "/proc/%d/comm", pid);
|
|
||||||
if ((f = fopen(buf, "re"))) {
|
|
||||||
fgets(buf, sizeof(buf), f);
|
fgets(buf, sizeof(buf), f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (strcmp(buf, name) == 0)
|
if (strcmp(buf, name) == 0)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
// The PID is already killed
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sprintf(buf, "/proc/%d/cmdline", pid);
|
|
||||||
if ((f = fopen(buf, "re"))) {
|
|
||||||
fgets(buf, sizeof(buf), f);
|
|
||||||
fclose(f);
|
|
||||||
if (strcmp(basename(buf), name) == 0)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
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 {
|
crawl_procfs([=](int pid) -> bool {
|
||||||
if (proc_name_match(pid, name)) {
|
if (proc_name_match(pid, name)) {
|
||||||
if (kill(pid, SIGTERM) == 0)
|
if (kill(pid, SIGTERM) == 0)
|
||||||
LOGD("hide_utils: killed PID=[%d] (%s)\n", pid, name);
|
LOGD("hide_utils: killed PID=[%d] (%s)\n", pid, name);
|
||||||
return false;
|
return multi;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -177,6 +153,12 @@ bool init_list() {
|
|||||||
});
|
});
|
||||||
db_err_cmd(err, return false);
|
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
|
// Migrate old hide list into database
|
||||||
if (access(LEGACY_LIST, R_OK) == 0) {
|
if (access(LEGACY_LIST, R_OK) == 0) {
|
||||||
file_readline(LEGACY_LIST, [](string_view s) -> bool {
|
file_readline(LEGACY_LIST, [](string_view s) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user