Commit 495654f9 authored by topjohnwu's avatar topjohnwu

Small tweaks

parent 95fec210
......@@ -89,8 +89,6 @@ static int setup_socket(struct sockaddr_un *sun) {
return fd;
}
static void do_nothing() {}
static void *large_sepol_patch(void *args) {
LOGD("sepol: Starting large patch thread\n");
// Patch su to everything
......@@ -117,6 +115,7 @@ void start_daemon() {
}
xsetsid();
xsetcon("u:r:su:s0");
umask(022);
// Patch selinux with medium patch before we do anything
load_policydb("/sys/fs/selinux/policy");
......
......@@ -33,9 +33,10 @@
// Global handler for PLOGE
extern __thread void (*err_handler)(void);
// Two common error handlers
// Common error handlers
static inline void exit_proc() { exit(1); }
static inline void exit_thread() { pthread_exit(NULL); }
static inline void do_nothing() {}
// Dummy function to depress debug message
static inline void stub(const char *fmt, ...) {}
......
......@@ -102,7 +102,7 @@ int init_list() {
return 1;
vec_init(hide_list);
// Might return 1 if first time
// Might error if file doesn't exist, no need to report
file_to_vector(HIDELIST, hide_list);
char *line;
......
......@@ -43,6 +43,9 @@ static void usage(char *arg0) {
}
void launch_magiskhide(int client) {
// We manually handle crashes
err_handler = do_nothing;
if (hideEnabled) {
write_int(client, HIDE_IS_ENABLED);
close(client);
......@@ -52,8 +55,12 @@ void launch_magiskhide(int client) {
LOGI("* Starting MagiskHide\n");
hideEnabled = 1;
init_resetprop();
setprop2("persist.magisk.hide", "1", 0);
if (init_resetprop())
goto error;
if (setprop2("persist.magisk.hide", "1", 0))
goto error;
hide_sensitive_props();
......
......@@ -66,7 +66,7 @@ static void proc_monitor_err() {
void proc_monitor() {
// Register the cancel signal
signal(SIGUSR1, quit_pthread);
// The error handler should only exit the thread, not the whole process
// The error handler should stop magiskhide services
err_handler = proc_monitor_err;
int pid;
......
Subproject commit b499ac8abacc9d009d110146e2f681a9b0a66f19
Subproject commit c5583620349aa7700435bda0b0f356c3510e550e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment