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
945f8810
Commit
945f8810
authored
Mar 18, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support system-as-root devices with monolithic sepolicy
parent
957feca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
init.cpp
native/jni/core/init.cpp
+9
-2
No files found.
native/jni/core/init.cpp
View file @
945f8810
...
...
@@ -354,6 +354,10 @@ void MagiskInit::early_mount() {
if
(
is_lnk
(
"/system_root/init"
))
load_sepol
=
true
;
// System-as-root with monolithic sepolicy
if
(
access
(
"/system_root/sepolicy"
,
F_OK
)
==
0
)
cp_afc
(
"/system_root/sepolicy"
,
"/sepolicy"
);
// Copy if these partitions are symlinks
link_root
(
"/vendor"
);
link_root
(
"/product"
);
...
...
@@ -380,6 +384,9 @@ void MagiskInit::setup_rootfs() {
excl_list
=
nullptr
;
}
// Override /sepolicy if exist
rename
(
"/magisk_sepolicy"
,
"/sepolicy"
);
if
(
patch_init
)
{
constexpr
char
SYSTEM_INIT
[]
=
"/system/bin/init"
;
// If init is symlink, copy it to rootfs so we can patch
...
...
@@ -452,7 +459,7 @@ bool MagiskInit::patch_sepolicy() {
sepol_magisk_rules
();
sepol_allow
(
SEPOL_PROC_DOMAIN
,
ALL
,
ALL
,
ALL
);
dump_policydb
(
"/sepolicy"
);
dump_policydb
(
"/
magisk_
sepolicy"
);
// Load policy to kernel so we can label rootfs
if
(
load_sepol
)
...
...
@@ -461,7 +468,7 @@ bool MagiskInit::patch_sepolicy() {
// Remove OnePlus stupid debug sepolicy and use our own
if
(
access
(
"/sepolicy_debug"
,
F_OK
)
==
0
)
{
unlink
(
"/sepolicy_debug"
);
link
(
"/sepolicy"
,
"/sepolicy_debug"
);
link
(
"/
magisk_
sepolicy"
,
"/sepolicy_debug"
);
}
// Enable selinux functions
...
...
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