Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
c1602d25
Commit
c1602d25
authored
Jun 05, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support execute commands in magiskhide env
Credits to #1454
parent
9f8d4e10
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
hide_policy.cpp
native/jni/magiskhide/hide_policy.cpp
+3
-0
magiskhide.cpp
native/jni/magiskhide/magiskhide.cpp
+11
-0
magiskhide.h
native/jni/magiskhide/magiskhide.h
+1
-0
No files found.
native/jni/magiskhide/hide_policy.cpp
View file @
c1602d25
...
...
@@ -41,7 +41,10 @@ void hide_daemon(int pid) {
tgkill
(
pid
,
pid
,
SIGCONT
);
_exit
(
0
);
});
hide_unmount
(
pid
);
}
void
hide_unmount
(
int
pid
)
{
if
(
switch_mnt_ns
(
pid
))
return
;
...
...
native/jni/magiskhide/magiskhide.cpp
View file @
c1602d25
...
...
@@ -6,9 +6,11 @@
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <magisk.h>
#include <daemon.h>
#include <utils.h>
#include <flags.h>
#include "magiskhide.h"
...
...
@@ -28,6 +30,8 @@ bool hide_enabled = false;
" add PKG [PROC] Add a new target to the hide list
\n
"
" rm PKG [PROC] Remove target(s) from the 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
" test Run process monitor test
\n
"
#endif
...
...
@@ -99,6 +103,13 @@ int magiskhide_main(int argc, char *argv[]) {
req
=
LS_HIDELIST
;
else
if
(
opt
==
"status"
sv
)
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
else
if
(
opt
==
"test"
sv
)
test_proc_monitor
();
...
...
native/jni/magiskhide/magiskhide.h
View file @
c1602d25
...
...
@@ -37,6 +37,7 @@ void crawl_procfs(DIR *dir, const std::function<bool (int)> &fn);
// Hide policies
void
hide_daemon
(
int
pid
);
void
hide_unmount
(
int
pid
=
getpid
());
void
hide_sensitive_props
();
extern
bool
hide_enabled
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment