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
17f0fea3
Commit
17f0fea3
authored
Dec 15, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unreleased resource in rootfs
parent
8ca1e435
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
bootstages.c
core/jni/core/bootstages.c
+2
-2
daemon.c
core/jni/core/daemon.c
+8
-7
magiskinit.c
core/jni/core/magiskinit.c
+10
-0
proc_monitor.c
core/jni/magiskhide/proc_monitor.c
+1
-0
No files found.
core/jni/core/bootstages.c
View file @
17f0fea3
...
...
@@ -410,8 +410,6 @@ static int prepare_img() {
if
(
magiskloop
==
NULL
)
return
1
;
vec_init
(
&
module_list
);
xmkdir
(
COREDIR
,
0755
);
xmkdir
(
COREDIR
"/post-fs-data.d"
,
0755
);
xmkdir
(
COREDIR
"/service.d"
,
0755
);
...
...
@@ -506,6 +504,7 @@ void post_fs_data(int client) {
// Allocate buffer
if
(
buf
==
NULL
)
buf
=
xmalloc
(
PATH_MAX
);
if
(
buf2
==
NULL
)
buf2
=
xmalloc
(
PATH_MAX
);
vec_init
(
&
module_list
);
// Initialize
if
(
!
is_daemon_init
)
...
...
@@ -627,6 +626,7 @@ void late_start(int client) {
// Wait till the full patch is done
wait_till_exists
(
PATCHDONE
);
unlink
(
PATCHDONE
);
// Run scripts after full patch, most reliable way to run scripts
LOGI
(
"* Running service.d scripts
\n
"
);
...
...
core/jni/core/daemon.c
View file @
17f0fea3
...
...
@@ -127,6 +127,7 @@ void daemon_init() {
rm_rf
(
"/data/magisk"
);
unlink
(
"/data/magisk.img"
);
unlink
(
"/data/magisk_debug.log"
);
chmod
(
"/data/adb"
,
0700
);
// Use shell glob to match files
exec_command_sync
(
"sh"
,
"-c"
,
...
...
@@ -154,13 +155,6 @@ void daemon_init() {
}
close
(
sbin
);
// Backward compatibility
xsymlink
(
DATABIN
,
"/data/magisk"
);
xsymlink
(
MAINIMG
,
"/data/magisk.img"
);
xsymlink
(
MOUNTPOINT
,
"/magisk"
);
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
|
MS_RDONLY
,
NULL
);
xmount
(
"tmpfs"
,
"/sbin"
,
"tmpfs"
,
0
,
NULL
);
chmod
(
"/sbin"
,
0755
);
setfilecon
(
"/sbin"
,
"u:object_r:rootfs:s0"
);
...
...
@@ -181,6 +175,13 @@ void daemon_init() {
}
close
(
root
);
// Backward compatibility
xsymlink
(
DATABIN
,
"/data/magisk"
);
xsymlink
(
MAINIMG
,
"/data/magisk.img"
);
xsymlink
(
MOUNTPOINT
,
"/magisk"
);
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
|
MS_RDONLY
,
NULL
);
LOGI
(
"* Mounting mirrors"
);
struct
vector
mounts
;
vec_init
(
&
mounts
);
...
...
core/jni/core/magiskinit.c
View file @
17f0fea3
...
...
@@ -362,6 +362,12 @@ static void magisk_init_daemon() {
// Wait till init cold boot done
wait_till_exists
(
"/dev/.coldboot_done"
);
int
null
=
open
(
"/dev/null"
,
O_RDWR
|
O_CLOEXEC
);
dup3
(
null
,
STDIN_FILENO
,
O_CLOEXEC
);
dup3
(
null
,
STDOUT_FILENO
,
O_CLOEXEC
);
dup3
(
null
,
STDERR_FILENO
,
O_CLOEXEC
);
close
(
null
);
// Transit our context to su (mimic setcon)
int
fd
,
crap
;
fd
=
open
(
"/proc/self/attr/current"
,
O_WRONLY
);
...
...
@@ -414,6 +420,8 @@ int main(int argc, char *argv[]) {
dup3
(
null
,
STDIN_FILENO
,
O_CLOEXEC
);
dup3
(
null
,
STDOUT_FILENO
,
O_CLOEXEC
);
dup3
(
null
,
STDERR_FILENO
,
O_CLOEXEC
);
if
(
null
>
STDERR_FILENO
)
close
(
null
);
// Extract and link files
mkdir
(
"/overlay"
,
0000
);
...
...
@@ -504,6 +512,8 @@ int main(int argc, char *argv[]) {
if
(
fork_dont_care
()
==
0
)
{
strcpy
(
argv
[
0
],
"magiskinit"
);
close
(
overlay
);
close
(
root
);
magisk_init_daemon
();
}
}
...
...
core/jni/magiskhide/proc_monitor.c
View file @
17f0fea3
...
...
@@ -76,6 +76,7 @@ static void lazy_unmount(const char* mountpoint) {
static
void
hide_daemon
(
int
pid
,
int
ppid
)
{
LOGD
(
"hide_daemon: start unmount for pid=[%d]
\n
"
,
pid
);
strcpy
(
argv0
,
"hide_daemon"
);
char
*
line
,
buffer
[
PATH_MAX
];
struct
vector
mount_list
;
...
...
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