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
dab32e15
Commit
dab32e15
authored
Apr 08, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use our own device nodes for mirrors
parent
bc286fd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
23 deletions
+18
-23
bootstages.cpp
native/jni/core/bootstages.cpp
+15
-15
magisk.h
native/jni/include/magisk.h
+1
-0
proc_monitor.cpp
native/jni/magiskhide/proc_monitor.cpp
+2
-8
No files found.
native/jni/core/bootstages.cpp
View file @
dab32e15
...
@@ -301,19 +301,17 @@ static int bind_mount(const char *from, const char *to, bool log) {
...
@@ -301,19 +301,17 @@ static int bind_mount(const char *from, const char *to, bool log) {
return
ret
;
return
ret
;
}
}
char
*
system_block
;
#define MIRRMNT(part) MIRRDIR "/" #part
char
*
vendor_block
;
#define PARTBLK(part) BLOCKDIR "/" #part
char
*
data_block
;
static
char
*&
system_root_block
=
system_block
;
#define mount_mirror(part, flag) { \
sscanf(line.data(), "%s %*s %s", buf, buf2); \
#define MIRRPNT(part) MIRRDIR "/" #part
xstat(buf, &st); \
mknod(PARTBLK(part), S_IFBLK | 0600, st.st_rdev); \
#define mount_mirror(part, flag) \
xmkdir(MIRRMNT(part), 0755); \
sscanf(line.data(), "%s %*s %s", buf, buf2); \
xmount(PARTBLK(part), MIRRMNT(part), buf2, flag, nullptr); \
part##_block = strdup(buf); \
VLOGI("mount", PARTBLK(part), MIRRMNT(part)); \
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
"
);
...
@@ -348,7 +346,8 @@ static bool magisk_env() {
...
@@ -348,7 +346,8 @@ static bool magisk_env() {
symlink
(
MODULEMNT
,
MAGISKTMP
"/img"
);
symlink
(
MODULEMNT
,
MAGISKTMP
"/img"
);
// Directories in tmpfs overlay
// Directories in tmpfs overlay
xmkdirs
(
MIRRPNT
(
system
),
0755
);
xmkdir
(
MIRRDIR
,
0
);
xmkdir
(
BLOCKDIR
,
0
);
xmkdir
(
BBPATH
,
0755
);
xmkdir
(
BBPATH
,
0755
);
xmkdir
(
MODULEMNT
,
0755
);
xmkdir
(
MODULEMNT
,
0755
);
...
@@ -360,10 +359,11 @@ static bool magisk_env() {
...
@@ -360,10 +359,11 @@ static bool magisk_env() {
LOGI
(
"* Mounting mirrors"
);
LOGI
(
"* Mounting mirrors"
);
bool
system_as_root
=
false
;
bool
system_as_root
=
false
;
struct
stat
st
;
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 "
))
{
mount_mirror
(
system_root
,
MS_RDONLY
);
mount_mirror
(
system_root
,
MS_RDONLY
);
bind_mount
(
MIRRPNT
(
system_root
)
"/system"
,
MIRRP
NT
(
system
));
xsymlink
(
MIRRMNT
(
system_root
)
"/system"
,
MIRRM
NT
(
system
));
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 "
))
{
mount_mirror
(
system
,
MS_RDONLY
);
mount_mirror
(
system
,
MS_RDONLY
);
...
...
native/jni/include/magisk.h
View file @
dab32e15
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#define DISABLEFILE "/cache/.disable_magisk"
#define DISABLEFILE "/cache/.disable_magisk"
#define MAGISKTMP "/sbin/.magisk"
#define MAGISKTMP "/sbin/.magisk"
#define MIRRDIR MAGISKTMP "/mirror"
#define MIRRDIR MAGISKTMP "/mirror"
#define BLOCKDIR MAGISKTMP "/block"
#define BBPATH MAGISKTMP "/busybox"
#define BBPATH MAGISKTMP "/busybox"
#define MODULEMNT MAGISKTMP "/modules"
#define MODULEMNT MAGISKTMP "/modules"
#define SECURE_DIR "/data/adb"
#define SECURE_DIR "/data/adb"
...
...
native/jni/magiskhide/proc_monitor.cpp
View file @
dab32e15
...
@@ -28,10 +28,6 @@
...
@@ -28,10 +28,6 @@
using
namespace
std
;
using
namespace
std
;
extern
char
*
system_block
;
extern
char
*
vendor_block
;
extern
char
*
data_block
;
static
int
inotify_fd
=
-
1
;
static
int
inotify_fd
=
-
1
;
static
void
term_thread
(
int
sig
=
SIGTERMTHRD
);
static
void
term_thread
(
int
sig
=
SIGTERMTHRD
);
...
@@ -202,11 +198,9 @@ static void hide_daemon(int pid) {
...
@@ -202,11 +198,9 @@ static void hide_daemon(int pid) {
lazy_unmount
(
s
.
data
());
lazy_unmount
(
s
.
data
());
targets
.
clear
();
targets
.
clear
();
// Unmount
everything under /system, /vendor, and data
mounts
// Unmount
all Magisk created
mounts
file_readline
(
"/proc/self/mounts"
,
[
&
](
string_view
s
)
->
bool
{
file_readline
(
"/proc/self/mounts"
,
[
&
](
string_view
s
)
->
bool
{
if
((
str_contains
(
s
,
" /system/"
)
||
str_contains
(
s
,
" /vendor/"
))
&&
if
(
str_contains
(
s
,
BLOCKDIR
))
{
(
str_contains
(
s
,
system_block
)
||
str_contains
(
s
,
vendor_block
)
||
str_contains
(
s
,
data_block
)))
{
char
*
path
=
(
char
*
)
s
.
data
();
char
*
path
=
(
char
*
)
s
.
data
();
// Skip first token
// Skip first token
strtok_r
(
nullptr
,
" "
,
&
path
);
strtok_r
(
nullptr
,
" "
,
&
path
);
...
...
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