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
6a54672b
Commit
6a54672b
authored
May 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup unnecessary functions
parent
3d9a15df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
22 deletions
+15
-22
hide_policy.cpp
native/jni/magiskhide/hide_policy.cpp
+15
-21
magiskhide.h
native/jni/magiskhide/magiskhide.h
+0
-1
No files found.
native/jni/magiskhide/hide_policy.cpp
View file @
6a54672b
...
@@ -19,18 +19,6 @@ static const char *prop_value[] =
...
@@ -19,18 +19,6 @@ static const char *prop_value[] =
"enforcing"
,
"0"
,
"0"
,
"0"
,
"enforcing"
,
"0"
,
"0"
,
"0"
,
"1"
,
"user"
,
"release-keys"
,
"0"
,
nullptr
};
"1"
,
"user"
,
"release-keys"
,
"0"
,
nullptr
};
void
manage_selinux
()
{
char
val
;
int
fd
=
xopen
(
SELINUX_ENFORCE
,
O_RDONLY
);
xxread
(
fd
,
&
val
,
sizeof
(
val
));
close
(
fd
);
// Permissive
if
(
val
==
'0'
)
{
chmod
(
SELINUX_ENFORCE
,
0640
);
chmod
(
SELINUX_POLICY
,
0440
);
}
}
void
hide_sensitive_props
()
{
void
hide_sensitive_props
()
{
LOGI
(
"hide_policy: Hiding sensitive props
\n
"
);
LOGI
(
"hide_policy: Hiding sensitive props
\n
"
);
...
@@ -42,13 +30,6 @@ void hide_sensitive_props() {
...
@@ -42,13 +30,6 @@ void hide_sensitive_props() {
}
}
}
}
static
inline
void
clean_magisk_props
()
{
getprop
([](
const
char
*
name
,
auto
,
auto
)
->
void
{
if
(
strstr
(
name
,
"magisk"
))
deleteprop
(
name
);
},
nullptr
,
false
);
}
static
inline
void
lazy_unmount
(
const
char
*
mountpoint
)
{
static
inline
void
lazy_unmount
(
const
char
*
mountpoint
)
{
if
(
umount2
(
mountpoint
,
MNT_DETACH
)
!=
-
1
)
if
(
umount2
(
mountpoint
,
MNT_DETACH
)
!=
-
1
)
LOGD
(
"hide_policy: Unmounted (%s)
\n
"
,
mountpoint
);
LOGD
(
"hide_policy: Unmounted (%s)
\n
"
,
mountpoint
);
...
@@ -65,8 +46,21 @@ void hide_daemon(int pid) {
...
@@ -65,8 +46,21 @@ void hide_daemon(int pid) {
return
;
return
;
LOGD
(
"hide_policy: handling PID=[%d]
\n
"
,
pid
);
LOGD
(
"hide_policy: handling PID=[%d]
\n
"
,
pid
);
manage_selinux
();
clean_magisk_props
();
char
val
;
int
fd
=
xopen
(
SELINUX_ENFORCE
,
O_RDONLY
);
xxread
(
fd
,
&
val
,
sizeof
(
val
));
close
(
fd
);
// Permissive
if
(
val
==
'0'
)
{
chmod
(
SELINUX_ENFORCE
,
0640
);
chmod
(
SELINUX_POLICY
,
0440
);
}
getprop
([](
const
char
*
name
,
auto
,
auto
)
->
void
{
if
(
strstr
(
name
,
"magisk"
))
deleteprop
(
name
);
},
nullptr
,
false
);
vector
<
string
>
targets
;
vector
<
string
>
targets
;
...
...
native/jni/magiskhide/magiskhide.h
View file @
6a54672b
...
@@ -38,7 +38,6 @@ void crawl_procfs(DIR *dir, const std::function<bool (int)> &fn);
...
@@ -38,7 +38,6 @@ 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_sensitive_props
();
void
hide_sensitive_props
();
void
manage_selinux
();
extern
bool
hide_enabled
;
extern
bool
hide_enabled
;
extern
pthread_mutex_t
monitor_lock
;
extern
pthread_mutex_t
monitor_lock
;
...
...
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