parent
9f8d4e1022
commit
c1602d2554
@ -41,7 +41,10 @@ void hide_daemon(int pid) {
|
|||||||
tgkill(pid, pid, SIGCONT);
|
tgkill(pid, pid, SIGCONT);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
});
|
});
|
||||||
|
hide_unmount(pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hide_unmount(int pid) {
|
||||||
if (switch_mnt_ns(pid))
|
if (switch_mnt_ns(pid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
|
||||||
#include <magisk.h>
|
#include <magisk.h>
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
|
#include <utils.h>
|
||||||
#include <flags.h>
|
#include <flags.h>
|
||||||
|
|
||||||
#include "magiskhide.h"
|
#include "magiskhide.h"
|
||||||
@ -28,6 +30,8 @@ bool hide_enabled = false;
|
|||||||
" add PKG [PROC] Add a new target to the hide list\n"
|
" add PKG [PROC] Add a new target to the hide list\n"
|
||||||
" rm PKG [PROC] Remove target(s) from the hide list\n"
|
" rm PKG [PROC] Remove target(s) from the hide list\n"
|
||||||
" ls Print the current hide list\n"
|
" ls Print the current hide list\n"
|
||||||
|
" exec CMDs... Execute commands in isolated mount\n"
|
||||||
|
" namespace and do all hide unmounts\n"
|
||||||
#ifdef MAGISK_DEBUG
|
#ifdef MAGISK_DEBUG
|
||||||
" test Run process monitor test\n"
|
" test Run process monitor test\n"
|
||||||
#endif
|
#endif
|
||||||
@ -99,6 +103,13 @@ int magiskhide_main(int argc, char *argv[]) {
|
|||||||
req = LS_HIDELIST;
|
req = LS_HIDELIST;
|
||||||
else if (opt == "status"sv)
|
else if (opt == "status"sv)
|
||||||
req = HIDE_STATUS;
|
req = HIDE_STATUS;
|
||||||
|
else if (opt == "exec"sv && argc > 2) {
|
||||||
|
xunshare(CLONE_NEWNS);
|
||||||
|
xmount(nullptr, "/", nullptr, MS_PRIVATE | MS_REC, nullptr);
|
||||||
|
hide_unmount();
|
||||||
|
execvp(argv[2], argv + 2);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
#ifdef MAGISK_DEBUG
|
#ifdef MAGISK_DEBUG
|
||||||
else if (opt == "test"sv)
|
else if (opt == "test"sv)
|
||||||
test_proc_monitor();
|
test_proc_monitor();
|
||||||
|
@ -37,6 +37,7 @@ void crawl_procfs(DIR *dir, const std::function<bool (int)> &fn);
|
|||||||
|
|
||||||
// Hide policies
|
// Hide policies
|
||||||
void hide_daemon(int pid);
|
void hide_daemon(int pid);
|
||||||
|
void hide_unmount(int pid = getpid());
|
||||||
void hide_sensitive_props();
|
void hide_sensitive_props();
|
||||||
|
|
||||||
extern bool hide_enabled;
|
extern bool hide_enabled;
|
||||||
|
Loading…
Reference in New Issue
Block a user