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
fe644e10
Commit
fe644e10
authored
Sep 17, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure post-fs-data is first ran
Close #1601
parent
f383d11d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
bootstages.cpp
native/jni/core/bootstages.cpp
+8
-0
daemon.cpp
native/jni/core/daemon.cpp
+3
-3
No files found.
native/jni/core/bootstages.cpp
View file @
fe644e10
...
...
@@ -22,6 +22,7 @@ using namespace std;
static
char
buf
[
PATH_MAX
],
buf2
[
PATH_MAX
];
static
vector
<
string
>
module_list
;
static
bool
no_secure_dir
=
false
;
static
bool
pfs_done
=
false
;
static
int
bind_mount
(
const
char
*
from
,
const
char
*
to
,
bool
log
=
true
);
extern
void
auto_start_magiskhide
();
...
...
@@ -600,6 +601,7 @@ static void dump_logs() {
}
[[
noreturn
]]
static
void
core_only
()
{
pfs_done
=
true
;
auto_start_magiskhide
();
unblock_boot_process
();
}
...
...
@@ -714,6 +716,9 @@ void late_start(int client) {
reboot
();
}
if
(
!
pfs_done
)
return
;
if
(
access
(
BBPATH
,
F_OK
)
!=
0
){
LOGE
(
"* post-fs-data mode is not triggered
\n
"
);
unlock_blocks
();
...
...
@@ -745,6 +750,9 @@ void boot_complete(int client) {
write_int
(
client
,
0
);
close
(
client
);
if
(
!
pfs_done
)
return
;
if
(
access
(
MANAGERAPK
,
F_OK
)
==
0
)
{
// Install Magisk Manager if exists
rename
(
MANAGERAPK
,
"/data/magisk.apk"
);
...
...
native/jni/core/daemon.cpp
View file @
fe644e10
...
...
@@ -18,14 +18,14 @@
int
SDK_INT
=
-
1
;
bool
RECOVERY_MODE
=
false
;
static
struct
stat
SERVER_STAT
;
static
struct
stat
self_st
;
static
void
verify_client
(
int
client
,
pid_t
pid
)
{
// Verify caller is the same as server
char
path
[
32
];
sprintf
(
path
,
"/proc/%d/exe"
,
pid
);
struct
stat
st
;
if
(
stat
(
path
,
&
st
)
||
st
.
st_dev
!=
SERVER_STAT
.
st_dev
||
st
.
st_ino
!=
SERVER_STAT
.
st_ino
)
{
if
(
stat
(
path
,
&
st
)
||
st
.
st_dev
!=
self_st
.
st_dev
||
st
.
st_ino
!=
self_st
.
st_ino
)
{
close
(
client
);
pthread_exit
(
nullptr
);
}
...
...
@@ -137,7 +137,7 @@ static void main_daemon() {
LOGI
(
SHOW_VER
(
Magisk
)
" daemon started
\n
"
);
// Get server stat
stat
(
"/proc/self/exe"
,
&
SERVER_STAT
);
stat
(
"/proc/self/exe"
,
&
self_st
);
// Get API level
parse_prop_file
(
"/system/build.prop"
,
[](
auto
key
,
auto
val
)
->
bool
{
...
...
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