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
b4099fc5
Commit
b4099fc5
authored
Apr 06, 2022
by
石松洲
Committed by
John Wu
Apr 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support sepolicy.unlocked
Fix topjohnwu#4914
parent
ff2513e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
init.hpp
native/jni/init/init.hpp
+1
-1
rootdir.cpp
native/jni/init/rootdir.cpp
+6
-3
selinux.cpp
native/jni/init/selinux.cpp
+4
-4
No files found.
native/jni/init/init.hpp
View file @
b4099fc5
...
@@ -65,7 +65,7 @@ protected:
...
@@ -65,7 +65,7 @@ protected:
bool
avd_hack
=
false
;
bool
avd_hack
=
false
;
#endif
#endif
void
patch_sepolicy
(
const
char
*
file
);
void
patch_sepolicy
(
const
char
*
in
,
const
char
*
out
);
bool
hijack_sepolicy
();
bool
hijack_sepolicy
();
void
setup_tmp
(
const
char
*
path
);
void
setup_tmp
(
const
char
*
path
);
void
patch_rw_root
();
void
patch_rw_root
();
...
...
native/jni/init/rootdir.cpp
View file @
b4099fc5
...
@@ -242,8 +242,11 @@ void SARBase::patch_ro_root() {
...
@@ -242,8 +242,11 @@ void SARBase::patch_ro_root() {
// Extract magisk
// Extract magisk
extract_files
(
false
);
extract_files
(
false
);
if
((
access
(
SPLIT_PLAT_CIL
,
F_OK
)
!=
0
&&
access
(
"/sepolicy"
,
F_OK
)
==
0
)
||
!
hijack_sepolicy
())
{
// Oculus Go will use a special sepolicy if unlocked
patch_sepolicy
(
ROOTOVL
"/sepolicy"
);
if
(
access
(
"/sepolicy.unlocked"
,
F_OK
)
==
0
)
{
patch_sepolicy
(
"/sepolicy.unlocked"
,
ROOTOVL
"/sepolicy.unlocked"
);
}
else
if
((
access
(
SPLIT_PLAT_CIL
,
F_OK
)
!=
0
&&
access
(
"/sepolicy"
,
F_OK
)
==
0
)
||
!
hijack_sepolicy
())
{
patch_sepolicy
(
"/sepolicy"
,
ROOTOVL
"/sepolicy"
);
}
}
// Mount rootdir
// Mount rootdir
...
@@ -297,7 +300,7 @@ void MagiskInit::patch_rw_root() {
...
@@ -297,7 +300,7 @@ void MagiskInit::patch_rw_root() {
extract_files
(
true
);
extract_files
(
true
);
if
((
!
treble
&&
access
(
"/sepolicy"
,
F_OK
)
==
0
)
||
!
hijack_sepolicy
())
{
if
((
!
treble
&&
access
(
"/sepolicy"
,
F_OK
)
==
0
)
||
!
hijack_sepolicy
())
{
patch_sepolicy
(
"/sepolicy"
);
patch_sepolicy
(
"/sepolicy"
,
"/sepolicy"
);
}
}
chdir
(
"/"
);
chdir
(
"/"
);
...
...
native/jni/init/selinux.cpp
View file @
b4099fc5
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
using
namespace
std
;
using
namespace
std
;
void
MagiskInit
::
patch_sepolicy
(
const
char
*
file
)
{
void
MagiskInit
::
patch_sepolicy
(
const
char
*
in
,
const
char
*
out
)
{
LOGD
(
"Patching monolithic policy
\n
"
);
LOGD
(
"Patching monolithic policy
\n
"
);
auto
sepol
=
unique_ptr
<
sepolicy
>
(
sepolicy
::
from_file
(
"/sepolicy"
));
auto
sepol
=
unique_ptr
<
sepolicy
>
(
sepolicy
::
from_file
(
in
));
sepol
->
magisk_rules
();
sepol
->
magisk_rules
();
...
@@ -27,8 +27,8 @@ void MagiskInit::patch_sepolicy(const char *file) {
...
@@ -27,8 +27,8 @@ void MagiskInit::patch_sepolicy(const char *file) {
}
}
}
}
LOGD
(
"Dumping sepolicy to: [%s]
\n
"
,
file
);
LOGD
(
"Dumping sepolicy to: [%s]
\n
"
,
out
);
sepol
->
to_file
(
file
);
sepol
->
to_file
(
out
);
// Remove OnePlus stupid debug sepolicy and use our own
// Remove OnePlus stupid debug sepolicy and use our own
if
(
access
(
"/sepolicy_debug"
,
F_OK
)
==
0
)
{
if
(
access
(
"/sepolicy_debug"
,
F_OK
)
==
0
)
{
...
...
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