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
be1dcb72
Commit
be1dcb72
authored
Nov 02, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update built-in rules
parent
3a0df566
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
41 deletions
+45
-41
builtin_rules.c
builtin_rules.c
+45
-41
No files found.
builtin_rules.c
View file @
be1dcb72
...
@@ -282,6 +282,10 @@ void otherToSU() {
...
@@ -282,6 +282,10 @@ void otherToSU() {
allow
(
"surfaceflinger"
,
"app_data_file"
,
"file"
,
ALL
);
allow
(
"surfaceflinger"
,
"app_data_file"
,
"file"
,
ALL
);
allow
(
"surfaceflinger"
,
"app_data_file"
,
"lnk_file"
,
ALL
);
allow
(
"surfaceflinger"
,
"app_data_file"
,
"lnk_file"
,
ALL
);
add_type
(
"surfaceflinger"
,
"mlstrustedsubject"
,
policy
);
add_type
(
"surfaceflinger"
,
"mlstrustedsubject"
,
policy
);
// suMiscL6
if
(
exists
(
"audioserver"
))
allow
(
"audioserver"
,
"audioserver"
,
"process"
,
"execmem"
);
}
}
void
phh_rules
(
policydb_t
*
policydb
)
{
void
phh_rules
(
policydb_t
*
policydb
)
{
...
@@ -289,9 +293,8 @@ void phh_rules(policydb_t *policydb) {
...
@@ -289,9 +293,8 @@ void phh_rules(policydb_t *policydb) {
// Samsung specific
// Samsung specific
// Prevent system from loading policy
// Prevent system from loading policy
if
(
exists
(
"knox_system_app"
))
{
if
(
exists
(
"knox_system_app"
))
samsung
();
samsung
();
}
// Create domains if they don't exist
// Create domains if they don't exist
setPermissive
(
"su"
,
1
);
setPermissive
(
"su"
,
1
);
...
@@ -309,10 +312,11 @@ void phh_rules(policydb_t *policydb) {
...
@@ -309,10 +312,11 @@ void phh_rules(policydb_t *policydb) {
allowSuClient
(
"system_app"
);
allowSuClient
(
"system_app"
);
allowSuClient
(
"platform_app"
);
allowSuClient
(
"platform_app"
);
allowSuClient
(
"su"
);
allowSuClient
(
"su"
);
if
(
exists
(
"priv_app"
))
allowSuClient
(
"priv_app"
);
if
(
exists
(
"ssd_tool"
))
{
if
(
exists
(
"ssd_tool"
))
allowSuClient
(
"ssd_tool"
);
allowSuClient
(
"ssd_tool"
);
}
// Allow init to execute su daemon/transition
// Allow init to execute su daemon/transition
allow
(
"init"
,
"su_daemon"
,
"process"
,
"transition"
);
allow
(
"init"
,
"su_daemon"
,
"process"
,
"transition"
);
...
@@ -330,6 +334,7 @@ void phh_rules(policydb_t *policydb) {
...
@@ -330,6 +334,7 @@ void phh_rules(policydb_t *policydb) {
add_type
(
"su"
,
"mlstrustedsubject"
,
policy
);
add_type
(
"su"
,
"mlstrustedsubject"
,
policy
);
}
}
// Minimal to run Magisk script before live patching
void
magisk_rules
(
policydb_t
*
policydb
)
{
void
magisk_rules
(
policydb_t
*
policydb
)
{
policy
=
policydb
;
policy
=
policydb
;
...
@@ -338,12 +343,12 @@ void magisk_rules(policydb_t *policydb) {
...
@@ -338,12 +343,12 @@ void magisk_rules(policydb_t *policydb) {
add_type
(
"su"
,
"mlstrustedsubject"
,
policy
);
add_type
(
"su"
,
"mlstrustedsubject"
,
policy
);
// Minimal to run Magisk script before live patching
allow
(
"kernel"
,
"su"
,
"fd"
,
"use"
);
allow
(
"kernel"
,
"su"
,
"fd"
,
"use"
);
allow
(
"init"
,
"su"
,
"process"
,
ALL
);
allow
(
"init"
,
"su"
,
"process"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"dir"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"dir"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"lnk_file"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"lnk_file"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"file"
,
ALL
);
allow
(
"init"
,
"system_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"property_socket"
,
"sock_file"
,
"write"
);
allow
(
"su"
,
"property_socket"
,
"sock_file"
,
"write"
);
allow
(
"su"
,
"shell_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"shell_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"init"
,
"unix_stream_socket"
,
"connectto"
);
allow
(
"su"
,
"init"
,
"unix_stream_socket"
,
"connectto"
);
...
@@ -355,50 +360,29 @@ void magisk_rules(policydb_t *policydb) {
...
@@ -355,50 +360,29 @@ void magisk_rules(policydb_t *policydb) {
allow
(
"su"
,
"su"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"su"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"su"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"su"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"su"
,
"dir"
,
ALL
);
allow
(
"su"
,
"su"
,
"dir"
,
ALL
);
// vold, bootanim, surfaceflinger might require mounts in multirom
allow
(
"su"
,
"vold_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"bootanim_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"surfaceflinger_exec"
,
"file"
,
ALL
);
// Access toolbox/toybox tools
allow
(
"su"
,
"toolbox_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"toolbox_exec"
,
"lnk_file"
,
ALL
);
// For /dev
allow
(
"su"
,
"device"
,
"file"
,
ALL
);
allow
(
"su"
,
"device"
,
"file"
,
ALL
);
allow
(
"su"
,
"device"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"device"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"device"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"device"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"device"
,
"dir"
,
ALL
);
allow
(
"su"
,
"device"
,
"dir"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"fifo_file"
,
ALL
);
// For rootfs
allow
(
"su"
,
"storage_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"dir"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"dir"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"dir"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"dir"
,
ALL
);
allow
(
"su"
,
"rootfs"
,
"dir"
,
ALL
);
allow
(
"su"
,
"toolbox_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"toolbox_exec"
,
"fifo_file"
,
ALL
);
// For system/cache/data files
allow
(
"su"
,
"toolbox_exec"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"toolbox_exec"
,
"dir"
,
ALL
);
allow
(
"su"
,
"zygote_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"zygote_exec"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"zygote_exec"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"zygote_exec"
,
"dir"
,
ALL
);
allow
(
"su"
,
"bootanim_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"bootanim_exec"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"bootanim_exec"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"bootanim_exec"
,
"dir"
,
ALL
);
allow
(
"su"
,
"dex2oat_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"dex2oat_exec"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"dex2oat_exec"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"dex2oat_exec"
,
"dir"
,
ALL
);
allow
(
"su"
,
"fsck_exec"
,
"file"
,
ALL
);
allow
(
"su"
,
"fsck_exec"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"fsck_exec"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"fsck_exec"
,
"dir"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"dir"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"system_file"
,
"lnk_file"
,
ALL
);
...
@@ -407,10 +391,30 @@ void magisk_rules(policydb_t *policydb) {
...
@@ -407,10 +391,30 @@ void magisk_rules(policydb_t *policydb) {
allow
(
"su"
,
"system_data_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"system_data_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"system_data_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"system_data_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"system_data_file"
,
"dir"
,
ALL
);
allow
(
"su"
,
"system_data_file"
,
"dir"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"cache_file"
,
"dir"
,
ALL
);
// For sepolicy live patching
allow
(
"su"
,
"kernel"
,
"security"
,
"read_policy"
);
allow
(
"su"
,
"kernel"
,
"security"
,
"read_policy"
);
allow
(
"su"
,
"kernel"
,
"security"
,
"load_policy"
);
allow
(
"su"
,
"kernel"
,
"security"
,
"load_policy"
);
allow
(
"su"
,
"selinuxfs"
,
"file"
,
ALL
);
allow
(
"su"
,
"selinuxfs"
,
"file"
,
ALL
);
// For detecting current mount status
allow
(
"su"
,
"storage_file"
,
"file"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"storage_file"
,
"dir"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"sysfs"
,
"dir"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"fifo_file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"lnk_file"
,
ALL
);
allow
(
"su"
,
"block_device"
,
"dir"
,
ALL
);
// Xposed
// Xposed
allow
(
"untrusted_app"
,
"untrusted_app"
,
"capability"
,
"setgid"
);
allow
(
"untrusted_app"
,
"untrusted_app"
,
"capability"
,
"setgid"
);
allow
(
"system_server"
,
"dex2oat_exec"
,
"file"
,
ALL
);
allow
(
"system_server"
,
"dex2oat_exec"
,
"file"
,
ALL
);
...
...
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