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
befe1a83
Commit
befe1a83
authored
Apr 07, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use real system_root mirror
parent
82ea9db9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
21 deletions
+23
-21
bootstages.cpp
native/jni/core/bootstages.cpp
+20
-20
proc_monitor.cpp
native/jni/magiskhide/proc_monitor.cpp
+3
-1
No files found.
native/jni/core/bootstages.cpp
View file @
befe1a83
...
@@ -31,8 +31,6 @@ static vector<string> module_list;
...
@@ -31,8 +31,6 @@ static vector<string> module_list;
static
bool
seperate_vendor
;
static
bool
seperate_vendor
;
static
bool
no_secure_dir
=
false
;
static
bool
no_secure_dir
=
false
;
char
*
system_block
,
*
vendor_block
,
*
data_block
;
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
();
...
@@ -303,6 +301,20 @@ static int bind_mount(const char *from, const char *to, bool log) {
...
@@ -303,6 +301,20 @@ static int bind_mount(const char *from, const char *to, bool log) {
return
ret
;
return
ret
;
}
}
char
*
system_block
;
char
*
vendor_block
;
char
*
data_block
;
static
char
*&
system_root_block
=
system_block
;
#define MIRRPNT(part) MIRRDIR "/" #part
#define mount_mirror(part, flag) \
sscanf(line.data(), "%s %*s %s", buf, buf2); \
part##_block = strdup(buf); \
xmkdir(MIRRPNT(part), 0755); \
xmount(part##_block, MIRRPNT(part), buf2, flag, nullptr); \
VLOGI("mount", part##_block, MIRRPNT(part))
static
bool
magisk_env
()
{
static
bool
magisk_env
()
{
LOGI
(
"* Initializing Magisk environment
\n
"
);
LOGI
(
"* Initializing Magisk environment
\n
"
);
...
@@ -336,8 +348,7 @@ static bool magisk_env() {
...
@@ -336,8 +348,7 @@ static bool magisk_env() {
symlink
(
MODULEMNT
,
MAGISKTMP
"/img"
);
symlink
(
MODULEMNT
,
MAGISKTMP
"/img"
);
// Directories in tmpfs overlay
// Directories in tmpfs overlay
xmkdirs
(
MIRRDIR
"/system"
,
0755
);
xmkdirs
(
MIRRPNT
(
system
),
0755
);
xmkdir
(
MIRRDIR
"/data"
,
0755
);
xmkdir
(
BBPATH
,
0755
);
xmkdir
(
BBPATH
,
0755
);
xmkdir
(
MODULEMNT
,
0755
);
xmkdir
(
MODULEMNT
,
0755
);
...
@@ -351,27 +362,16 @@ static bool magisk_env() {
...
@@ -351,27 +362,16 @@ static bool magisk_env() {
bool
system_as_root
=
false
;
bool
system_as_root
=
false
;
file_readline
(
"/proc/mounts"
,
[
&
](
string_view
line
)
->
bool
{
file_readline
(
"/proc/mounts"
,
[
&
](
string_view
line
)
->
bool
{
if
(
str_contains
(
line
,
" /system_root "
))
{
if
(
str_contains
(
line
,
" /system_root "
))
{
bind_mount
(
"/system_root/system"
,
MIRRDIR
"/system"
);
mount_mirror
(
system_root
,
MS_RDONLY
);
sscanf
(
line
.
data
(),
"%s"
,
buf
);
bind_mount
(
MIRRPNT
(
system_root
)
"/system"
,
MIRRPNT
(
system
));
system_block
=
strdup
(
buf
);
system_as_root
=
true
;
system_as_root
=
true
;
}
else
if
(
!
system_as_root
&&
str_contains
(
line
,
" /system "
))
{
}
else
if
(
!
system_as_root
&&
str_contains
(
line
,
" /system "
))
{
sscanf
(
line
.
data
(),
"%s %*s %s"
,
buf
,
buf2
);
mount_mirror
(
system
,
MS_RDONLY
);
system_block
=
strdup
(
buf
);
xmount
(
system_block
,
MIRRDIR
"/system"
,
buf2
,
MS_RDONLY
,
nullptr
);
VLOGI
(
"mount"
,
system_block
,
MIRRDIR
"/system"
);
}
else
if
(
str_contains
(
line
,
" /vendor "
))
{
}
else
if
(
str_contains
(
line
,
" /vendor "
))
{
mount_mirror
(
vendor
,
MS_RDONLY
);
seperate_vendor
=
true
;
seperate_vendor
=
true
;
sscanf
(
line
.
data
(),
"%s %*s %s"
,
buf
,
buf2
);
vendor_block
=
strdup
(
buf
);
xmkdir
(
MIRRDIR
"/vendor"
,
0755
);
xmount
(
vendor_block
,
MIRRDIR
"/vendor"
,
buf2
,
MS_RDONLY
,
nullptr
);
VLOGI
(
"mount"
,
vendor_block
,
MIRRDIR
"/vendor"
);
}
else
if
(
str_contains
(
line
,
" /data "
))
{
}
else
if
(
str_contains
(
line
,
" /data "
))
{
sscanf
(
line
.
data
(),
"%s %*s %s"
,
buf
,
buf2
);
mount_mirror
(
data
,
0
);
data_block
=
strdup
(
buf
);
xmount
(
data_block
,
MIRRDIR
"/data"
,
buf2
,
0
,
nullptr
);
VLOGI
(
"mount"
,
data_block
,
MIRRDIR
"/data"
);
}
else
if
(
SDK_INT
>=
24
&&
}
else
if
(
SDK_INT
>=
24
&&
str_contains
(
line
,
" /proc "
)
&&
!
str_contains
(
line
,
"hidepid=2"
))
{
str_contains
(
line
,
" /proc "
)
&&
!
str_contains
(
line
,
"hidepid=2"
))
{
// Enforce hidepid
// Enforce hidepid
...
...
native/jni/magiskhide/proc_monitor.cpp
View file @
befe1a83
...
@@ -28,7 +28,9 @@
...
@@ -28,7 +28,9 @@
using
namespace
std
;
using
namespace
std
;
extern
char
*
system_block
,
*
vendor_block
,
*
data_block
;
extern
char
*
system_block
;
extern
char
*
vendor_block
;
extern
char
*
data_block
;
static
int
inotify_fd
=
-
1
;
static
int
inotify_fd
=
-
1
;
...
...
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