Completely rework MagiskHide

Previous MagiskHide detects new app launches via listening through logcat
and filtering launch info messages.

This is extremely inefficient and prone to cause multiple issues both
theoratically and practically.

Rework this by using inotify to detect open() syscalls to target APKs.

This also solves issues related to Zygote-forked caching mechanisms such as
OnePlus OxygenOS' embryo.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
This commit is contained in:
Park Ju Hyung
2019-02-12 23:12:03 +09:00
committed by John Wu
parent e5940168fe
commit 7384d2d330
8 changed files with 272 additions and 240 deletions

View File

@@ -12,7 +12,6 @@
#include <utils.h>
#include <resetprop.h>
#include <db.h>
#include <logcat.h>
#include "magiskhide.h"
@@ -197,6 +196,10 @@ int add_list(int client) {
char *proc = read_string(client);
int ret = add_list(proc);
free(proc);
// Update inotify list
update_apk_list();
return ret;
}
@@ -230,6 +233,10 @@ int rm_list(int client) {
char *proc = read_string(client);
int ret = rm_list(proc);
free(proc);
// Update inotify list
update_apk_list();
return ret;
}
@@ -283,9 +290,6 @@ int launch_magiskhide(int client) {
if (hide_enabled)
return HIDE_IS_ENABLED;
if (!logcat_started)
return LOGCAT_DISABLED;
hide_enabled = true;
set_hide_config();
LOGI("* Starting MagiskHide\n");
@@ -328,8 +332,6 @@ int stop_magiskhide() {
}
void auto_start_magiskhide() {
if (!start_logcat())
return;
db_settings dbs;
get_db_settings(&dbs, HIDE_CONFIG);
if (dbs[HIDE_CONFIG]) {