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
70efddb9
Commit
70efddb9
authored
Mar 09, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use SELinux if necessary in init
parent
f24a5dfd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
init.cpp
native/jni/core/init.cpp
+5
-9
No files found.
native/jni/core/init.cpp
View file @
70efddb9
...
@@ -407,15 +407,9 @@ static void setup_overlay() {
...
@@ -407,15 +407,9 @@ static void setup_overlay() {
// Wait for early-init start
// Wait for early-init start
while
(
access
(
EARLYINIT
,
F_OK
)
!=
0
)
while
(
access
(
EARLYINIT
,
F_OK
)
!=
0
)
usleep
(
10
);
usleep
(
10
);
selinux_builtin_impl
();
setcon
(
"u:r:"
SEPOL_PROC_DOMAIN
":s0"
);
setcon
(
"u:r:"
SEPOL_PROC_DOMAIN
":s0"
);
unlink
(
EARLYINIT
);
unlink
(
EARLYINIT
);
fd
=
open
(
"/dev/null"
,
O_RDWR
);
xdup2
(
fd
,
STDIN_FILENO
);
xdup2
(
fd
,
STDOUT_FILENO
);
xdup2
(
fd
,
STDERR_FILENO
);
// Mount the /sbin tmpfs overlay
// Mount the /sbin tmpfs overlay
xmount
(
"tmpfs"
,
"/sbin"
,
"tmpfs"
,
0
,
nullptr
);
xmount
(
"tmpfs"
,
"/sbin"
,
"tmpfs"
,
0
,
nullptr
);
chmod
(
"/sbin"
,
0755
);
chmod
(
"/sbin"
,
0755
);
...
@@ -423,10 +417,10 @@ static void setup_overlay() {
...
@@ -423,10 +417,10 @@ static void setup_overlay() {
// Dump binaries
// Dump binaries
mkdir
(
MAGISKTMP
,
0755
);
mkdir
(
MAGISKTMP
,
0755
);
fd
=
open
(
MAGISKTMP
"/config"
,
O_WRONLY
|
O_CREAT
,
0000
);
fd
=
x
open
(
MAGISKTMP
"/config"
,
O_WRONLY
|
O_CREAT
,
0000
);
write
(
fd
,
config
,
config_sz
);
write
(
fd
,
config
,
config_sz
);
close
(
fd
);
close
(
fd
);
fd
=
open
(
"/sbin/magiskinit"
,
O_WRONLY
|
O_CREAT
,
0755
);
fd
=
x
open
(
"/sbin/magiskinit"
,
O_WRONLY
|
O_CREAT
,
0755
);
write
(
fd
,
self
,
self_sz
);
write
(
fd
,
self
,
self_sz
);
close
(
fd
);
close
(
fd
);
dump_magisk
(
"/sbin/magisk"
,
0755
);
dump_magisk
(
"/sbin/magisk"
,
0755
);
...
@@ -475,6 +469,7 @@ static void exec_init(char *argv[]) {
...
@@ -475,6 +469,7 @@ static void exec_init(char *argv[]) {
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
umask
(
0
);
umask
(
0
);
no_logging
();
for
(
int
i
=
0
;
init_applet
[
i
];
++
i
)
{
for
(
int
i
=
0
;
init_applet
[
i
];
++
i
)
{
if
(
strcmp
(
basename
(
argv
[
0
]),
init_applet
[
i
])
==
0
)
if
(
strcmp
(
basename
(
argv
[
0
]),
init_applet
[
i
])
==
0
)
...
@@ -593,7 +588,8 @@ int main(int argc, char *argv[]) {
...
@@ -593,7 +588,8 @@ int main(int argc, char *argv[]) {
link_dir
(
sbin
,
root
);
link_dir
(
sbin
,
root
);
setup_init_rc
();
setup_init_rc
();
patch_sepolicy
();
if
(
patch_sepolicy
())
selinux_builtin_impl
();
// Close all file descriptors
// Close all file descriptors
for
(
int
i
=
0
;
i
<
30
;
++
i
)
for
(
int
i
=
0
;
i
<
30
;
++
i
)
...
...
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