parent
f383d11d10
commit
fe644e10d0
@ -22,6 +22,7 @@ using namespace std;
|
||||
static char buf[PATH_MAX], buf2[PATH_MAX];
|
||||
static vector<string> module_list;
|
||||
static bool no_secure_dir = false;
|
||||
static bool pfs_done = false;
|
||||
|
||||
static int bind_mount(const char *from, const char *to, bool log = true);
|
||||
extern void auto_start_magiskhide();
|
||||
@ -600,6 +601,7 @@ static void dump_logs() {
|
||||
}
|
||||
|
||||
[[noreturn]] static void core_only() {
|
||||
pfs_done = true;
|
||||
auto_start_magiskhide();
|
||||
unblock_boot_process();
|
||||
}
|
||||
@ -714,6 +716,9 @@ void late_start(int client) {
|
||||
reboot();
|
||||
}
|
||||
|
||||
if (!pfs_done)
|
||||
return;
|
||||
|
||||
if (access(BBPATH, F_OK) != 0){
|
||||
LOGE("* post-fs-data mode is not triggered\n");
|
||||
unlock_blocks();
|
||||
@ -745,6 +750,9 @@ void boot_complete(int client) {
|
||||
write_int(client, 0);
|
||||
close(client);
|
||||
|
||||
if (!pfs_done)
|
||||
return;
|
||||
|
||||
if (access(MANAGERAPK, F_OK) == 0) {
|
||||
// Install Magisk Manager if exists
|
||||
rename(MANAGERAPK, "/data/magisk.apk");
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
int SDK_INT = -1;
|
||||
bool RECOVERY_MODE = false;
|
||||
static struct stat SERVER_STAT;
|
||||
static struct stat self_st;
|
||||
|
||||
static void verify_client(int client, pid_t pid) {
|
||||
// Verify caller is the same as server
|
||||
char path[32];
|
||||
sprintf(path, "/proc/%d/exe", pid);
|
||||
struct stat st;
|
||||
if (stat(path, &st) || st.st_dev != SERVER_STAT.st_dev || st.st_ino != SERVER_STAT.st_ino) {
|
||||
if (stat(path, &st) || st.st_dev != self_st.st_dev || st.st_ino != self_st.st_ino) {
|
||||
close(client);
|
||||
pthread_exit(nullptr);
|
||||
}
|
||||
@ -137,7 +137,7 @@ static void main_daemon() {
|
||||
LOGI(SHOW_VER(Magisk) " daemon started\n");
|
||||
|
||||
// Get server stat
|
||||
stat("/proc/self/exe", &SERVER_STAT);
|
||||
stat("/proc/self/exe", &self_st);
|
||||
|
||||
// Get API level
|
||||
parse_prop_file("/system/build.prop", [](auto key, auto val) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user