Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemSEPolicy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemSEPolicy
Commits
1d45b9c2
Commit
1d45b9c2
authored
10 years ago
by
Nick Kralevich
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "sepolicy: Drop BOARD_SEPOLICY_IGNORE/REPLACE support."
parents
79e873c0
b4f17069
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Android.mk
+10
-33
10 additions, 33 deletions
Android.mk
README
+7
-48
7 additions, 48 deletions
README
with
17 additions
and
81 deletions
Android.mk
+
10
−
33
View file @
1d45b9c2
...
@@ -3,36 +3,20 @@ LOCAL_PATH:= $(call my-dir)
...
@@ -3,36 +3,20 @@ LOCAL_PATH:= $(call my-dir)
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
# SELinux policy version.
# SELinux policy version.
# Must be <= /selinux/policyvers reported by the Android kernel.
# Must be <=
/sys/fs
/selinux/policyvers reported by the Android kernel.
# Must be within the compatibility range reported by checkpolicy -V.
# Must be within the compatibility range reported by checkpolicy -V.
POLICYVERS
?=
26
POLICYVERS
?=
26
MLS_SENS
=
1
MLS_SENS
=
1
MLS_CATS
=
1024
MLS_CATS
=
1024
# Quick edge case error detection for BOARD_SEPOLICY_REPLACE.
ifdef
BOARD_SEPOLICY_REPLACE
# Builds the singular path for each replace file.
$(
error
BOARD_SEPOLICY_REPLACE is no longer supported
;
please remove from your BoardConfig.mk or other .mk file.
)
sepolicy_replace_paths
:=
endif
$(
foreach
pf,
$(
BOARD_SEPOLICY_REPLACE
)
,
\
$(
if
$(
filter
$(
pf
)
,
$(
BOARD_SEPOLICY_UNION
))
,
\
ifdef
BOARD_SEPOLICY_IGNORE
$(
error Ambiguous request
for
sepolicy
$(
pf
)
.
Appears
in
both
\
$(
error
BOARD_SEPOLICY_IGNORE is no longer supported
;
please remove from your BoardConfig.mk or other .mk file.
)
BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION
)
,
\
endif
)
\
$(
eval
_paths :
=
$(
filter-out
$(
BOARD_SEPOLICY_IGNORE
)
,
\
$(
wildcard
$(
addsuffix /
$(
pf
)
,
$(
BOARD_SEPOLICY_DIRS
)))))
\
$(
eval
_occurrences :
=
$(
words
$(
_paths
)))
\
$(
if
$(
filter 0,
$(
_occurrences
))
,
\
$(
error No sepolicy file found
for
$(
pf
)
in
$(
BOARD_SEPOLICY_DIRS
))
,
\
)
\
$(
if
$(
filter 1,
$(
_occurrences
))
,
\
$(
eval
sepolicy_replace_paths +
=
$(
_paths
))
,
\
$(
error Multiple occurrences of replace file
$(
pf
)
in
$(
_paths
))
\
)
\
$(
if
$(
filter 0,
$(
words
$(
wildcard
$(
addsuffix /
$(
pf
)
,
$(
LOCAL_PATH
)))))
,
\
$(
error Specified the sepolicy file
$(
pf
)
in
BOARD_SEPOLICY_REPLACE,
\
but none found
in
$(
LOCAL_PATH
))
,
\
)
\
)
# Quick edge case error detection for BOARD_SEPOLICY_UNION.
# Quick edge case error detection for BOARD_SEPOLICY_UNION.
# This ensures that a requested union file exists somewhere
# This ensures that a requested union file exists somewhere
...
@@ -44,24 +28,18 @@ $(foreach pf, $(BOARD_SEPOLICY_UNION), \
...
@@ -44,24 +28,18 @@ $(foreach pf, $(BOARD_SEPOLICY_UNION), \
)
)
# Builds paths for all requested policy files w.r.t
# Builds paths for all requested policy files w.r.t
# both BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION
# BOARD_SEPOLICY_UNION variables.
# product variables.
# $(1): the set of policy name paths to build
# $(1): the set of policy name paths to build
build_policy
=
$(
foreach
type
,
$(
1
)
,
\
build_policy
=
$(
foreach
type
,
$(
1
)
,
\
$(
filter-out
$(
BOARD_SEPOLICY_IGNORE
)
,
\
$(
foreach expanded_type,
$(
notdir
$(
wildcard
$(
addsuffix /
$(
type
)
,
$(
LOCAL_PATH
))))
,
\
$(
foreach expanded_type,
$(
notdir
$(
wildcard
$(
addsuffix /
$(
type
)
,
$(
LOCAL_PATH
))))
,
\
$(
if
$(
filter
$(
expanded_type
)
,
$(
BOARD_SEPOLICY_REPLACE
))
,
\
$(
wildcard
$(
addsuffix
$(
expanded_type
)
,
$(
sort
$(
dir
$(
sepolicy_replace_paths
)))))
,
\
$(
LOCAL_PATH
)
/
$(
expanded_type
)
\
$(
LOCAL_PATH
)
/
$(
expanded_type
)
\
)
\
)
\
)
\
$(
foreach union_policy,
$(
wildcard
$(
addsuffix /
$(
type
)
,
$(
BOARD_SEPOLICY_DIRS
)))
,
\
$(
foreach union_policy,
$(
wildcard
$(
addsuffix /
$(
type
)
,
$(
BOARD_SEPOLICY_DIRS
)))
,
\
$(
if
$(
filter
$(
notdir
$(
union_policy
))
,
$(
BOARD_SEPOLICY_UNION
))
,
\
$(
if
$(
filter
$(
notdir
$(
union_policy
))
,
$(
BOARD_SEPOLICY_UNION
))
,
\
$(
union_policy
)
,
\
$(
union_policy
)
,
\
)
\
)
\
)
\
)
\
)
\
)
)
sepolicy_build_files
:=
security_classes
\
sepolicy_build_files
:=
security_classes
\
initial_sids
\
initial_sids
\
...
@@ -355,7 +333,6 @@ $(LOCAL_BUILT_MODULE) : $(built_sepolicy) $(built_pc) $(built_fc) $(built_sc) $(
...
@@ -355,7 +333,6 @@ $(LOCAL_BUILT_MODULE) : $(built_sepolicy) $(built_pc) $(built_fc) $(built_sc) $(
build_policy
:=
build_policy
:=
sepolicy_build_files
:=
sepolicy_build_files
:=
sepolicy_replace_paths
:=
built_sepolicy
:=
built_sepolicy
:=
built_sc
:=
built_sc
:=
built_fc
:=
built_fc
:=
...
...
This diff is collapsed.
Click to expand it.
README
+
7
−
48
View file @
1d45b9c2
...
@@ -9,12 +9,10 @@ Policy Generation:
...
@@ -9,12 +9,10 @@ Policy Generation:
Additional, per device, policy files can be added into the
Additional, per device, policy files can be added into the
policy build.
policy build.
They can be configured through the use of
four
variables,
They can be configured through the use of
two
variables,
they are:
they are:
1. BOARD_SEPOLICY_REPLACE
1. BOARD_SEPOLICY_UNION
2. BOARD_SEPOLICY_UNION
2. BOARD_SEPOLICY_DIRS
3. BOARD_SEPOLICY_DIRS
4. BOARD_SEPOLICY_IGNORE
The variables should be set in the BoardConfig.mk file in
The variables should be set in the BoardConfig.mk file in
the device or vendor directories.
the device or vendor directories.
...
@@ -24,12 +22,8 @@ BOARD_SEPOLICY_UNION is a list of files that will be
...
@@ -24,12 +22,8 @@ BOARD_SEPOLICY_UNION is a list of files that will be
file in external/sepolicy. Note, to add a unique file you
file in external/sepolicy. Note, to add a unique file you
would use this variable.
would use this variable.
BOARD_SEPOLICY_REPLACE is a list of files that will be
used instead of the corresponding file in external/sepolicy.
BOARD_SEPOLICY_DIRS contains a list of directories to search
BOARD_SEPOLICY_DIRS contains a list of directories to search
for BOARD_SEPOLICY_UNION and BOARD_SEPOLICY_REPLACE files. Order
for BOARD_SEPOLICY_UNION files. Order matters in this list.
matters in this list.
eg.) If you have BOARD_SEPOLICY_UNION += widget.te and have 2
eg.) If you have BOARD_SEPOLICY_UNION += widget.te and have 2
instances of widget.te files on BOARD_SEPOLICY_DIRS search path.
instances of widget.te files on BOARD_SEPOLICY_DIRS search path.
The first one found (at the first search dir containing the file)
The first one found (at the first search dir containing the file)
...
@@ -37,43 +31,9 @@ gets processed first.
...
@@ -37,43 +31,9 @@ gets processed first.
Reviewing out/target/product/<device>/etc/sepolicy_intermediates/policy.conf
Reviewing out/target/product/<device>/etc/sepolicy_intermediates/policy.conf
will help sort out ordering issues.
will help sort out ordering issues.
It is an error to specify a BOARD_POLICY_REPLACE file that does
not exist in external/sepolicy.
It is an error to specify a BOARD_POLICY_REPLACE file that appears
multiple times on the policy search path defined by BOARD_SEPOLICY_DIRS.
eg.) if you specify shell.te in BOARD_SEPOLICY_REPLACE and
BOARD_SEPOLICY_DIRS is set to
"vendor/widget/common/sepolicy device/widget/x/sepolicy" and shell.te
appears in both locations, it is an error. Unless it is in
BOARD_SEPOLICY_IGNORE to be filtered out. See BOARD_SEPOLICY_IGNORE
for more details.
It is an error to specify the same file name in both
BOARD_POLICY_REPLACE and BOARD_POLICY_UNION.
It is an error to specify a BOARD_SEPOLICY_DIRS that has no entries when
specifying BOARD_SEPOLICY_REPLACE.
It is an error to specify a BOARD_POLICY_UNION file that
It is an error to specify a BOARD_POLICY_UNION file that
doesn't appear in any of the BOARD_SEPOLICY_DIRS locations.
doesn't appear in any of the BOARD_SEPOLICY_DIRS locations.
BOARD_SEPOLICY_IGNORE is a list of paths (directory + filename) of
files that are not to be included in the resulting policy. This list
is passed to filter-out to remove any paths you may want to ignore. This
is useful if you have numerous config directories that contain a file
and you want to NOT include a particular file in your resulting
policy file, either by UNION or REPLACE.
Eg.) Suppose the following:
BOARD_SEPOLICY_DIRS += X Y
BOARD_SEPOLICY_REPLACE += A
BOARD_SEPOLICY_IGNORE += X/A
Directories X and Y contain A.
The resulting policy is created by using Y/A only, thus X/A was
ignored.
Example BoardConfig.mk Usage:
Example BoardConfig.mk Usage:
From the Tuna device BoardConfig.mk, device/samsung/tuna/BoardConfig.mk
From the Tuna device BoardConfig.mk, device/samsung/tuna/BoardConfig.mk
...
@@ -95,8 +55,7 @@ mac_permissions.xml:
...
@@ -95,8 +55,7 @@ mac_permissions.xml:
top of that file. The seinfo string, previously mentioned, is the same string
top of that file. The seinfo string, previously mentioned, is the same string
that is referenced in seapp_contexts.
that is referenced in seapp_contexts.
This file can be replaced through BOARD_SEPOLICY_REPLACE containing the
This file can be appended to by using the BOARD_SEPOLICY_UNION
value "mac_permissions.xml", or appended to by using the BOARD_SEPOLICY_UNION
variable. It is important to note the final processed version of this file
variable. It is important to note the final processed version of this file
is stripped of comments and whitespace. This is to preserve space on the
is stripped of comments and whitespace. This is to preserve space on the
system.img. If one wishes to view it in a more human friendly format,
system.img. If one wishes to view it in a more human friendly format,
...
@@ -114,8 +73,8 @@ mac_permissions.xml:
...
@@ -114,8 +73,8 @@ mac_permissions.xml:
keys.conf
keys.conf
The keys.conf file is used for controlling the mapping of "tags" found in
The keys.conf file is used for controlling the mapping of "tags" found in
the mac_permissions.xml signature stanzas with actual public keys found in
the mac_permissions.xml signature stanzas with actual public keys found in
pem files. The configuration file can be used in BOARD_SEPOLICY_UNION
and
pem files. The configuration file can be used in BOARD_SEPOLICY_UNION
BOARD_SEPOLICY_REPLACE
variables and is processed via m4.
variables and is processed via m4.
The script allows for mapping any string contained in TARGET_BUILD_VARIANT
The script allows for mapping any string contained in TARGET_BUILD_VARIANT
with specific path to a pem file. Typically TARGET_BUILD_VARIANT is either
with specific path to a pem file. Typically TARGET_BUILD_VARIANT is either
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment