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
4c7e081e
Commit
4c7e081e
authored
Jul 13, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate the chance to segfault on older Android versions
parent
5529dab8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
rules.c
rules.c
+1
-1
sepolicy.c
sepolicy.c
+10
-10
No files found.
rules.c
View file @
4c7e081e
...
@@ -232,7 +232,7 @@ void sepol_min_rules() {
...
@@ -232,7 +232,7 @@ void sepol_min_rules() {
sepol_allow
(
"system_server"
,
"dex2oat_exec"
,
"file"
,
ALL
);
sepol_allow
(
"system_server"
,
"dex2oat_exec"
,
"file"
,
ALL
);
// xperms
// xperms
if
(
policydb
->
policyvers
>=
30
)
if
(
policydb
->
policyvers
>=
POLICYDB_VERSION_XPERMS_IOCTL
)
sepol_allowxperm
(
"domain"
,
"devpts"
,
"chr_file"
,
"0x5400-0x54FF"
);
sepol_allowxperm
(
"domain"
,
"devpts"
,
"chr_file"
,
"0x5400-0x54FF"
);
}
}
...
...
sepolicy.c
View file @
4c7e081e
...
@@ -255,7 +255,7 @@ int dump_policydb(const char *filename) {
...
@@ -255,7 +255,7 @@ int dump_policydb(const char *filename) {
return
1
;
return
1
;
}
}
fd
=
open
(
filename
,
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IROTH
);
fd
=
open
(
filename
,
O_RDWR
|
O_CREAT
,
0644
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
fprintf
(
stderr
,
"Can't open '%s': %s
\n
"
,
fprintf
(
stderr
,
"Can't open '%s': %s
\n
"
,
filename
,
strerror
(
errno
));
filename
,
strerror
(
errno
));
...
@@ -290,7 +290,7 @@ int create_domain(char *d) {
...
@@ -290,7 +290,7 @@ int create_domain(char *d) {
typedatum
->
flavor
=
TYPE_TYPE
;
typedatum
->
flavor
=
TYPE_TYPE
;
uint32_t
value
=
0
;
uint32_t
value
=
0
;
int
r
=
symtab_insert
(
policydb
,
SYM_TYPES
,
strdup
(
d
),
typedatum
,
SCOPE_DECL
,
1
,
&
value
);
symtab_insert
(
policydb
,
SYM_TYPES
,
strdup
(
d
),
typedatum
,
SCOPE_DECL
,
1
,
&
value
);
typedatum
->
s
.
value
=
value
;
typedatum
->
s
.
value
=
value
;
if
(
ebitmap_set_bit
(
&
policydb
->
global
->
branch_list
->
declared
.
scope
[
SYM_TYPES
],
value
-
1
,
1
))
{
if
(
ebitmap_set_bit
(
&
policydb
->
global
->
branch_list
->
declared
.
scope
[
SYM_TYPES
],
value
-
1
,
1
))
{
...
@@ -303,14 +303,6 @@ int create_domain(char *d) {
...
@@ -303,14 +303,6 @@ int create_domain(char *d) {
ebitmap_init
(
&
policydb
->
attr_type_map
[
value
-
1
]);
ebitmap_init
(
&
policydb
->
attr_type_map
[
value
-
1
]);
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
value
-
1
,
1
);
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
value
-
1
,
1
);
//Add the domain to all roles
for
(
unsigned
i
=
0
;
i
<
policydb
->
p_roles
.
nprim
;
++
i
)
{
//Not sure all those three calls are needed
ebitmap_set_bit
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
.
negset
,
value
-
1
,
0
);
ebitmap_set_bit
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
.
types
,
value
-
1
,
1
);
type_set_expand
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
,
&
policydb
->
role_val_to_struct
[
i
]
->
cache
,
policydb
,
0
);
}
src
=
hashtab_search
(
policydb
->
p_types
.
table
,
d
);
src
=
hashtab_search
(
policydb
->
p_types
.
table
,
d
);
if
(
!
src
)
if
(
!
src
)
return
1
;
return
1
;
...
@@ -324,6 +316,14 @@ int create_domain(char *d) {
...
@@ -324,6 +316,14 @@ int create_domain(char *d) {
if
(
policydb_index_others
(
NULL
,
policydb
,
0
))
if
(
policydb_index_others
(
NULL
,
policydb
,
0
))
return
1
;
return
1
;
//Add the domain to all roles
for
(
unsigned
i
=
0
;
i
<
policydb
->
p_roles
.
nprim
;
++
i
)
{
//Not sure all those three calls are needed
ebitmap_set_bit
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
.
negset
,
value
-
1
,
0
);
ebitmap_set_bit
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
.
types
,
value
-
1
,
1
);
type_set_expand
(
&
policydb
->
role_val_to_struct
[
i
]
->
types
,
&
policydb
->
role_val_to_struct
[
i
]
->
cache
,
policydb
,
0
);
}
return
set_attr
(
"domain"
,
value
);
return
set_attr
(
"domain"
,
value
);
}
}
...
...
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