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