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
03c80798
Commit
03c80798
authored
Mar 29, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --magisk option
parent
0cfc5273
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
magiskpolicy.h
magiskpolicy.h
+1
-1
main.c
main.c
+15
-6
rules.c
rules.c
+1
-1
No files found.
magiskpolicy.h
View file @
03c80798
...
@@ -63,7 +63,7 @@ void vec_push_back(vector *v, char* s);
...
@@ -63,7 +63,7 @@ void vec_push_back(vector *v, char* s);
void
vec_destroy
(
vector
*
v
);
void
vec_destroy
(
vector
*
v
);
// Built in rules
// Built in rules
void
su
_rules
();
void
full
_rules
();
void
min_rules
();
void
min_rules
();
#endif
#endif
main.c
View file @
03c80798
...
@@ -34,9 +34,16 @@ static void statements() {
...
@@ -34,9 +34,16 @@ static void statements() {
}
}
static
void
usage
(
char
*
arg0
)
{
static
void
usage
(
char
*
arg0
)
{
fprintf
(
stderr
,
"%s [--live] [--minimal] [--load <infile>] [--save <outfile>] [policystatement...]
\n\n
"
,
arg0
);
fprintf
(
stderr
,
fprintf
(
stderr
,
" --live: directly load patched policy to device
\n
"
);
"%s [--options...] [policystatements...]
\n\n
"
fprintf
(
stderr
,
" --minimal: minimal patches for boot image to let Magisk live patch on boot
\n
"
);
"Options:
\n
"
" --live: directly load patched policy to device
\n
"
" --magisk: complete (very large!) patches for Magisk and MagiskSU
\n
"
" --minimal: minimal patches, used for boot image patches
\n
"
" --load <infile>: load policies from <infile>
\n
"
" (load from current policies if not specified)"
" --save <outfile>: save policies to <outfile>
\n
"
,
arg0
);
statements
();
statements
();
exit
(
1
);
exit
(
1
);
}
}
...
@@ -248,7 +255,7 @@ static void syntax_error_msg() {
...
@@ -248,7 +255,7 @@ static void syntax_error_msg() {
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
char
*
infile
=
NULL
,
*
outfile
=
NULL
,
*
tok
,
*
saveptr
;
char
*
infile
=
NULL
,
*
outfile
=
NULL
,
*
tok
,
*
saveptr
;
int
live
=
0
,
minimal
=
0
;
int
live
=
0
,
minimal
=
0
,
full
=
0
;
struct
vector
rules
;
struct
vector
rules
;
vec_init
(
&
rules
);
vec_init
(
&
rules
);
...
@@ -258,6 +265,8 @@ int main(int argc, char *argv[]) {
...
@@ -258,6 +265,8 @@ int main(int argc, char *argv[]) {
if
(
argv
[
i
][
0
]
==
'-'
&&
argv
[
i
][
1
]
==
'-'
)
{
if
(
argv
[
i
][
0
]
==
'-'
&&
argv
[
i
][
1
]
==
'-'
)
{
if
(
strcmp
(
argv
[
i
],
"--live"
)
==
0
)
if
(
strcmp
(
argv
[
i
],
"--live"
)
==
0
)
live
=
1
;
live
=
1
;
else
if
(
strcmp
(
argv
[
i
],
"--magisk"
)
==
0
)
full
=
1
;
else
if
(
strcmp
(
argv
[
i
],
"--minimal"
)
==
0
)
else
if
(
strcmp
(
argv
[
i
],
"--minimal"
)
==
0
)
minimal
=
1
;
minimal
=
1
;
else
if
(
strcmp
(
argv
[
i
],
"--load"
)
==
0
)
{
else
if
(
strcmp
(
argv
[
i
],
"--load"
)
==
0
)
{
...
@@ -294,8 +303,8 @@ int main(int argc, char *argv[]) {
...
@@ -294,8 +303,8 @@ int main(int argc, char *argv[]) {
if
(
policydb_load_isids
(
&
policydb
,
&
sidtab
))
if
(
policydb_load_isids
(
&
policydb
,
&
sidtab
))
return
1
;
return
1
;
if
(
!
minimal
&&
rules
.
size
==
0
)
su
_rules
();
if
(
full
)
full
_rules
();
if
(
minimal
)
min_rules
();
else
if
(
minimal
)
min_rules
();
for
(
int
i
=
0
;
i
<
rules
.
size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
rules
.
size
;
++
i
)
{
// Since strtok will modify the origin string, copy the policy for error messages
// Since strtok will modify the origin string, copy the policy for error messages
...
...
rules.c
View file @
03c80798
...
@@ -129,7 +129,7 @@ void otherToSU() {
...
@@ -129,7 +129,7 @@ void otherToSU() {
allow
(
"audioserver"
,
"audioserver"
,
"process"
,
"execmem"
);
allow
(
"audioserver"
,
"audioserver"
,
"process"
,
"execmem"
);
}
}
void
su
_rules
()
{
void
full
_rules
()
{
// Samsung specific
// Samsung specific
// Prevent system from loading policy
// Prevent system from loading policy
if
(
exists
(
"knox_system_app"
))
if
(
exists
(
"knox_system_app"
))
...
...
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