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
0783f3d5
Commit
0783f3d5
authored
Mar 13, 2021
by
vvb2060
Committed by
John Wu
Mar 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mount rules dir
close #4006
parent
afe3c2bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
6 deletions
+19
-6
mount.cpp
native/jni/init/mount.cpp
+8
-4
rootdir.cpp
native/jni/init/rootdir.cpp
+2
-2
xwrap.cpp
native/jni/utils/xwrap.cpp
+8
-0
xwrap.hpp
native/jni/utils/xwrap.hpp
+1
-0
No files found.
native/jni/init/mount.cpp
View file @
0783f3d5
...
@@ -234,16 +234,20 @@ void MagiskInit::mount_rules_dir(const char *dev_base, const char *mnt_base) {
...
@@ -234,16 +234,20 @@ void MagiskInit::mount_rules_dir(const char *dev_base, const char *mnt_base) {
goto
cache
;
goto
cache
;
strcpy
(
p
,
"/data/unencrypted"
);
strcpy
(
p
,
"/data/unencrypted"
);
if
(
access
(
path
,
F_OK
)
==
0
)
{
if
(
x
access
(
path
,
F_OK
)
==
0
)
{
// FBE, need to use an unencrypted path
// FBE, need to use an unencrypted path
custom_rules_dir
=
path
+
"/magisk"
s
;
custom_rules_dir
=
path
+
"/magisk"
s
;
}
else
{
}
else
{
// Skip if /data/adb does not exist
// Skip if /data/adb does not exist
strcpy
(
p
,
"/data/adb"
);
strcpy
(
p
,
SECURE_DIR
);
if
(
access
(
path
,
F_OK
)
!=
0
)
if
(
x
access
(
path
,
F_OK
)
!=
0
)
return
;
return
;
strcpy
(
p
,
MODULEROOT
);
if
(
xaccess
(
path
,
F_OK
)
!=
0
)
{
goto
cache
;
}
// Unencrypted, directly use module paths
// Unencrypted, directly use module paths
custom_rules_dir
=
string
(
mnt_base
)
+
MODULEROOT
;
custom_rules_dir
=
string
(
path
)
;
}
}
goto
success
;
goto
success
;
...
...
native/jni/init/rootdir.cpp
View file @
0783f3d5
...
@@ -100,10 +100,10 @@ bool MagiskInit::patch_sepolicy(const char *file) {
...
@@ -100,10 +100,10 @@ bool MagiskInit::patch_sepolicy(const char *file) {
// Custom rules
// Custom rules
if
(
!
custom_rules_dir
.
empty
())
{
if
(
!
custom_rules_dir
.
empty
())
{
if
(
auto
dir
=
open_dir
(
custom_rules_dir
.
data
()))
{
if
(
auto
dir
=
x
open_dir
(
custom_rules_dir
.
data
()))
{
for
(
dirent
*
entry
;
(
entry
=
xreaddir
(
dir
.
get
()));)
{
for
(
dirent
*
entry
;
(
entry
=
xreaddir
(
dir
.
get
()));)
{
auto
rule
=
custom_rules_dir
+
"/"
+
entry
->
d_name
+
"/sepolicy.rule"
;
auto
rule
=
custom_rules_dir
+
"/"
+
entry
->
d_name
+
"/sepolicy.rule"
;
if
(
access
(
rule
.
data
(),
R_OK
)
==
0
)
{
if
(
x
access
(
rule
.
data
(),
R_OK
)
==
0
)
{
LOGD
(
"Loading custom sepolicy patch: [%s]
\n
"
,
rule
.
data
());
LOGD
(
"Loading custom sepolicy patch: [%s]
\n
"
,
rule
.
data
());
sepol
->
load_rule_file
(
rule
.
data
());
sepol
->
load_rule_file
(
rule
.
data
());
}
}
...
...
native/jni/utils/xwrap.cpp
View file @
0783f3d5
...
@@ -272,6 +272,14 @@ int xpthread_create(pthread_t *thread, const pthread_attr_t *attr,
...
@@ -272,6 +272,14 @@ int xpthread_create(pthread_t *thread, const pthread_attr_t *attr,
return
errno
;
return
errno
;
}
}
int
xaccess
(
const
char
*
path
,
int
mode
)
{
int
ret
=
access
(
path
,
mode
);
if
(
ret
<
0
)
{
PLOGE
(
"access %s"
,
path
);
}
return
ret
;
}
int
xstat
(
const
char
*
pathname
,
struct
stat
*
buf
)
{
int
xstat
(
const
char
*
pathname
,
struct
stat
*
buf
)
{
int
ret
=
stat
(
pathname
,
buf
);
int
ret
=
stat
(
pathname
,
buf
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
...
native/jni/utils/xwrap.hpp
View file @
0783f3d5
...
@@ -33,6 +33,7 @@ ssize_t xsendmsg(int sockfd, const struct msghdr *msg, int flags);
...
@@ -33,6 +33,7 @@ ssize_t xsendmsg(int sockfd, const struct msghdr *msg, int flags);
ssize_t
xrecvmsg
(
int
sockfd
,
struct
msghdr
*
msg
,
int
flags
);
ssize_t
xrecvmsg
(
int
sockfd
,
struct
msghdr
*
msg
,
int
flags
);
int
xpthread_create
(
pthread_t
*
thread
,
const
pthread_attr_t
*
attr
,
int
xpthread_create
(
pthread_t
*
thread
,
const
pthread_attr_t
*
attr
,
void
*
(
*
start_routine
)
(
void
*
),
void
*
arg
);
void
*
(
*
start_routine
)
(
void
*
),
void
*
arg
);
int
xaccess
(
const
char
*
path
,
int
mode
);
int
xstat
(
const
char
*
pathname
,
struct
stat
*
buf
);
int
xstat
(
const
char
*
pathname
,
struct
stat
*
buf
);
int
xlstat
(
const
char
*
pathname
,
struct
stat
*
buf
);
int
xlstat
(
const
char
*
pathname
,
struct
stat
*
buf
);
int
xfstat
(
int
fd
,
struct
stat
*
buf
);
int
xfstat
(
int
fd
,
struct
stat
*
buf
);
...
...
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