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
ca75dd07
Commit
ca75dd07
authored
Mar 18, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename project
parent
9f35fa0f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
31 deletions
+33
-31
Android.mk
Android.mk
+1
-1
magiskpolicy.h
magiskpolicy.h
+2
-2
main.c
main.c
+27
-25
rules.c
rules.c
+1
-1
sepolicy.c
sepolicy.c
+1
-1
utils.c
utils.c
+1
-1
No files found.
Android.mk
View file @
ca75dd07
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_MODULE :=
sepolicy-inject
LOCAL_MODULE :=
magiskpolicy
LOCAL_STATIC_LIBRARIES := libsepol
LOCAL_STATIC_LIBRARIES := libsepol
LOCAL_SRC_FILES := main.c sepolicy.c rules.c utils.c
LOCAL_SRC_FILES := main.c sepolicy.c rules.c utils.c
LOCAL_C_INCLUDES := jni/selinux/libsepol/include/
LOCAL_C_INCLUDES := jni/selinux/libsepol/include/
...
...
sepolicy-inject
.h
→
magiskpolicy
.h
View file @
ca75dd07
#ifndef
SEPOLICY_INJECT
_H
#ifndef
MAGISKPOLICY
_H
#define
SEPOLICY_INJECT
_H
#define
MAGISKPOLICY
_H
#define ALL NULL
#define ALL NULL
...
...
main.c
View file @
ca75dd07
#include "
sepolicy-inject
.h"
#include "
magiskpolicy
.h"
static
int
syntax_err
=
0
;
static
int
syntax_err
=
0
;
static
char
err_msg
[
ARG_MAX
];
static
char
err_msg
[
ARG_MAX
];
static
void
statements
()
{
static
void
statements
()
{
fprintf
(
stderr
,
"
\n
Supported policy statements:
\n\n
"
);
fprintf
(
stderr
,
"
\"
allow #source-class #target-class permission-class #permission
\"\n
"
);
fprintf
(
stderr
,
"
\"
deny #source-class #target-class permission-class #permission
\"\n
"
);
fprintf
(
stderr
,
"
\"
auditallow #source-class #target-class permission-class #permission
\"\n
"
);
fprintf
(
stderr
,
"
\"
auditdeny #source-class #target-class permission-class #permission
\"\n
"
);
fprintf
(
stderr
,
"
\"
create #class
\"\n
"
);
fprintf
(
stderr
,
"
\"
permissive #class
\"\n
"
);
fprintf
(
stderr
,
"
\"
enforcing #class
\"\n
"
);
fprintf
(
stderr
,
"
\"
attradd #class #attribute
\"\n
"
);
fprintf
(
stderr
,
"
\"
typetrans source-class target-class permission-class default-class (optional: object-name)
\"\n
"
);
fprintf
(
stderr
,
"
\n
source-class and target-class can be attributes (patches the whole group)
\n
"
);
fprintf
(
stderr
,
"All sections (except typetrans) can be replaced with
\'
*
\'
to patch every possible matches
\n
"
);
fprintf
(
stderr
,
"Sections marked with
\'
#
\'
can be replaced with collections in curly brackets
\n
"
);
fprintf
(
stderr
,
"e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }
\n
"
);
fprintf
(
stderr
,
"Will be expanded to:
\n
"
);
fprintf
(
stderr
,
fprintf
(
stderr
,
"allow source1 target1 permission-class permission1
\n
\
"
\n
Supported policy statements:
\n
"
allow source1 target1 permission-class permission2
\n
\
"
\n
"
allow source1 target2 permission-class permission1
\n
\
"
\"
allow #source-class #target-class permission-class #permission
\"\n
"
allow source1 target2 permission-class permission2
\n
\
"
\"
deny #source-class #target-class permission-class #permission
\"\n
"
allow source2 target1 permission-class permission1
\n
\
"
\"
auditallow #source-class #target-class permission-class #permission
\"\n
"
allow source2 target1 permission-class permission2
\n
\
"
\"
auditdeny #source-class #target-class permission-class #permission
\"\n
"
allow source2 target2 permission-class permission1
\n
\
"
\"
create #class
\"\n
"
allow source2 target2 permission-class permission2
\n
"
);
"
\"
permissive #class
\"\n
"
fprintf
(
stderr
,
"
\n
"
);
"
\"
enforcing #class
\"\n
"
"
\"
attradd #class #attribute
\"\n
"
"
\"
typetrans source-class target-class permission-class default-class (optional: object-name)
\"\n
"
"
\n
source-class and target-class can be attributes (patches the whole group)
\n
"
"All sections (except typetrans) can be replaced with
\'
*
\'
to patch every possible matches
\n
"
"Sections marked with
\'
#
\'
can be replaced with collections in curly brackets
\n
"
"e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }
\n
"
"Will be expanded to:
\n
"
"allow source1 target1 permission-class permission1
\n
"
"allow source1 target1 permission-class permission2
\n
"
"allow source1 target2 permission-class permission1
\n
"
"allow source1 target2 permission-class permission2
\n
"
"allow source2 target1 permission-class permission1
\n
"
"allow source2 target1 permission-class permission2
\n
"
"allow source2 target2 permission-class permission1
\n
"
"allow source2 target2 permission-class permission2
\n
"
"
\n
"
);
}
}
static
void
usage
(
char
*
arg0
)
{
static
void
usage
(
char
*
arg0
)
{
...
...
rules.c
View file @
ca75dd07
#include "
sepolicy-inject
.h"
#include "
magiskpolicy
.h"
void
samsung
()
{
void
samsung
()
{
deny
(
"init"
,
"kernel"
,
"security"
,
"load_policy"
);
deny
(
"init"
,
"kernel"
,
"security"
,
"load_policy"
);
...
...
sepolicy.c
View file @
ca75dd07
#include "
sepolicy-inject
.h"
#include "
magiskpolicy
.h"
static
void
*
cmalloc
(
size_t
s
)
{
static
void
*
cmalloc
(
size_t
s
)
{
void
*
t
=
malloc
(
s
);
void
*
t
=
malloc
(
s
);
...
...
utils.c
View file @
ca75dd07
#include "
sepolicy-inject
.h"
#include "
magiskpolicy
.h"
void
vec_init
(
vector
*
v
)
{
void
vec_init
(
vector
*
v
)
{
v
->
size
=
0
;
v
->
size
=
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