2012-01-04 18:33:27 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
2012-08-28 00:41:15 +02:00
|
|
|
|
2017-07-07 23:59:51 +02:00
|
|
|
include $(LOCAL_PATH)/definitions.mk
|
2019-02-15 21:18:15 +01:00
|
|
|
include $(LOCAL_PATH)/policy_version.mk
|
2017-07-07 23:59:51 +02:00
|
|
|
|
2017-03-23 00:20:24 +01:00
|
|
|
include $(CLEAR_VARS)
|
2012-01-04 18:33:27 +01:00
|
|
|
|
|
|
|
MLS_SENS=1
|
|
|
|
MLS_CATS=1024
|
|
|
|
|
2015-04-01 16:14:56 +02:00
|
|
|
ifdef BOARD_SEPOLICY_UNION
|
|
|
|
$(warning BOARD_SEPOLICY_UNION is no longer required - all files found in BOARD_SEPOLICY_DIRS are implicitly unioned; please remove from your BoardConfig.mk or other .mk file.)
|
|
|
|
endif
|
|
|
|
|
2015-07-16 20:28:02 +02:00
|
|
|
ifdef BOARD_SEPOLICY_M4DEFS
|
|
|
|
LOCAL_ADDITIONAL_M4DEFS := $(addprefix -D, $(BOARD_SEPOLICY_M4DEFS))
|
2017-07-07 23:59:51 +02:00
|
|
|
else
|
|
|
|
LOCAL_ADDITIONAL_M4DEFS :=
|
2015-07-16 20:28:02 +02:00
|
|
|
endif
|
|
|
|
|
2016-07-22 22:13:11 +02:00
|
|
|
# sepolicy is now divided into multiple portions:
|
|
|
|
# public - policy exported on which non-platform policy developers may write
|
|
|
|
# additional policy. types and attributes are versioned and included in
|
|
|
|
# delivered non-platform policy, which is to be combined with platform policy.
|
|
|
|
# private - platform-only policy required for platform functionality but which
|
|
|
|
# is not exported to vendor policy developers and as such may not be assumed
|
|
|
|
# to exist.
|
2017-01-31 03:44:59 +01:00
|
|
|
# vendor - vendor-only policy required for vendor functionality. This policy can
|
|
|
|
# reference the public policy but cannot reference the private policy. This
|
|
|
|
# policy is for components which are produced from the core/non-vendor tree and
|
|
|
|
# placed into a vendor partition.
|
2016-12-07 20:27:47 +01:00
|
|
|
# mapping - This contains policy statements which map the attributes
|
2016-07-22 22:13:11 +02:00
|
|
|
# exposed in the public policy of previous versions to the concrete types used
|
|
|
|
# in this policy to ensure that policy targeting attributes from public
|
|
|
|
# policy from an older platform version continues to work.
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
# build process for device:
|
2016-07-22 22:13:11 +02:00
|
|
|
# 1) convert policies to CIL:
|
|
|
|
# - private + public platform policy to CIL
|
|
|
|
# - mapping file to CIL (should already be in CIL form)
|
|
|
|
# - non-platform public policy to CIL
|
|
|
|
# - non-platform public + private policy to CIL
|
|
|
|
# 2) attributize policy
|
|
|
|
# - run script which takes non-platform public and non-platform combined
|
|
|
|
# private + public policy and produces attributized and versioned
|
|
|
|
# non-platform policy
|
|
|
|
# 3) combine policy files
|
|
|
|
# - combine mapping, platform and non-platform policy.
|
|
|
|
# - compile output binary policy file
|
|
|
|
|
|
|
|
PLAT_PUBLIC_POLICY := $(LOCAL_PATH)/public
|
|
|
|
PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private
|
2017-01-31 03:44:59 +01:00
|
|
|
PLAT_VENDOR_POLICY := $(LOCAL_PATH)/vendor
|
2016-10-12 23:58:09 +02:00
|
|
|
REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask
|
2020-07-14 21:28:51 +02:00
|
|
|
|
|
|
|
SYSTEM_EXT_PUBLIC_POLICY := $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS)
|
|
|
|
ifneq (,$(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
|
2020-10-28 06:01:17 +01:00
|
|
|
# TODO: Disallow BOARD_PLAT_*
|
2020-07-14 21:28:51 +02:00
|
|
|
SYSTEM_EXT_PUBLIC_POLICY += $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR)
|
|
|
|
endif
|
|
|
|
SYSTEM_EXT_PRIVATE_POLICY := $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS)
|
|
|
|
ifneq (,$(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
|
2020-10-28 06:01:17 +01:00
|
|
|
# TODO: Disallow BOARD_PLAT_*
|
2020-07-14 21:28:51 +02:00
|
|
|
SYSTEM_EXT_PRIVATE_POLICY += $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR)
|
|
|
|
endif
|
|
|
|
|
2019-02-01 20:41:08 +01:00
|
|
|
PRODUCT_PUBLIC_POLICY := $(PRODUCT_PUBLIC_SEPOLICY_DIRS)
|
|
|
|
PRODUCT_PRIVATE_POLICY := $(PRODUCT_PRIVATE_SEPOLICY_DIRS)
|
2018-12-14 23:30:56 +01:00
|
|
|
|
2020-10-08 23:39:42 +02:00
|
|
|
# Extra sepolicy and prebuilts directories for sepolicy_freeze_test
|
|
|
|
FREEZE_TEST_EXTRA_DIRS := $(SEPOLICY_FREEZE_TEST_EXTRA_DIRS)
|
|
|
|
FREEZE_TEST_EXTRA_PREBUILT_DIRS := $(SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS)
|
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
ifneq (,$(SYSTEM_EXT_PUBLIC_POLICY)$(SYSTEM_EXT_PRIVATE_POLICY))
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
HAS_SYSTEM_EXT_SEPOLICY_DIR := true
|
2019-08-29 11:12:11 +02:00
|
|
|
endif
|
|
|
|
|
2018-12-14 23:30:56 +01:00
|
|
|
# TODO(b/119305624): Currently if the device doesn't have a product partition,
|
|
|
|
# we install product sepolicy into /system/product. We do that because bits of
|
|
|
|
# product sepolicy that's still in /system might depend on bits that have moved
|
|
|
|
# to /product. Once we finish migrating product sepolicy out of system, change
|
|
|
|
# it so that if no product partition is present, product sepolicy artifacts are
|
|
|
|
# not built and installed at all.
|
|
|
|
ifneq (,$(PRODUCT_PUBLIC_POLICY)$(PRODUCT_PRIVATE_POLICY))
|
2019-10-04 09:36:05 +02:00
|
|
|
HAS_PRODUCT_SEPOLICY_DIR := true
|
2018-12-14 23:30:56 +01:00
|
|
|
endif
|
2016-10-12 23:58:09 +02:00
|
|
|
|
|
|
|
# TODO: move to README when doing the README update and finalizing versioning.
|
2017-04-07 23:18:48 +02:00
|
|
|
# BOARD_SEPOLICY_VERS must take the format "NN.m" and contain the sepolicy
|
|
|
|
# version identifier corresponding to the sepolicy on which the non-platform
|
|
|
|
# policy is to be based. If unspecified, this will build against the current
|
|
|
|
# public platform policy in tree
|
2016-10-12 23:58:09 +02:00
|
|
|
ifndef BOARD_SEPOLICY_VERS
|
2017-04-07 23:18:48 +02:00
|
|
|
# The default platform policy version.
|
2017-04-08 01:36:23 +02:00
|
|
|
BOARD_SEPOLICY_VERS := $(PLATFORM_SEPOLICY_VERSION)
|
2016-10-12 23:58:09 +02:00
|
|
|
endif
|
2016-07-22 22:13:11 +02:00
|
|
|
|
2018-01-04 01:53:24 +01:00
|
|
|
NEVERALLOW_ARG :=
|
|
|
|
ifeq ($(SELINUX_IGNORE_NEVERALLOWS),true)
|
|
|
|
ifeq ($(TARGET_BUILD_VARIANT),user)
|
|
|
|
$(error SELINUX_IGNORE_NEVERALLOWS := true cannot be used in user builds)
|
|
|
|
endif
|
|
|
|
$(warning Be careful when using the SELINUX_IGNORE_NEVERALLOWS flag. \
|
|
|
|
It does not work in user builds and using it will \
|
|
|
|
not stop you from failing CTS.)
|
|
|
|
NEVERALLOW_ARG := -N
|
|
|
|
endif
|
|
|
|
|
2017-11-27 04:41:33 +01:00
|
|
|
# BOARD_SEPOLICY_DIRS was used for vendor/odm sepolicy customization before.
|
|
|
|
# It has been replaced by BOARD_VENDOR_SEPOLICY_DIRS (mandatory) and
|
|
|
|
# BOARD_ODM_SEPOLICY_DIRS (optional). BOARD_SEPOLICY_DIRS is still allowed for
|
|
|
|
# backward compatibility, which will be merged into BOARD_VENDOR_SEPOLICY_DIRS.
|
2018-02-05 10:34:52 +01:00
|
|
|
ifdef BOARD_SEPOLICY_DIRS
|
|
|
|
BOARD_VENDOR_SEPOLICY_DIRS += $(BOARD_SEPOLICY_DIRS)
|
|
|
|
endif
|
2017-04-12 23:28:34 +02:00
|
|
|
|
2017-11-27 04:41:33 +01:00
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
|
|
|
ifneq ($(PRODUCT_SEPOLICY_SPLIT),true)
|
|
|
|
$(error PRODUCT_SEPOLICY_SPLIT needs to be true when using BOARD_ODM_SEPOLICY_DIRS)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-07-22 22:13:11 +02:00
|
|
|
###########################################################
|
|
|
|
# Compute policy files to be used in policy build.
|
|
|
|
# $(1): files to include
|
|
|
|
# $(2): directories in which to find files
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
define build_policy
|
|
|
|
$(foreach type, $(1), $(foreach file, $(addsuffix /$(type), $(2)), $(sort $(wildcard $(file)))))
|
|
|
|
endef
|
2016-01-04 21:20:57 +01:00
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
# Builds paths for all policy files found in BOARD_VENDOR_SEPOLICY_DIRS.
|
2016-01-04 21:20:57 +01:00
|
|
|
# $(1): the set of policy name paths to build
|
2018-02-05 10:34:52 +01:00
|
|
|
build_vendor_policy = $(call build_policy, $(1), $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS))
|
2016-01-04 21:20:57 +01:00
|
|
|
|
2017-11-29 09:14:53 +01:00
|
|
|
# Builds paths for all policy files found in BOARD_ODM_SEPOLICY_DIRS.
|
|
|
|
build_odm_policy = $(call build_policy, $(1), $(BOARD_ODM_SEPOLICY_DIRS))
|
|
|
|
|
2014-07-26 04:11:52 +02:00
|
|
|
sepolicy_build_files := security_classes \
|
|
|
|
initial_sids \
|
|
|
|
access_vectors \
|
|
|
|
global_macros \
|
2014-11-06 00:30:41 +01:00
|
|
|
neverallow_macros \
|
2014-07-26 04:11:52 +02:00
|
|
|
mls_macros \
|
2016-10-12 23:58:09 +02:00
|
|
|
mls_decl \
|
2014-07-26 04:11:52 +02:00
|
|
|
mls \
|
|
|
|
policy_capabilities \
|
|
|
|
te_macros \
|
|
|
|
attributes \
|
2015-12-22 19:39:34 +01:00
|
|
|
ioctl_defines \
|
2015-06-06 00:28:55 +02:00
|
|
|
ioctl_macros \
|
2014-07-26 04:11:52 +02:00
|
|
|
*.te \
|
2016-10-12 23:58:09 +02:00
|
|
|
roles_decl \
|
2014-07-26 04:11:52 +02:00
|
|
|
roles \
|
|
|
|
users \
|
|
|
|
initial_sid_contexts \
|
|
|
|
fs_use \
|
|
|
|
genfs_contexts \
|
|
|
|
port_contexts
|
|
|
|
|
2020-09-22 00:32:16 +02:00
|
|
|
sepolicy_compat_files := $(foreach ver, $(PLATFORM_SEPOLICY_COMPAT_VERSIONS), \
|
|
|
|
$(addprefix compat/$(ver)/, $(addsuffix .cil, $(ver))))
|
|
|
|
|
2019-10-08 01:31:40 +02:00
|
|
|
# Security classes and permissions defined outside of system/sepolicy.
|
|
|
|
security_class_extension_files := $(call build_policy, security_classes access_vectors, \
|
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
|
|
|
|
$(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY) \
|
|
|
|
$(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_ODM_SEPOLICY_DIRS))
|
|
|
|
|
|
|
|
ifneq (,$(strip $(security_class_extension_files)))
|
|
|
|
$(error Only platform SELinux policy may define classes and permissions: $(strip $(security_class_extension_files)))
|
|
|
|
endif
|
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
|
|
|
# Checks if there are public system_ext policy files.
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), $(SYSTEM_EXT_PUBLIC_POLICY))
|
|
|
|
ifneq (,$(strip $(policy_files)))
|
|
|
|
HAS_SYSTEM_EXT_PUBLIC_SEPOLICY := true
|
|
|
|
endif
|
|
|
|
# Checks if there are public/private system_ext policy files.
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), $(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY))
|
|
|
|
ifneq (,$(strip $(policy_files)))
|
|
|
|
HAS_SYSTEM_EXT_SEPOLICY := true
|
|
|
|
endif
|
|
|
|
endif # ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY_DIR
|
|
|
|
# Checks if there are public product policy files.
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), $(PRODUCT_PUBLIC_POLICY))
|
|
|
|
ifneq (,$(strip $(policy_files)))
|
|
|
|
HAS_PRODUCT_PUBLIC_SEPOLICY := true
|
|
|
|
endif
|
|
|
|
# Checks if there are public/private product policy files.
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), $(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY))
|
|
|
|
ifneq (,$(strip $(policy_files)))
|
|
|
|
HAS_PRODUCT_SEPOLICY := true
|
|
|
|
endif
|
|
|
|
endif # ifdef HAS_PRODUCT_SEPOLICY_DIR
|
|
|
|
|
Mark all clients of Allocator HAL
This change associates all domains which are clients of Allocator HAL
with hal_allocator_client and the, required for all HAL client
domains, halclientdomain.
This enables this commit to remove the now unnecessary hwallocator_use
macro because its binder_call(..., hal_allocator_server) is covered by
binder_call(hal_allocator_client, hal_allocator_server) added in this
commit.
Unfortunately apps, except isolated app, are clients of Allocator HAL
as well. This makes it hard to use the hal_client_domain(...,
hal_allocator) macro because it translates into "typeattribute" which
currently does not support being provided with a set of types, such as
{ appdomain -isolated_app }. As a workaround, hopefully until
typeattribute is improved, this commit expresses the necessary
association operation in CIL. private/technical_debt.cil introduced by
this commit is appended into the platform policy CIL file, thus
ensuring that the hack has effect on the final monolithic policy.
P. S. This change also removes Allocator HAL access from isolated_app.
Isolated app shouldn't have access to this HAL anyway.
Test: Google Play Music plays back radios
Test: Google Camera records video with sound and that video is then
successfully played back with sound
Test: YouTube app plays back clips with sound
Test: YouTube in Chrome plays back clips with sound
Bug: 34170079
Change-Id: Id00bba6fde83e7cf04fb58bc1c353c2f66333f92
2017-03-21 22:28:53 +01:00
|
|
|
# CIL files which contain workarounds for current limitation of human-readable
|
|
|
|
# module policy language. These files are appended to the CIL files produced
|
|
|
|
# from module language files.
|
|
|
|
sepolicy_build_cil_workaround_files := technical_debt.cil
|
|
|
|
|
2016-12-16 00:28:44 +01:00
|
|
|
my_target_arch := $(TARGET_ARCH)
|
|
|
|
ifneq (,$(filter mips mips64,$(TARGET_ARCH)))
|
|
|
|
my_target_arch := mips
|
|
|
|
endif
|
|
|
|
|
2017-03-15 21:37:35 +01:00
|
|
|
intermediates := $(TARGET_OUT_INTERMEDIATES)/ETC/sepolicy_intermediates
|
|
|
|
|
2017-03-13 20:22:15 +01:00
|
|
|
with_asan := false
|
|
|
|
ifneq (,$(filter address,$(SANITIZE_TARGET)))
|
|
|
|
with_asan := true
|
|
|
|
endif
|
|
|
|
|
2019-06-14 00:05:15 +02:00
|
|
|
with_native_coverage := false
|
|
|
|
ifeq ($(NATIVE_COVERAGE),true)
|
|
|
|
with_native_coverage := true
|
|
|
|
endif
|
2019-12-10 01:37:59 +01:00
|
|
|
ifeq ($(CLANG_COVERAGE),true)
|
|
|
|
with_native_coverage := true
|
|
|
|
endif
|
2019-06-14 00:05:15 +02:00
|
|
|
|
2019-09-26 08:14:55 +02:00
|
|
|
treble_sysprop_neverallow := true
|
|
|
|
ifeq ($(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW),true)
|
|
|
|
treble_sysprop_neverallow := false
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
|
|
|
|
#$(warning no product shipping level defined)
|
|
|
|
else ifneq ($(call math_lt,29,$(PRODUCT_SHIPPING_API_LEVEL)),)
|
|
|
|
ifneq ($(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW),)
|
|
|
|
$(error BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW cannot be set on a device shipping with R or later, and this is tested by CTS.)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-09-28 06:32:43 +02:00
|
|
|
enforce_sysprop_owner := true
|
|
|
|
ifeq ($(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER),true)
|
|
|
|
enforce_sysprop_owner := false
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
|
|
|
|
#$(warning no product shipping level defined)
|
|
|
|
else ifneq ($(call math_lt,30,$(PRODUCT_SHIPPING_API_LEVEL)),)
|
|
|
|
ifneq ($(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER),)
|
|
|
|
$(error BUILD_BROKEN_ENFORCE_SYSPROP_OWNER cannot be set on a device shipping with S or later, and this is tested by CTS.)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-10-04 18:42:29 +02:00
|
|
|
# Library extension for host-side tests
|
2017-10-05 03:15:44 +02:00
|
|
|
ifeq ($(HOST_OS),darwin)
|
2017-10-04 18:42:29 +02:00
|
|
|
SHAREDLIB_EXT=dylib
|
|
|
|
else
|
|
|
|
SHAREDLIB_EXT=so
|
|
|
|
endif
|
|
|
|
|
2019-01-24 08:41:47 +01:00
|
|
|
# Convert a file_context file for a non-flattened APEX into a file for
|
|
|
|
# flattened APEX. /system/apex/<apex_name> path is prepended to the original paths
|
|
|
|
# $(1): path to the input file_contexts file for non-flattened APEX
|
2019-11-20 09:54:34 +01:00
|
|
|
# $(2): path to the flattened APEX
|
|
|
|
# $(3): path to the generated file_contexts file for flattened APEX
|
2019-01-24 08:41:47 +01:00
|
|
|
# $(4): variable where $(3) is added to
|
|
|
|
define build_flattened_apex_file_contexts
|
|
|
|
$(4) += $(3)
|
2019-11-20 09:54:34 +01:00
|
|
|
$(3): PRIVATE_APEX_PATH := $(subst .,\\.,$(2))
|
2019-01-24 08:41:47 +01:00
|
|
|
$(3): $(1)
|
|
|
|
$(hide) awk '/object_r/{printf("$$(PRIVATE_APEX_PATH)%s\n",$$$$0)}' $$< > $$@
|
|
|
|
endef
|
|
|
|
|
2018-07-02 15:31:29 +02:00
|
|
|
#################################
|
|
|
|
|
2017-04-10 21:27:18 +02:00
|
|
|
include $(CLEAR_VARS)
|
2018-07-02 15:31:29 +02:00
|
|
|
|
2017-04-10 21:27:18 +02:00
|
|
|
LOCAL_MODULE := selinux_policy
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2018-05-09 03:52:11 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2018-07-02 15:31:29 +02:00
|
|
|
selinux_policy_nonsystem \
|
|
|
|
selinux_policy_system \
|
2018-05-09 03:52:11 +02:00
|
|
|
|
2018-07-02 15:31:29 +02:00
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
2018-05-09 03:52:11 +02:00
|
|
|
|
2019-05-29 18:05:43 +02:00
|
|
|
# selinux_policy is a main goal and triggers lots of tests.
|
|
|
|
# Most tests are FAKE modules, so aren'triggered on normal builds. (e.g. 'm')
|
|
|
|
# By setting as droidcore's dependency, tests will run on normal builds.
|
|
|
|
droidcore: selinux_policy
|
2018-05-09 03:52:11 +02:00
|
|
|
|
2018-07-02 15:31:29 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := selinux_policy_system
|
2018-05-09 03:52:11 +02:00
|
|
|
# These build targets are not used on non-Treble devices. However, we build these to avoid
|
|
|
|
# divergence between Treble and non-Treble devices.
|
2017-04-10 21:27:18 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2019-01-16 00:16:55 +01:00
|
|
|
plat_mapping_file \
|
2019-10-11 01:29:40 +02:00
|
|
|
$(addprefix plat_,$(addsuffix .cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS))) \
|
2019-05-02 22:48:44 +02:00
|
|
|
$(addsuffix .compat.cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \
|
2017-04-10 21:27:18 +02:00
|
|
|
plat_sepolicy.cil \
|
2019-01-23 03:07:58 +01:00
|
|
|
plat_sepolicy_and_mapping.sha256 \
|
2017-04-10 21:27:18 +02:00
|
|
|
secilc \
|
2017-09-26 21:58:29 +02:00
|
|
|
|
2017-06-08 22:24:15 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2018-02-05 10:41:02 +01:00
|
|
|
build_sepolicy \
|
2017-08-22 22:29:53 +02:00
|
|
|
plat_file_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
plat_file_contexts_test \
|
2020-07-25 22:02:29 +02:00
|
|
|
plat_keystore2_key_contexts \
|
2017-08-22 22:29:53 +02:00
|
|
|
plat_mac_permissions.xml \
|
|
|
|
plat_property_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
plat_property_contexts_test \
|
2017-08-22 22:29:53 +02:00
|
|
|
plat_seapp_contexts \
|
|
|
|
plat_service_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
plat_service_contexts_test \
|
2017-08-22 22:29:53 +02:00
|
|
|
plat_hwservice_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
plat_hwservice_contexts_test \
|
2017-09-26 21:58:29 +02:00
|
|
|
searchpolicy \
|
2018-07-02 15:31:29 +02:00
|
|
|
|
|
|
|
# This conditional inclusion closely mimics the conditional logic
|
|
|
|
# inside init/init.cpp for loading SELinux policy from files.
|
|
|
|
ifneq ($(PRODUCT_SEPOLICY_SPLIT),true)
|
|
|
|
# The following files are only allowed for non-Treble devices.
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
sepolicy \
|
|
|
|
vendor_service_contexts \
|
|
|
|
|
|
|
|
endif # ($(PRODUCT_SEPOLICY_SPLIT),true)
|
2017-06-08 22:24:15 +02:00
|
|
|
|
2017-09-26 21:58:29 +02:00
|
|
|
ifneq ($(with_asan),true)
|
2018-02-14 05:29:55 +01:00
|
|
|
ifneq ($(SELINUX_IGNORE_NEVERALLOWS),true)
|
2017-09-26 21:58:29 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
sepolicy_tests \
|
2019-05-02 22:48:44 +02:00
|
|
|
$(addsuffix _compat_test,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \
|
2017-09-26 21:58:29 +02:00
|
|
|
|
2019-09-20 20:16:29 +02:00
|
|
|
ifeq ($(PRODUCT_SEPOLICY_SPLIT),true)
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
$(addprefix treble_sepolicy_tests_,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \
|
|
|
|
|
|
|
|
endif # PRODUCT_SEPOLICY_SPLIT
|
|
|
|
endif # SELINUX_IGNORE_NEVERALLOWS
|
|
|
|
endif # with_asan
|
2017-09-26 21:58:29 +02:00
|
|
|
|
2018-07-02 15:31:29 +02:00
|
|
|
ifneq ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION))
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
sepolicy_freeze_test \
|
|
|
|
|
2020-10-08 23:39:42 +02:00
|
|
|
else
|
|
|
|
ifneq (,$(FREEZE_TEST_EXTRA_DIRS)$(FREEZE_TEST_EXTRA_PREBUILT_DIRS))
|
|
|
|
$(error SEPOLICY_FREEZE_TEST_EXTRA_DIRS or SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS\
|
|
|
|
cannot be set before system/sepolicy freezes.)
|
|
|
|
endif # (,$(FREEZE_TEST_EXTRA_DIRS)$(FREEZE_TEST_EXTRA_PREBUILT_DIRS))
|
2018-07-02 15:31:29 +02:00
|
|
|
endif # ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION))
|
|
|
|
|
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2020-10-07 11:28:47 +02:00
|
|
|
LOCAL_MODULE := selinux_policy_system_ext
|
2018-07-02 15:31:29 +02:00
|
|
|
# Include precompiled policy, unless told otherwise.
|
|
|
|
ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
|
2020-10-07 11:28:47 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += system_ext_sepolicy_and_mapping.sha256
|
2017-11-27 04:41:33 +01:00
|
|
|
endif
|
2018-12-14 23:30:56 +01:00
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += system_ext_sepolicy.cil
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
|
2019-10-11 01:29:40 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2020-09-22 00:32:16 +02:00
|
|
|
system_ext_mapping_file
|
|
|
|
|
|
|
|
system_ext_compat_files := $(call build_policy, $(sepolicy_compat_files), $(SYSTEM_EXT_PRIVATE_POLICY))
|
|
|
|
|
|
|
|
LOCAL_REQUIRED_MODULES += $(addprefix system_ext_, $(notdir $(system_ext_compat_files)))
|
2019-10-11 01:29:40 +02:00
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
2019-08-29 11:12:11 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2019-09-09 16:04:06 +02:00
|
|
|
system_ext_file_contexts \
|
|
|
|
system_ext_file_contexts_test \
|
2019-09-09 16:05:10 +02:00
|
|
|
system_ext_hwservice_contexts \
|
|
|
|
system_ext_hwservice_contexts_test \
|
2019-09-09 12:09:22 +02:00
|
|
|
system_ext_property_contexts \
|
|
|
|
system_ext_property_contexts_test \
|
2019-09-09 16:04:30 +02:00
|
|
|
system_ext_seapp_contexts \
|
2019-09-09 16:05:29 +02:00
|
|
|
system_ext_service_contexts \
|
|
|
|
system_ext_service_contexts_test \
|
2019-09-09 16:05:49 +02:00
|
|
|
system_ext_mac_permissions.xml \
|
2019-08-29 11:12:11 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2020-10-07 11:28:47 +02:00
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := selinux_policy_product
|
|
|
|
# Include precompiled policy, unless told otherwise.
|
|
|
|
ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
|
|
|
|
LOCAL_REQUIRED_MODULES += product_sepolicy_and_mapping.sha256
|
|
|
|
endif
|
|
|
|
|
2018-12-14 23:30:56 +01:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY
|
2019-10-04 09:36:05 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += product_sepolicy.cil
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
|
2019-10-11 01:29:40 +02:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2020-09-22 00:32:16 +02:00
|
|
|
product_mapping_file
|
|
|
|
|
|
|
|
product_compat_files := $(call build_policy, $(sepolicy_compat_files), $(PRODUCT_PRIVATE_POLICY))
|
|
|
|
|
|
|
|
LOCAL_REQUIRED_MODULES += $(addprefix product_, $(notdir $(product_compat_files)))
|
2019-10-11 01:29:40 +02:00
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef HAS_PRODUCT_SEPOLICY_DIR
|
2018-12-14 23:30:56 +01:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
2018-12-19 04:51:19 +01:00
|
|
|
product_file_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
product_file_contexts_test \
|
2018-12-21 01:13:10 +01:00
|
|
|
product_hwservice_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
product_hwservice_contexts_test \
|
2018-12-21 04:31:42 +01:00
|
|
|
product_property_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
product_property_contexts_test \
|
2018-12-21 19:46:45 +01:00
|
|
|
product_seapp_contexts \
|
2018-12-21 21:28:14 +01:00
|
|
|
product_service_contexts \
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
product_service_contexts_test \
|
2018-12-22 01:07:21 +01:00
|
|
|
product_mac_permissions.xml \
|
2018-12-14 23:30:56 +01:00
|
|
|
|
2019-01-23 18:47:05 +01:00
|
|
|
endif
|
|
|
|
|
2020-10-07 11:28:47 +02:00
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := selinux_policy_nonsystem
|
|
|
|
# Include precompiled policy, unless told otherwise.
|
|
|
|
ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
precompiled_sepolicy \
|
|
|
|
precompiled_sepolicy.plat_sepolicy_and_mapping.sha256 \
|
|
|
|
precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256 \
|
|
|
|
precompiled_sepolicy.product_sepolicy_and_mapping.sha256 \
|
|
|
|
|
|
|
|
endif # ($(PRODUCT_PRECOMPILED_SEPOLICY),false)
|
|
|
|
|
|
|
|
|
|
|
|
# These build targets are not used on non-Treble devices. However, we build these to avoid
|
|
|
|
# divergence between Treble and non-Treble devices.
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
plat_pub_versioned.cil \
|
|
|
|
vendor_sepolicy.cil \
|
|
|
|
plat_sepolicy_vers.txt \
|
|
|
|
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
vendor_file_contexts \
|
|
|
|
vendor_file_contexts_test \
|
|
|
|
vendor_mac_permissions.xml \
|
|
|
|
vendor_property_contexts \
|
|
|
|
vendor_property_contexts_test \
|
|
|
|
vendor_seapp_contexts \
|
|
|
|
vendor_service_contexts \
|
|
|
|
vendor_hwservice_contexts \
|
|
|
|
vendor_hwservice_contexts_test \
|
|
|
|
vndservice_contexts \
|
|
|
|
|
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
odm_sepolicy.cil \
|
|
|
|
odm_file_contexts \
|
|
|
|
odm_file_contexts_test \
|
|
|
|
odm_seapp_contexts \
|
|
|
|
odm_property_contexts \
|
|
|
|
odm_property_contexts_test \
|
|
|
|
odm_hwservice_contexts \
|
|
|
|
odm_hwservice_contexts_test \
|
|
|
|
odm_mac_permissions.xml
|
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_REQUIRED_MODULES += selinux_policy_system_ext
|
|
|
|
LOCAL_REQUIRED_MODULES += selinux_policy_product
|
|
|
|
|
2019-01-23 18:47:05 +01:00
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
selinux_denial_metadata \
|
|
|
|
|
2019-04-19 16:03:33 +02:00
|
|
|
# Builds an addtional userdebug sepolicy into the debug ramdisk.
|
|
|
|
LOCAL_REQUIRED_MODULES += \
|
|
|
|
userdebug_plat_sepolicy.cil \
|
|
|
|
|
2017-04-10 21:27:18 +02:00
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
|
|
|
|
2018-01-04 01:53:24 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := sepolicy_neverallows
|
2019-05-29 18:05:43 +02:00
|
|
|
LOCAL_MODULE_CLASS := FAKE
|
2018-01-04 01:53:24 +01:00
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
# sepolicy_policy.conf - All of the policy for the device. This is only used to
|
|
|
|
# check neverallow rules.
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) $(PLAT_VENDOR_POLICY) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
|
2019-06-19 19:52:50 +02:00
|
|
|
$(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY) \
|
|
|
|
$(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_ODM_SEPOLICY_DIRS))
|
2018-01-04 01:53:24 +01:00
|
|
|
sepolicy_policy.conf := $(intermediates)/policy.conf
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(sepolicy_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := user
|
2018-01-04 01:53:24 +01:00
|
|
|
$(sepolicy_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(sepolicy_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(sepolicy_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(sepolicy_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(sepolicy_policy.conf): $(policy_files) $(M4)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2018-01-04 01:53:24 +01:00
|
|
|
|
2018-11-27 22:45:47 +01:00
|
|
|
# sepolicy_policy_2.conf - All of the policy for the device. This is only used to
|
|
|
|
# check neverallow rules using sepolicy-analyze, similar to CTS.
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) $(PLAT_VENDOR_POLICY) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
|
2019-06-19 19:52:50 +02:00
|
|
|
$(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY) \
|
|
|
|
$(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_ODM_SEPOLICY_DIRS))
|
2018-11-27 22:45:47 +01:00
|
|
|
sepolicy_policy_2.conf := $(intermediates)/policy_2.conf
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_TARGET_BUILD_VARIANT := user
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_EXCLUDE_BUILD_TEST := true
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2018-11-27 22:45:47 +01:00
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(sepolicy_policy_2.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(sepolicy_policy_2.conf): $(policy_files) $(M4)
|
2018-11-27 22:45:47 +01:00
|
|
|
$(transform-policy-to-conf)
|
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY_1 := $(sepolicy_policy.conf)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY_2 := $(sepolicy_policy_2.conf)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(sepolicy_policy.conf) $(sepolicy_policy_2.conf) \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/checkpolicy $(HOST_OUT_EXECUTABLES)/sepolicy-analyze
|
2018-01-04 01:53:24 +01:00
|
|
|
ifneq ($(SELINUX_IGNORE_NEVERALLOWS),true)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c \
|
2018-11-27 22:45:47 +01:00
|
|
|
$(POLICYVERS) -o $@.tmp $(PRIVATE_SEPOLICY_1)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp neverallow -w -f $(PRIVATE_SEPOLICY_2) || \
|
|
|
|
( echo "" 1>&2; \
|
|
|
|
echo "sepolicy-analyze failed. This is most likely due to the use" 1>&2; \
|
|
|
|
echo "of an expanded attribute in a neverallow assertion. Please fix" 1>&2; \
|
|
|
|
echo "the policy." 1>&2; \
|
|
|
|
exit 1 )
|
2018-01-04 01:53:24 +01:00
|
|
|
endif # ($(SELINUX_IGNORE_NEVERALLOWS),true)
|
2018-11-27 22:45:47 +01:00
|
|
|
$(hide) touch $@.tmp
|
|
|
|
$(hide) mv $@.tmp $@
|
2018-01-04 01:53:24 +01:00
|
|
|
|
|
|
|
sepolicy_policy.conf :=
|
2018-11-27 22:45:47 +01:00
|
|
|
sepolicy_policy_2.conf :=
|
2018-01-04 01:53:24 +01:00
|
|
|
built_sepolicy_neverallows := $(LOCAL_BUILT_MODULE)
|
|
|
|
|
2012-01-18 02:51:09 +01:00
|
|
|
##################################
|
2016-10-12 23:58:09 +02:00
|
|
|
# reqd_policy_mask - a policy.conf file which contains only the bare minimum
|
|
|
|
# policy necessary to use checkpolicy. This bare-minimum policy needs to be
|
|
|
|
# present in all policy.conf files, but should not necessarily be exported as
|
|
|
|
# part of the public policy. The rules generated by reqd_policy_mask will allow
|
|
|
|
# the compilation of public policy and subsequent removal of CIL policy that
|
|
|
|
# should not be exported.
|
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), $(REQD_MASK_POLICY))
|
2016-10-12 23:58:09 +02:00
|
|
|
reqd_policy_mask.conf := $(intermediates)/reqd_policy_mask.conf
|
|
|
|
$(reqd_policy_mask.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(reqd_policy_mask.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
2016-12-16 00:28:44 +01:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
2017-03-13 20:22:15 +01:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2016-10-12 23:58:09 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2017-11-09 20:24:56 +01:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
2017-10-19 09:54:49 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(reqd_policy_mask.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(reqd_policy_mask.conf): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2017-04-28 02:16:13 +02:00
|
|
|
# b/37755687
|
|
|
|
CHECKPOLICY_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
reqd_policy_mask.cil := $(intermediates)/reqd_policy_mask.cil
|
|
|
|
$(reqd_policy_mask.cil): $(reqd_policy_mask.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
|
|
|
|
@mkdir -p $(dir $@)
|
2017-04-28 02:16:13 +02:00
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -C -M -c \
|
|
|
|
$(POLICYVERS) -o $@ $<
|
2016-10-12 23:58:09 +02:00
|
|
|
|
2016-11-28 16:20:28 +01:00
|
|
|
reqd_policy_mask.conf :=
|
|
|
|
|
|
|
|
##################################
|
2019-01-15 22:31:03 +01:00
|
|
|
# pub_policy - policy that will be exported to be a part of non-platform
|
2016-10-12 23:58:09 +02:00
|
|
|
# policy corresponding to this platform version. This is a limited subset of
|
|
|
|
# policy that would not compile in checkpolicy on its own. To get around this
|
|
|
|
# limitation, add only the required files from private policy, which will
|
|
|
|
# generate CIL policy that will then be filtered out by the reqd_policy_mask.
|
2019-08-29 11:12:11 +02:00
|
|
|
#
|
|
|
|
# There are three pub_policy.cil files below:
|
|
|
|
# - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
|
|
|
|
# - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
|
|
|
|
# - plat_pub_policy.cil: exported 'system' policy.
|
|
|
|
#
|
|
|
|
# Those above files will in turn be used to generate the following versioned cil files:
|
|
|
|
# - product_mapping_file: the versioned, exported 'product' policy in product partition.
|
|
|
|
# - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
|
|
|
|
# - plat_mapping_file: the versioned, exported 'system' policy in system partition.
|
|
|
|
# - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system'
|
|
|
|
# policy in vendor partition.
|
|
|
|
#
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PLAT_PUBLIC_POLICY) $(SYSTEM_EXT_PUBLIC_POLICY) $(PRODUCT_PUBLIC_POLICY) $(REQD_MASK_POLICY))
|
2019-01-15 22:31:03 +01:00
|
|
|
pub_policy.conf := $(intermediates)/pub_policy.conf
|
|
|
|
$(pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(pub_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(pub_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(pub_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(pub_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(pub_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(pub_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(pub_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(pub_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(pub_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(pub_policy.conf): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2019-01-15 22:31:03 +01:00
|
|
|
pub_policy.cil := $(intermediates)/pub_policy.cil
|
|
|
|
$(pub_policy.cil): PRIVATE_POL_CONF := $(pub_policy.conf)
|
|
|
|
$(pub_policy.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
|
|
|
$(pub_policy.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(pub_policy.conf) $(reqd_policy_mask.cil)
|
2016-10-12 23:58:09 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2018-12-18 01:35:41 +01:00
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $< -C -M -c $(POLICYVERS) -o $@ $(PRIVATE_POL_CONF)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_REQD_MASK) -t $@
|
2016-10-12 23:58:09 +02:00
|
|
|
|
2019-01-15 22:31:03 +01:00
|
|
|
pub_policy.conf :=
|
2016-12-16 00:28:44 +01:00
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
##################################
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(SYSTEM_EXT_PUBLIC_POLICY) $(REQD_MASK_POLICY))
|
|
|
|
system_ext_pub_policy.conf := $(intermediates)/system_ext_pub_policy.conf
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-10-16 04:46:50 +02:00
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(system_ext_pub_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(system_ext_pub_policy.conf): $(policy_files) $(M4)
|
|
|
|
$(transform-policy-to-conf)
|
|
|
|
|
|
|
|
system_ext_pub_policy.cil := $(intermediates)/system_ext_pub_policy.cil
|
|
|
|
$(system_ext_pub_policy.cil): PRIVATE_POL_CONF := $(system_ext_pub_policy.conf)
|
|
|
|
$(system_ext_pub_policy.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
|
|
|
$(system_ext_pub_policy.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(system_ext_pub_policy.conf) $(reqd_policy_mask.cil)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $< -C -M -c $(POLICYVERS) -o $@ $(PRIVATE_POL_CONF)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_REQD_MASK) -t $@
|
|
|
|
|
|
|
|
system_ext_pub_policy.conf :=
|
|
|
|
|
2019-01-16 00:16:55 +01:00
|
|
|
##################################
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(REQD_MASK_POLICY))
|
2019-01-16 00:16:55 +01:00
|
|
|
plat_pub_policy.conf := $(intermediates)/plat_pub_policy.conf
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(plat_pub_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2019-01-16 00:16:55 +01:00
|
|
|
$(plat_pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(plat_pub_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(plat_pub_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(plat_pub_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(plat_pub_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(plat_pub_policy.conf): $(policy_files) $(M4)
|
2019-01-16 00:16:55 +01:00
|
|
|
$(transform-policy-to-conf)
|
|
|
|
|
|
|
|
plat_pub_policy.cil := $(intermediates)/plat_pub_policy.cil
|
|
|
|
$(plat_pub_policy.cil): PRIVATE_POL_CONF := $(plat_pub_policy.conf)
|
|
|
|
$(plat_pub_policy.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
|
|
|
$(plat_pub_policy.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(plat_pub_policy.conf) $(reqd_policy_mask.cil)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $< -C -M -c $(POLICYVERS) -o $@ $(PRIVATE_POL_CONF)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_REQD_MASK) -t $@
|
|
|
|
|
|
|
|
plat_pub_policy.conf :=
|
|
|
|
|
2016-11-28 16:20:28 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := plat_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-03-02 21:39:25 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux
|
2016-11-28 16:20:28 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
2016-10-12 23:58:09 +02:00
|
|
|
|
|
|
|
# plat_policy.conf - A combination of the private and public platform policy
|
|
|
|
# which will ship with the device. The platform will always reflect the most
|
|
|
|
# recent platform version and is not currently being attributized.
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
|
2016-10-12 23:58:09 +02:00
|
|
|
plat_policy.conf := $(intermediates)/plat_policy.conf
|
|
|
|
$(plat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(plat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(plat_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
2016-12-16 00:28:44 +01:00
|
|
|
$(plat_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
2017-03-13 20:22:15 +01:00
|
|
|
$(plat_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2016-10-12 23:58:09 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2017-11-09 20:24:56 +01:00
|
|
|
$(plat_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
2017-10-19 09:54:49 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(plat_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(plat_policy.conf): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2016-07-22 22:13:11 +02:00
|
|
|
|
2017-04-22 00:57:07 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CIL_FILES := \
|
Mark all clients of Allocator HAL
This change associates all domains which are clients of Allocator HAL
with hal_allocator_client and the, required for all HAL client
domains, halclientdomain.
This enables this commit to remove the now unnecessary hwallocator_use
macro because its binder_call(..., hal_allocator_server) is covered by
binder_call(hal_allocator_client, hal_allocator_server) added in this
commit.
Unfortunately apps, except isolated app, are clients of Allocator HAL
as well. This makes it hard to use the hal_client_domain(...,
hal_allocator) macro because it translates into "typeattribute" which
currently does not support being provided with a set of types, such as
{ appdomain -isolated_app }. As a workaround, hopefully until
typeattribute is improved, this commit expresses the necessary
association operation in CIL. private/technical_debt.cil introduced by
this commit is appended into the platform policy CIL file, thus
ensuring that the hack has effect on the final monolithic policy.
P. S. This change also removes Allocator HAL access from isolated_app.
Isolated app shouldn't have access to this HAL anyway.
Test: Google Play Music plays back radios
Test: Google Camera records video with sound and that video is then
successfully played back with sound
Test: YouTube app plays back clips with sound
Test: YouTube in Chrome plays back clips with sound
Bug: 34170079
Change-Id: Id00bba6fde83e7cf04fb58bc1c353c2f66333f92
2017-03-21 22:28:53 +01:00
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY))
|
2018-01-04 01:53:24 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
2017-04-22 00:57:07 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): $(plat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/secilc \
|
2018-01-04 01:53:24 +01:00
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY)) \
|
|
|
|
$(built_sepolicy_neverallows)
|
2016-10-12 23:58:09 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2017-04-28 02:16:13 +02:00
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c \
|
2018-11-26 23:29:06 +01:00
|
|
|
$(POLICYVERS) -o $@.tmp $<
|
|
|
|
$(hide) cat $(PRIVATE_ADDITIONAL_CIL_FILES) >> $@.tmp
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) $(PRIVATE_NEVERALLOW_ARG) $@.tmp -o /dev/null -f /dev/null
|
|
|
|
$(hide) mv $@.tmp $@
|
2017-02-25 23:47:53 +01:00
|
|
|
|
|
|
|
built_plat_cil := $(LOCAL_BUILT_MODULE)
|
2016-11-28 16:20:28 +01:00
|
|
|
plat_policy.conf :=
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-04-19 16:03:33 +02:00
|
|
|
LOCAL_MODULE := userdebug_plat_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_DEBUG_RAMDISK_OUT)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
# userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
|
2019-04-19 16:03:33 +02:00
|
|
|
userdebug_plat_policy.conf := $(intermediates)/userdebug_plat_policy.conf
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := userdebug
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2019-04-19 16:03:33 +02:00
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(userdebug_plat_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(userdebug_plat_policy.conf): $(policy_files) $(M4)
|
2019-04-19 16:03:33 +02:00
|
|
|
$(transform-policy-to-conf)
|
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CIL_FILES := \
|
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY))
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(userdebug_plat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/secilc \
|
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY)) \
|
|
|
|
$(built_sepolicy_neverallows)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c \
|
|
|
|
$(POLICYVERS) -o $@.tmp $<
|
|
|
|
$(hide) cat $(PRIVATE_ADDITIONAL_CIL_FILES) >> $@.tmp
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) $(PRIVATE_NEVERALLOW_ARG) $@.tmp -o /dev/null -f /dev/null
|
|
|
|
$(hide) mv $@.tmp $@
|
|
|
|
|
|
|
|
userdebug_plat_policy.conf :=
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY
|
|
|
|
LOCAL_MODULE := system_ext_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
# system_ext_policy.conf - A combination of the private and public system_ext policy
|
|
|
|
# which will ship with the device. System_ext policy is not attributized.
|
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) \
|
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY))
|
|
|
|
system_ext_policy.conf := $(intermediates)/system_ext_policy.conf
|
|
|
|
$(system_ext_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(system_ext_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-10-16 04:46:50 +02:00
|
|
|
$(system_ext_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(system_ext_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(system_ext_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(system_ext_policy.conf): $(policy_files) $(M4)
|
|
|
|
$(transform-policy-to-conf)
|
|
|
|
$(hide) sed '/dontaudit/d' $@ > $@.dontaudit
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PLAT_CIL := $(built_plat_cil)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(system_ext_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(HOST_OUT_EXECUTABLES)/secilc $(built_plat_cil)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c \
|
|
|
|
$(POLICYVERS) -o $@ $<
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_PLAT_CIL) -t $@
|
|
|
|
# Line markers (denoted by ;;) are malformed after above cmd. They are only
|
|
|
|
# used for debugging, so we remove them.
|
|
|
|
$(hide) grep -v ';;' $@ > $@.tmp
|
|
|
|
$(hide) mv $@.tmp $@
|
|
|
|
# Combine plat_sepolicy.cil and system_ext_sepolicy.cil to make sure that the
|
|
|
|
# latter doesn't accidentally depend on vendor/odm policies.
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) \
|
|
|
|
$(PRIVATE_NEVERALLOW_ARG) $(PRIVATE_PLAT_CIL) $@ -o /dev/null -f /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
built_system_ext_cil := $(LOCAL_BUILT_MODULE)
|
|
|
|
system_ext_policy.conf :=
|
|
|
|
endif # ifdef HAS_SYSTEM_EXT_SEPOLICY
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2018-12-14 23:30:56 +01:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY
|
|
|
|
LOCAL_MODULE := product_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
# product_policy.conf - A combination of the private and public product policy
|
|
|
|
# which will ship with the device. Product policy is not attributized.
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
|
2019-06-19 19:52:50 +02:00
|
|
|
$(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY))
|
2018-12-14 23:30:56 +01:00
|
|
|
product_policy.conf := $(intermediates)/product_policy.conf
|
|
|
|
$(product_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(product_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(product_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(product_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(product_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(product_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2018-12-14 23:30:56 +01:00
|
|
|
$(product_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(product_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(product_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(product_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(product_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(product_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(product_policy.conf): $(policy_files) $(M4)
|
2018-12-14 23:30:56 +01:00
|
|
|
$(transform-policy-to-conf)
|
|
|
|
$(hide) sed '/dontaudit/d' $@ > $@.dontaudit
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PLAT_CIL_FILES := $(built_plat_cil) $(built_system_ext_cil)
|
2018-12-14 23:30:56 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(product_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(HOST_OUT_EXECUTABLES)/secilc \
|
|
|
|
$(built_plat_cil) $(built_system_ext_cil)
|
2018-12-14 23:30:56 +01:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c \
|
|
|
|
$(POLICYVERS) -o $@ $<
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
2019-08-29 11:12:11 +02:00
|
|
|
-f $(PRIVATE_PLAT_CIL_FILES) -t $@
|
2018-12-14 23:30:56 +01:00
|
|
|
# Line markers (denoted by ;;) are malformed after above cmd. They are only
|
|
|
|
# used for debugging, so we remove them.
|
2018-12-19 21:22:05 +01:00
|
|
|
$(hide) grep -v ';;' $@ > $@.tmp
|
|
|
|
$(hide) mv $@.tmp $@
|
2019-08-29 11:12:11 +02:00
|
|
|
# Combine plat_sepolicy.cil, system_ext_sepolicy.cil and product_sepolicy.cil to
|
|
|
|
# make sure that the latter doesn't accidentally depend on vendor/odm policies.
|
2018-12-14 23:30:56 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PRIVATE_NEVERALLOW_ARG) $(PRIVATE_PLAT_CIL_FILES) $@ -o /dev/null -f /dev/null
|
2018-12-14 23:30:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
built_product_cil := $(LOCAL_BUILT_MODULE)
|
|
|
|
product_policy.conf :=
|
|
|
|
endif # ifdef HAS_PRODUCT_SEPOLICY
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2017-04-10 21:27:18 +02:00
|
|
|
LOCAL_MODULE := plat_sepolicy_vers.txt
|
2016-11-28 16:20:28 +01:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-04-10 21:27:18 +02:00
|
|
|
LOCAL_PROPRIETARY_MODULE := true
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_PLAT_SEPOL_VERS := $(BOARD_SEPOLICY_VERS)
|
|
|
|
$(LOCAL_BUILT_MODULE) :
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
echo $(PRIVATE_PLAT_SEPOL_VERS) > $@
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-01-16 00:16:55 +01:00
|
|
|
LOCAL_MODULE := plat_mapping_file
|
|
|
|
LOCAL_MODULE_STEM := $(PLATFORM_SEPOLICY_VERSION).cil
|
2017-04-10 21:27:18 +02:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux/mapping
|
2016-11-28 16:20:28 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
# auto-generate the mapping file for current platform policy, since it needs to
|
|
|
|
# track platform policy development
|
2019-01-15 02:25:17 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_VERS := $(PLATFORM_SEPOLICY_VERSION)
|
2019-01-16 00:16:55 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(plat_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
|
|
|
|
|
|
|
|
built_plat_mapping_cil := $(LOCAL_BUILT_MODULE)
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
|
2019-08-29 11:12:11 +02:00
|
|
|
LOCAL_MODULE := system_ext_mapping_file
|
|
|
|
LOCAL_MODULE_STEM := $(PLATFORM_SEPOLICY_VERSION).cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT)/etc/selinux/mapping
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_VERS := $(PLATFORM_SEPOLICY_VERSION)
|
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_PLAT_MAPPING_CIL := $(built_plat_mapping_cil)
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(system_ext_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy \
|
|
|
|
$(built_plat_mapping_cil)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
# Generate system_ext mapping file as mapping file of 'system' (plat) and 'system_ext'
|
|
|
|
# sepolicy minus plat_mapping_file.
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_PLAT_MAPPING_CIL) -t $@
|
|
|
|
|
|
|
|
built_system_ext_mapping_cil := $(LOCAL_BUILT_MODULE)
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
endif # ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
|
2019-08-29 11:12:11 +02:00
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
|
2019-01-16 00:16:55 +01:00
|
|
|
LOCAL_MODULE := product_mapping_file
|
|
|
|
LOCAL_MODULE_STEM := $(PLATFORM_SEPOLICY_VERSION).cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc/selinux/mapping
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_VERS := $(PLATFORM_SEPOLICY_VERSION)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_FILTER_CIL_FILES := $(built_plat_mapping_cil) $(built_system_ext_mapping_cil)
|
2019-01-16 00:16:55 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(built_plat_mapping_cil) $(built_system_ext_mapping_cil)
|
2016-11-28 16:20:28 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2019-01-16 00:16:55 +01:00
|
|
|
# Generate product mapping file as mapping file of all public sepolicy minus
|
2019-08-29 11:12:11 +02:00
|
|
|
# plat_mapping_file and system_ext_mapping_file.
|
2016-11-28 16:20:28 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
|
2019-01-16 00:16:55 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
2019-08-29 11:12:11 +02:00
|
|
|
-f $(PRIVATE_FILTER_CIL_FILES) -t $@
|
2016-11-28 16:20:28 +01:00
|
|
|
|
2019-01-16 00:16:55 +01:00
|
|
|
built_product_mapping_cil := $(LOCAL_BUILT_MODULE)
|
2019-10-04 09:36:05 +02:00
|
|
|
endif # ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
|
2016-11-28 16:20:28 +01:00
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
# plat_pub_versioned.cil - the exported platform policy associated with the version
|
|
|
|
# that non-platform policy targets.
|
|
|
|
LOCAL_MODULE := plat_pub_versioned.cil
|
2016-11-28 16:20:28 +01:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-03-02 21:39:25 +01:00
|
|
|
LOCAL_PROPRIETARY_MODULE := true
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
2016-11-28 16:20:28 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_TGT_POL := $(pub_policy.cil)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_DEP_CIL_FILES := $(built_plat_cil) $(built_system_ext_cil) \
|
|
|
|
$(built_product_cil) $(built_plat_mapping_cil) $(built_system_ext_mapping_cil) \
|
|
|
|
$(built_product_mapping_cil)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(HOST_OUT_EXECUTABLES)/secilc $(built_plat_cil) $(built_system_ext_cil) $(built_product_cil) \
|
|
|
|
$(built_plat_mapping_cil) $(built_system_ext_mapping_cil) $(built_product_mapping_cil)
|
2018-02-05 10:34:52 +01:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(HOST_OUT_EXECUTABLES)/version_policy -b $< -t $(PRIVATE_TGT_POL) -n $(PRIVATE_VERS) -o $@
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -N -c $(POLICYVERS) \
|
|
|
|
$(PRIVATE_DEP_CIL_FILES) $@ -o /dev/null -f /dev/null
|
|
|
|
|
2019-01-15 22:31:03 +01:00
|
|
|
built_pub_vers_cil := $(LOCAL_BUILT_MODULE)
|
2018-02-05 10:34:52 +01:00
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
# vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
|
|
|
|
# with the platform-provided policy. It makes use of the reqd_policy_mask files from private
|
|
|
|
# policy and the platform public policy files in order to use checkpolicy.
|
|
|
|
LOCAL_MODULE := vendor_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_PROPRIETARY_MODULE := true
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PLAT_PUBLIC_POLICY) $(SYSTEM_EXT_PUBLIC_POLICY) $(PRODUCT_PUBLIC_POLICY) \
|
|
|
|
$(REQD_MASK_POLICY) $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS))
|
2018-02-05 10:34:52 +01:00
|
|
|
vendor_policy.conf := $(intermediates)/vendor_policy.conf
|
|
|
|
$(vendor_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(vendor_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(vendor_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
2018-02-05 10:34:52 +01:00
|
|
|
$(vendor_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(vendor_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(vendor_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2018-02-05 10:34:52 +01:00
|
|
|
$(vendor_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(vendor_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(vendor_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(vendor_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(vendor_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(vendor_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(vendor_policy.conf): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2018-02-05 10:41:02 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_POL_CONF := $(vendor_policy.conf)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_CIL := $(pub_policy.cil)
|
2018-02-05 10:41:02 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_VERS := $(BOARD_SEPOLICY_VERS)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEP_CIL_FILES := $(built_plat_cil) $(built_system_ext_cil) \
|
|
|
|
$(built_product_cil) $(built_pub_vers_cil) $(built_plat_mapping_cil) \
|
|
|
|
$(built_system_ext_mapping_cil) $(built_product_mapping_cil)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_FILTER_CIL := $(built_pub_vers_cil)
|
2018-02-05 10:41:02 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/build_sepolicy \
|
2019-01-15 22:31:03 +01:00
|
|
|
$(vendor_policy.conf) $(reqd_policy_mask.cil) $(pub_policy.cil) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(built_plat_cil) $(built_system_ext_cil) $(built_product_cil) \
|
|
|
|
$(built_pub_vers_cil) $(built_plat_mapping_cil) $(built_system_ext_mapping_cil) \
|
|
|
|
$(built_product_mapping_cil)
|
2016-10-12 23:58:09 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2018-02-05 10:41:02 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) build_cil \
|
|
|
|
-i $(PRIVATE_POL_CONF) -m $(PRIVATE_REQD_MASK) -c $(CHECKPOLICY_ASAN_OPTIONS) \
|
|
|
|
-b $(PRIVATE_BASE_CIL) -d $(PRIVATE_DEP_CIL_FILES) -f $(PRIVATE_FILTER_CIL) \
|
|
|
|
-t $(PRIVATE_VERS) -p $(POLICYVERS) -o $@
|
2016-10-12 23:58:09 +02:00
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
built_vendor_cil := $(LOCAL_BUILT_MODULE)
|
|
|
|
vendor_policy.conf :=
|
2016-11-28 16:20:28 +01:00
|
|
|
|
2017-03-07 23:05:57 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2018-09-25 20:03:48 +02:00
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
2017-11-27 04:41:33 +01:00
|
|
|
# odm_policy.cil - the odm sepolicy. This needs attributization and to be combined
|
|
|
|
# with the platform-provided policy. It makes use of the reqd_policy_mask files from private
|
|
|
|
# policy and the platform public policy files in order to use checkpolicy.
|
|
|
|
LOCAL_MODULE := odm_sepolicy.cil
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_PROPRIETARY_MODULE := true
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PLAT_PUBLIC_POLICY) $(SYSTEM_EXT_PUBLIC_POLICY) $(PRODUCT_PUBLIC_POLICY) \
|
|
|
|
$(REQD_MASK_POLICY) $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_ODM_SEPOLICY_DIRS))
|
2017-11-27 04:41:33 +01:00
|
|
|
odm_policy.conf := $(intermediates)/odm_policy.conf
|
|
|
|
$(odm_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(odm_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(odm_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
|
|
|
$(odm_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(odm_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(odm_policy.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2017-11-27 04:41:33 +01:00
|
|
|
$(odm_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(odm_policy.conf): PRIVATE_SEPOLICY_SPLIT := $(PRODUCT_SEPOLICY_SPLIT)
|
|
|
|
$(odm_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(odm_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(odm_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(odm_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(odm_policy.conf): $(policy_files) $(M4)
|
2017-11-27 04:41:33 +01:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2017-11-27 04:41:33 +01:00
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_POL_CONF := $(odm_policy.conf)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_CIL := $(pub_policy.cil)
|
2017-11-27 04:41:33 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_VERS := $(BOARD_SEPOLICY_VERS)
|
2019-08-29 11:12:11 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEP_CIL_FILES := $(built_plat_cil) $(built_system_ext_cil) \
|
|
|
|
$(built_product_cil) $(built_pub_vers_cil) $(built_plat_mapping_cil) \
|
|
|
|
$(built_system_ext_mapping_cil) $(built_product_mapping_cil) $(built_vendor_cil)
|
2019-01-15 22:31:03 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_FILTER_CIL_FILES := $(built_pub_vers_cil) $(built_vendor_cil)
|
2017-11-27 04:41:33 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/build_sepolicy \
|
2019-01-15 22:31:03 +01:00
|
|
|
$(odm_policy.conf) $(reqd_policy_mask.cil) $(pub_policy.cil) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(built_plat_cil) $(built_system_ext_cil) $(built_product_cil) $(built_pub_vers_cil) \
|
|
|
|
$(built_plat_mapping_cil) $(built_system_ext_mapping_cil) $(built_product_mapping_cil) \
|
|
|
|
$(built_vendor_cil)
|
2017-11-27 04:41:33 +01:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) build_cil \
|
|
|
|
-i $(PRIVATE_POL_CONF) -m $(PRIVATE_REQD_MASK) -c $(CHECKPOLICY_ASAN_OPTIONS) \
|
|
|
|
-b $(PRIVATE_BASE_CIL) -d $(PRIVATE_DEP_CIL_FILES) -f $(PRIVATE_FILTER_CIL_FILES) \
|
|
|
|
-t $(PRIVATE_VERS) -p $(POLICYVERS) -o $@
|
|
|
|
|
|
|
|
built_odm_cil := $(LOCAL_BUILT_MODULE)
|
|
|
|
odm_policy.conf :=
|
|
|
|
odm_policy_raw :=
|
2018-09-25 20:03:48 +02:00
|
|
|
endif
|
2017-11-27 04:41:33 +01:00
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2017-03-07 23:05:57 +01:00
|
|
|
LOCAL_MODULE := precompiled_sepolicy
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_PROPRIETARY_MODULE := true
|
2017-11-27 04:41:33 +01:00
|
|
|
|
|
|
|
ifeq ($(BOARD_USES_ODMIMAGE),true)
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
|
|
|
|
else
|
2017-03-07 23:05:57 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
2017-11-27 04:41:33 +01:00
|
|
|
endif
|
2017-03-07 23:05:57 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
all_cil_files := \
|
|
|
|
$(built_plat_cil) \
|
2019-01-16 00:16:55 +01:00
|
|
|
$(built_plat_mapping_cil) \
|
2019-01-15 22:31:03 +01:00
|
|
|
$(built_pub_vers_cil) \
|
2018-02-05 10:34:52 +01:00
|
|
|
$(built_vendor_cil)
|
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
all_cil_files += $(built_system_ext_cil)
|
|
|
|
endif
|
2019-08-29 11:12:11 +02:00
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
|
|
|
|
all_cil_files += $(built_system_ext_mapping_cil)
|
2019-08-29 11:12:11 +02:00
|
|
|
endif
|
|
|
|
|
2018-12-14 23:30:56 +01:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY
|
2019-10-04 09:36:05 +02:00
|
|
|
all_cil_files += $(built_product_cil)
|
|
|
|
endif
|
2019-01-16 00:16:55 +01:00
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
|
|
|
|
all_cil_files += $(built_product_mapping_cil)
|
2018-12-14 23:30:56 +01:00
|
|
|
endif
|
|
|
|
|
2017-11-27 04:41:33 +01:00
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
|
|
|
all_cil_files += $(built_odm_cil)
|
|
|
|
endif
|
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(all_cil_files)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
2018-02-05 10:34:52 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(all_cil_files) $(built_sepolicy_neverallows)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) $(PRIVATE_NEVERALLOW_ARG) \
|
2017-03-07 23:05:57 +01:00
|
|
|
$(PRIVATE_CIL_FILES) -o $@ -f /dev/null
|
|
|
|
|
|
|
|
built_precompiled_sepolicy := $(LOCAL_BUILT_MODULE)
|
2018-02-05 10:34:52 +01:00
|
|
|
all_cil_files :=
|
2017-03-07 23:05:57 +01:00
|
|
|
|
|
|
|
#################################
|
2019-01-23 03:07:58 +01:00
|
|
|
# Precompiled sepolicy is loaded if and only if:
|
|
|
|
# - plat_sepolicy_and_mapping.sha256 equals
|
|
|
|
# precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
|
|
|
|
# AND
|
2019-08-29 11:12:11 +02:00
|
|
|
# - system_ext_sepolicy_and_mapping.sha256 equals
|
|
|
|
# precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
|
|
|
|
# AND
|
2019-01-23 03:07:58 +01:00
|
|
|
# - product_sepolicy_and_mapping.sha256 equals
|
|
|
|
# precompiled_sepolicy.product_sepolicy_and_mapping.sha256
|
|
|
|
# See system/core/init/selinux.cpp for details.
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := plat_sepolicy_and_mapping.sha256
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH = $(TARGET_OUT)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_plat_cil) $(built_plat_mapping_cil)
|
|
|
|
cat $^ | sha256sum | cut -d' ' -f1 > $@
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
LOCAL_MODULE := system_ext_sepolicy_and_mapping.sha256
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH = $(TARGET_OUT_SYSTEM_EXT)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_system_ext_cil) $(built_system_ext_mapping_cil)
|
|
|
|
cat $^ | sha256sum | cut -d' ' -f1 > $@
|
|
|
|
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2019-01-23 03:07:58 +01:00
|
|
|
LOCAL_MODULE := product_sepolicy_and_mapping.sha256
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH = $(TARGET_OUT_PRODUCT)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_product_cil) $(built_product_mapping_cil)
|
|
|
|
cat $^ | sha256sum | cut -d' ' -f1 > $@
|
|
|
|
|
|
|
|
#################################
|
|
|
|
# SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
|
2017-04-04 23:27:41 +02:00
|
|
|
# which precompiled_policy was built.
|
2017-03-07 23:05:57 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
2019-01-23 03:07:58 +01:00
|
|
|
LOCAL_MODULE := precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
|
2017-03-07 23:05:57 +01:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-11-27 04:41:33 +01:00
|
|
|
|
|
|
|
ifeq ($(BOARD_USES_ODMIMAGE),true)
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
|
|
|
|
else
|
2017-03-07 23:05:57 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
2017-11-27 04:41:33 +01:00
|
|
|
endif
|
2017-03-07 23:05:57 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-01-23 03:07:58 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(built_plat_cil) $(built_plat_mapping_cil)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_precompiled_sepolicy) $(built_plat_cil) $(built_plat_mapping_cil)
|
|
|
|
cat $(PRIVATE_CIL_FILES) | sha256sum | cut -d' ' -f1 > $@
|
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
#################################
|
|
|
|
# SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
|
|
|
|
# which precompiled_policy was built.
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
|
|
|
|
ifeq ($(BOARD_USES_ODMIMAGE),true)
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
|
|
|
|
else
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(built_system_ext_cil) $(built_system_ext_mapping_cil)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_precompiled_sepolicy) $(built_system_ext_cil) $(built_system_ext_mapping_cil)
|
|
|
|
cat $(PRIVATE_CIL_FILES) | sha256sum | cut -d' ' -f1 > $@
|
|
|
|
|
2019-01-23 03:07:58 +01:00
|
|
|
#################################
|
|
|
|
# SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
|
|
|
|
# which precompiled_policy was built.
|
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := precompiled_sepolicy.product_sepolicy_and_mapping.sha256
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
|
|
|
|
ifeq ($(BOARD_USES_ODMIMAGE),true)
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
|
|
|
|
else
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(built_product_cil) $(built_product_mapping_cil)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_precompiled_sepolicy) $(built_product_cil) $(built_product_mapping_cil)
|
2017-04-04 23:27:41 +02:00
|
|
|
cat $(PRIVATE_CIL_FILES) | sha256sum | cut -d' ' -f1 > $@
|
2017-03-07 23:05:57 +01:00
|
|
|
|
2016-11-28 16:20:28 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
2016-12-16 00:28:44 +01:00
|
|
|
# build this target so that we can still perform neverallow checks
|
2016-11-28 16:20:28 +01:00
|
|
|
|
|
|
|
LOCAL_MODULE := sepolicy
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2016-12-17 01:53:26 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
2016-10-12 23:58:09 +02:00
|
|
|
|
2016-11-28 16:20:28 +01:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
all_cil_files := \
|
2017-04-22 00:57:07 +02:00
|
|
|
$(built_plat_cil) \
|
2019-01-16 00:16:55 +01:00
|
|
|
$(built_plat_mapping_cil) \
|
2019-01-15 22:31:03 +01:00
|
|
|
$(built_pub_vers_cil) \
|
2018-02-05 10:34:52 +01:00
|
|
|
$(built_vendor_cil)
|
2016-10-12 23:58:09 +02:00
|
|
|
|
2019-08-29 11:12:11 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
all_cil_files += $(built_system_ext_cil)
|
|
|
|
endif
|
2019-08-29 11:12:11 +02:00
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY
|
|
|
|
all_cil_files += $(built_system_ext_mapping_cil)
|
2019-08-29 11:12:11 +02:00
|
|
|
endif
|
|
|
|
|
2018-12-14 23:30:56 +01:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY
|
2019-10-04 09:36:05 +02:00
|
|
|
all_cil_files += $(built_product_cil)
|
|
|
|
endif
|
2019-01-16 00:16:55 +01:00
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_PUBLIC_SEPOLICY
|
|
|
|
all_cil_files += $(built_product_mapping_cil)
|
2018-12-14 23:30:56 +01:00
|
|
|
endif
|
|
|
|
|
2017-11-27 04:41:33 +01:00
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
|
|
|
all_cil_files += $(built_odm_cil)
|
|
|
|
endif
|
|
|
|
|
2016-10-12 23:58:09 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(all_cil_files)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $(all_cil_files) \
|
|
|
|
$(built_sepolicy_neverallows)
|
2016-10-12 23:58:09 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2018-01-04 01:53:24 +01:00
|
|
|
$(hide) $< -m -M true -G -c $(POLICYVERS) $(PRIVATE_NEVERALLOW_ARG) $(PRIVATE_CIL_FILES) -o $@.tmp -f /dev/null
|
2016-02-27 05:06:52 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp permissive > $@.permissivedomains
|
|
|
|
$(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s $@.permissivedomains ]; then \
|
|
|
|
echo "==========" 1>&2; \
|
|
|
|
echo "ERROR: permissive domains not allowed in user builds" 1>&2; \
|
|
|
|
echo "List of invalid domains:" 1>&2; \
|
|
|
|
cat $@.permissivedomains 1>&2; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
$(hide) mv $@.tmp $@
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-10-26 04:01:31 +02:00
|
|
|
built_sepolicy := $(LOCAL_BUILT_MODULE)
|
2016-10-12 23:58:09 +02:00
|
|
|
all_cil_files :=
|
2012-10-02 18:46:37 +02:00
|
|
|
|
2017-03-10 18:36:07 +01:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
# keep concrete sepolicy for neverallow checks
|
2018-01-04 01:53:24 +01:00
|
|
|
# If SELINUX_IGNORE_NEVERALLOWS is set, we use sed to remove the neverallow lines before compiling.
|
2017-03-10 18:36:07 +01:00
|
|
|
|
|
|
|
LOCAL_MODULE := sepolicy.recovery
|
2017-03-10 21:44:16 +01:00
|
|
|
LOCAL_MODULE_STEM := sepolicy
|
2017-03-10 18:36:07 +01:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-03-10 21:44:16 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)
|
2017-03-10 18:36:07 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \
|
2019-06-19 19:52:50 +02:00
|
|
|
$(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY) \
|
|
|
|
$(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) \
|
|
|
|
$(BOARD_ODM_SEPOLICY_DIRS))
|
2017-04-11 16:38:48 +02:00
|
|
|
sepolicy.recovery.conf := $(intermediates)/sepolicy.recovery.conf
|
|
|
|
$(sepolicy.recovery.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(sepolicy.recovery.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_TARGET_BUILD_VARIANT := $(TARGET_BUILD_VARIANT)
|
2017-04-11 16:38:48 +02:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(sepolicy.recovery.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
2019-06-14 00:05:15 +02:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_TGT_WITH_NATIVE_COVERAGE := $(with_native_coverage)
|
2017-04-11 16:38:48 +02:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_TGT_RECOVERY := -D target_recovery=true
|
2019-06-19 19:52:50 +02:00
|
|
|
$(sepolicy.recovery.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(sepolicy.recovery.conf): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
|
|
|
|
2018-01-04 01:53:24 +01:00
|
|
|
ifeq ($(SELINUX_IGNORE_NEVERALLOWS),true)
|
|
|
|
$(hide) sed -z 's/\n\s*neverallow[^;]*;/\n/g' $@ > $@.neverallow
|
|
|
|
$(hide) mv $@.neverallow $@
|
|
|
|
endif
|
2016-12-16 00:28:44 +01:00
|
|
|
|
2017-04-11 16:38:48 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): $(sepolicy.recovery.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/sepolicy-analyze
|
2016-12-16 00:28:44 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2017-04-28 02:16:13 +02:00
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c \
|
|
|
|
$(POLICYVERS) -o $@.tmp $<
|
2016-02-27 05:06:52 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp permissive > $@.permissivedomains
|
|
|
|
$(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s $@.permissivedomains ]; then \
|
|
|
|
echo "==========" 1>&2; \
|
|
|
|
echo "ERROR: permissive domains not allowed in user builds" 1>&2; \
|
|
|
|
echo "List of invalid domains:" 1>&2; \
|
|
|
|
cat $@.permissivedomains 1>&2; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
$(hide) mv $@.tmp $@
|
2014-05-29 22:40:15 +02:00
|
|
|
|
2017-04-11 16:38:48 +02:00
|
|
|
sepolicy.recovery.conf :=
|
2014-05-29 22:40:15 +02:00
|
|
|
|
2017-04-06 23:45:50 +02:00
|
|
|
##################################
|
|
|
|
# SELinux policy embedded into CTS.
|
|
|
|
# CTS checks neverallow rules of this policy against the policy of the device under test.
|
2014-07-26 04:11:52 +02:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := general_sepolicy.conf
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := tests
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
|
2014-07-26 04:11:52 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-08 00:36:29 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_BUILD_VARIANT := user
|
2016-12-16 00:28:44 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_TGT_ARCH := $(my_target_arch)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_WITH_ASAN := false
|
2017-11-09 20:24:56 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY_SPLIT := cts
|
2018-01-30 09:23:58 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_COMPATIBLE_PROPERTY := cts
|
2019-09-26 08:14:55 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := cts
|
2020-09-28 06:32:43 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_ENFORCE_SYSPROP_OWNER := cts
|
2018-06-05 23:11:08 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_EXCLUDE_BUILD_TEST := true
|
2019-06-19 19:52:50 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(policy_files) $(M4)
|
2017-07-07 23:59:51 +02:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2014-07-26 04:11:52 +02:00
|
|
|
|
2015-06-30 01:31:23 +02:00
|
|
|
##################################
|
2016-12-12 18:29:04 +01:00
|
|
|
# TODO - remove this. Keep around until we get the filesystem creation stuff taken care of.
|
|
|
|
#
|
2015-06-30 01:31:23 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2015-08-06 18:43:52 +02:00
|
|
|
LOCAL_MODULE := file_contexts.bin
|
2012-01-18 02:51:09 +01:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
|
|
|
|
2012-03-06 17:12:41 +01:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2016-01-04 21:20:57 +01:00
|
|
|
# The file_contexts.bin is built in the following way:
|
|
|
|
# 1. Collect all file_contexts files in THIS repository and process them with
|
|
|
|
# m4 into a tmp file called file_contexts.local.tmp.
|
2020-09-23 12:16:10 +02:00
|
|
|
# 2. Collect all file_contexts files from LOCAL_FILE_CONTEXTS of installed
|
|
|
|
# modules with m4 with a tmp file called file_contexts.modules.tmp.
|
|
|
|
# 3. Collect all device specific file_contexts files and process them with m4
|
2016-01-04 21:20:57 +01:00
|
|
|
# into a tmp file called file_contexts.device.tmp.
|
2020-09-23 12:16:10 +02:00
|
|
|
# 4. Run checkfc -e (allow no device fc entries ie empty) and fc_sort on
|
2016-01-04 21:20:57 +01:00
|
|
|
# file_contexts.device.tmp and output to file_contexts.device.sorted.tmp.
|
2020-09-23 12:16:10 +02:00
|
|
|
# 5. Concatenate file_contexts.local.tmp, file_contexts.modules.tmp and
|
|
|
|
# file_contexts.device.tmp into file_contexts.concat.tmp.
|
|
|
|
# 6. Run checkfc and sefcontext_compile on file_contexts.concat.tmp to produce
|
2016-01-04 21:20:57 +01:00
|
|
|
# file_contexts.bin.
|
|
|
|
#
|
|
|
|
# Note: That a newline file is placed between each file_context file found to
|
|
|
|
# ensure a proper build when an fc file is missing an ending newline.
|
|
|
|
|
2017-05-08 23:26:52 +02:00
|
|
|
local_fc_files := $(call build_policy, file_contexts, $(PLAT_PRIVATE_POLICY))
|
|
|
|
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
2019-09-09 16:04:06 +02:00
|
|
|
local_fc_files += $(call build_policy, file_contexts, $(SYSTEM_EXT_PRIVATE_POLICY))
|
|
|
|
endif
|
|
|
|
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY_DIR
|
2018-12-14 23:30:56 +01:00
|
|
|
local_fc_files += $(call build_policy, file_contexts, $(PRODUCT_PRIVATE_POLICY))
|
|
|
|
endif
|
|
|
|
|
2015-09-18 21:05:51 +02:00
|
|
|
ifneq ($(filter address,$(SANITIZE_TARGET)),)
|
2018-06-13 17:02:29 +02:00
|
|
|
local_fc_files += $(wildcard $(addsuffix /file_contexts_asan, $(PLAT_PRIVATE_POLICY)))
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
|
|
|
local_fc_files += $(wildcard $(addsuffix /file_contexts_overlayfs, $(PLAT_PRIVATE_POLICY)))
|
2015-06-13 02:18:20 +02:00
|
|
|
endif
|
2019-11-20 09:54:34 +01:00
|
|
|
|
2016-01-04 21:20:57 +01:00
|
|
|
file_contexts.local.tmp := $(intermediates)/file_contexts.local.tmp
|
2020-09-23 12:16:10 +02:00
|
|
|
$(call merge-fc-files,$(local_fc_files),$(file_contexts.local.tmp))
|
|
|
|
|
|
|
|
# The rule for file_contexts.modules.tmp is defined in build/make/core/Makefile.
|
|
|
|
# it gathers LOCAL_FILE_CONTEXTS from product_MODULES
|
|
|
|
file_contexts.modules.tmp := $(intermediates)/file_contexts.modules.tmp
|
2016-01-04 21:20:57 +01:00
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
device_fc_files := $(call build_vendor_policy, file_contexts)
|
2017-11-29 09:14:53 +01:00
|
|
|
|
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
|
|
|
device_fc_files += $(call build_odm_policy, file_contexts)
|
|
|
|
endif
|
|
|
|
|
2016-01-04 21:20:57 +01:00
|
|
|
file_contexts.device.tmp := $(intermediates)/file_contexts.device.tmp
|
|
|
|
$(file_contexts.device.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(file_contexts.device.tmp): PRIVATE_DEVICE_FC_FILES := $(device_fc_files)
|
|
|
|
$(file_contexts.device.tmp): $(device_fc_files) $(M4)
|
2016-01-04 21:20:57 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_DEVICE_FC_FILES) > $@
|
2016-01-04 21:20:57 +01:00
|
|
|
|
|
|
|
file_contexts.device.sorted.tmp := $(intermediates)/file_contexts.device.sorted.tmp
|
|
|
|
$(file_contexts.device.sorted.tmp): PRIVATE_SEPOLICY := $(built_sepolicy)
|
2018-02-05 10:34:52 +01:00
|
|
|
$(file_contexts.device.sorted.tmp): $(file_contexts.device.tmp) $(built_sepolicy) \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/fc_sort $(HOST_OUT_EXECUTABLES)/checkfc
|
2016-01-04 21:20:57 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2016-12-07 20:27:47 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e $(PRIVATE_SEPOLICY) $<
|
2019-04-11 01:53:17 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/fc_sort -i $< -o $@
|
2012-10-02 18:46:37 +02:00
|
|
|
|
2016-01-04 21:20:57 +01:00
|
|
|
file_contexts.concat.tmp := $(intermediates)/file_contexts.concat.tmp
|
2020-09-23 12:16:10 +02:00
|
|
|
$(call merge-fc-files,\
|
|
|
|
$(file_contexts.local.tmp) $(file_contexts.modules.tmp) $(file_contexts.device.sorted.tmp),\
|
|
|
|
$(file_contexts.concat.tmp))
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2015-09-25 19:18:44 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
2016-01-04 21:20:57 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(file_contexts.concat.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/sefcontext_compile $(HOST_OUT_EXECUTABLES)/checkfc
|
2015-08-06 18:43:52 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2016-12-07 20:27:47 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $<
|
2015-08-06 18:43:52 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/sefcontext_compile -o $@ $<
|
|
|
|
|
2014-03-20 14:35:08 +01:00
|
|
|
built_fc := $(LOCAL_BUILT_MODULE)
|
2016-01-04 21:20:57 +01:00
|
|
|
local_fc_files :=
|
|
|
|
local_fcfiles_with_nl :=
|
|
|
|
device_fc_files :=
|
|
|
|
device_fcfiles_with_nl :=
|
|
|
|
file_contexts.concat.tmp :=
|
|
|
|
file_contexts.device.sorted.tmp :=
|
|
|
|
file_contexts.device.tmp :=
|
|
|
|
file_contexts.local.tmp :=
|
2020-09-23 12:16:10 +02:00
|
|
|
file_contexts.modules.tmp :=
|
2012-08-16 19:55:05 +02:00
|
|
|
|
2017-09-26 21:58:29 +02:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := selinux_denial_metadata
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
2019-01-23 18:47:05 +01:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2019-06-07 02:09:29 +02:00
|
|
|
bug_files := $(call build_policy, bug_map, $(LOCAL_PATH) $(PLAT_PRIVATE_POLICY) $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(PLAT_PUBLIC_POLICY))
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(bug_files)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
cat $^ > $@
|
|
|
|
|
|
|
|
bug_files :=
|
2017-03-10 21:44:16 +01:00
|
|
|
|
|
|
|
##################################
|
2019-01-08 01:43:31 +01:00
|
|
|
include $(LOCAL_PATH)/seapp_contexts.mk
|
2014-06-06 00:52:02 +02:00
|
|
|
|
2018-12-21 21:28:14 +01:00
|
|
|
##################################
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
include $(LOCAL_PATH)/contexts_tests.mk
|
2017-04-08 01:14:43 +02:00
|
|
|
|
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2017-04-01 02:29:53 +02:00
|
|
|
LOCAL_MODULE := vndservice_contexts
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
vnd_svcfiles := $(call build_policy, vndservice_contexts, $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
|
2017-04-01 02:29:53 +02:00
|
|
|
|
|
|
|
vndservice_contexts.tmp := $(intermediates)/vndservice_contexts.tmp
|
|
|
|
$(vndservice_contexts.tmp): PRIVATE_SVC_FILES := $(vnd_svcfiles)
|
|
|
|
$(vndservice_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(vndservice_contexts.tmp): $(vnd_svcfiles) $(M4)
|
2017-04-01 02:29:53 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@
|
2017-04-01 02:29:53 +02:00
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(vndservice_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
sed -e 's/#.*$$//' -e '/^$$/d' $< > $@
|
2017-04-07 19:08:55 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e -v $(PRIVATE_SEPOLICY) $@
|
2017-04-01 02:29:53 +02:00
|
|
|
|
|
|
|
vnd_svcfiles :=
|
|
|
|
vndservice_contexts.tmp :=
|
2018-12-22 01:07:21 +01:00
|
|
|
|
|
|
|
##################################
|
2019-01-08 01:43:31 +01:00
|
|
|
include $(LOCAL_PATH)/mac_permissions.mk
|
2017-11-29 09:06:15 +01:00
|
|
|
|
2017-09-26 21:58:29 +02:00
|
|
|
#################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := sepolicy_tests
|
2019-05-29 18:05:43 +02:00
|
|
|
LOCAL_MODULE_CLASS := FAKE
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
all_fc_files := $(TARGET_OUT)/etc/selinux/plat_file_contexts
|
|
|
|
all_fc_files += $(TARGET_OUT_VENDOR)/etc/selinux/vendor_file_contexts
|
Allowing system_ext sepolicy to be empty
Some targets just need to extend system_ext context files, e.g.,
file_contexts, service_contexts, etc., without adding any system_ext
policy files, e.g., *.te files.
Currently, this will lead to build errors. This CL allows
system_ext_sepolicy.cil and the system_ext mapping file
to be empty.
It's now also possible to just set BOARD_PLAT_PRIVATE_SEPOLICY_DIR
without setting BOARD_PLAT_PUBLIC_SEPOLICY_DIR.
Bug: 137712473
Bug: 141880898
Test: Only adds system_ext context files without policy files (e.g., *.te),
then `mmma system/sepolicy` can build pass
Change-Id: I72849f2d4aa43e5296cd15c07a8fd058186a6376
2019-10-04 08:34:18 +02:00
|
|
|
ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
2019-09-09 16:04:06 +02:00
|
|
|
all_fc_files += $(TARGET_OUT_SYSTEM_EXT)/etc/selinux/system_ext_file_contexts
|
|
|
|
endif
|
2019-10-04 09:36:05 +02:00
|
|
|
ifdef HAS_PRODUCT_SEPOLICY_DIR
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
all_fc_files += $(TARGET_OUT_PRODUCT)/etc/selinux/product_file_contexts
|
2018-12-19 04:51:19 +01:00
|
|
|
endif
|
2017-11-29 09:14:53 +01:00
|
|
|
ifdef BOARD_ODM_SEPOLICY_DIRS
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
all_fc_files += $(TARGET_OUT_ODM)/etc/selinux/odm_file_contexts
|
2017-11-29 09:14:53 +01:00
|
|
|
endif
|
2018-02-05 10:34:52 +01:00
|
|
|
all_fc_args := $(foreach file, $(all_fc_files), -f $(file))
|
|
|
|
|
2019-05-29 18:05:43 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): ALL_FC_ARGS := $(all_fc_args)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/sepolicy_tests $(all_fc_files) $(built_sepolicy)
|
2017-09-26 21:58:29 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2017-10-04 18:42:29 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy_tests -l $(HOST_OUT)/lib64/libsepolwrap.$(SHAREDLIB_EXT) \
|
2018-02-05 10:34:52 +01:00
|
|
|
$(ALL_FC_ARGS) -p $(PRIVATE_SEPOLICY)
|
2017-09-26 21:58:29 +02:00
|
|
|
$(hide) touch $@
|
|
|
|
|
2014-03-20 14:35:08 +01:00
|
|
|
##################################
|
2018-02-01 01:22:35 +01:00
|
|
|
intermediates := $(call intermediates-dir-for,ETC,built_plat_sepolicy,,,,)
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
# plat_sepolicy - the current platform policy only, built into a policy binary.
|
|
|
|
# TODO - this currently excludes partner extensions, but support should be added
|
|
|
|
# to enable partners to add their own compatibility mapping
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
|
2017-09-26 21:58:29 +02:00
|
|
|
base_plat_policy.conf := $(intermediates)/base_plat_policy.conf
|
|
|
|
$(base_plat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(base_plat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2018-03-23 20:40:26 +01:00
|
|
|
$(base_plat_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := user
|
2017-09-26 21:58:29 +02:00
|
|
|
$(base_plat_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(base_plat_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
|
|
|
$(base_plat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
2017-11-09 20:24:56 +01:00
|
|
|
$(base_plat_policy.conf): PRIVATE_SEPOLICY_SPLIT := true
|
2017-10-19 09:54:49 +02:00
|
|
|
$(base_plat_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(base_plat_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(base_plat_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(base_plat_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(base_plat_policy.conf): $(policy_files) $(M4)
|
2017-09-26 21:58:29 +02:00
|
|
|
$(transform-policy-to-conf)
|
2018-09-13 08:04:19 +02:00
|
|
|
$(hide) sed '/^\s*dontaudit.*;/d' $@ | sed '/^\s*dontaudit/,/;/d' > $@.dontaudit
|
2017-09-26 21:58:29 +02:00
|
|
|
|
|
|
|
built_plat_sepolicy := $(intermediates)/built_plat_sepolicy
|
|
|
|
$(built_plat_sepolicy): PRIVATE_ADDITIONAL_CIL_FILES := \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY))
|
2018-01-04 01:53:24 +01:00
|
|
|
$(built_plat_sepolicy): PRIVATE_NEVERALLOW_ARG := $(NEVERALLOW_ARG)
|
2017-09-26 21:58:29 +02:00
|
|
|
$(built_plat_sepolicy): $(base_plat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/secilc \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY)) \
|
2018-01-04 01:53:24 +01:00
|
|
|
$(built_sepolicy_neverallows)
|
2017-09-26 21:58:29 +02:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c \
|
|
|
|
$(POLICYVERS) -o $@ $<
|
|
|
|
$(hide) cat $(PRIVATE_ADDITIONAL_CIL_FILES) >> $@
|
2018-01-04 01:53:24 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/secilc -m -M true -G -c $(POLICYVERS) $(PRIVATE_NEVERALLOW_ARG) $@ -o $@ -f /dev/null
|
2017-09-26 21:58:29 +02:00
|
|
|
|
2019-06-19 19:52:50 +02:00
|
|
|
policy_files := $(call build_policy, $(sepolicy_build_files), \
|
2019-08-29 11:12:11 +02:00
|
|
|
$(PLAT_PUBLIC_POLICY) $(REQD_MASK_POLICY))
|
2018-09-29 02:21:08 +02:00
|
|
|
base_plat_pub_policy.conf := $(intermediates)/base_plat_pub_policy.conf
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_TARGET_BUILD_VARIANT := user
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch)
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan)
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_SEPOLICY_SPLIT := true
|
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY)
|
2019-09-26 08:14:55 +02:00
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_TREBLE_SYSPROP_NEVERALLOW := $(treble_sysprop_neverallow)
|
2020-09-28 06:32:43 +02:00
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_ENFORCE_SYSPROP_OWNER := $(enforce_sysprop_owner)
|
2019-06-19 19:52:50 +02:00
|
|
|
$(base_plat_pub_policy.conf): PRIVATE_POLICY_FILES := $(policy_files)
|
|
|
|
$(base_plat_pub_policy.conf): $(policy_files) $(M4)
|
2018-09-29 02:21:08 +02:00
|
|
|
$(transform-policy-to-conf)
|
|
|
|
|
|
|
|
base_plat_pub_policy.cil := $(intermediates)/base_plat_pub_policy.cil
|
|
|
|
$(base_plat_pub_policy.cil): PRIVATE_POL_CONF := $(base_plat_pub_policy.conf)
|
|
|
|
$(base_plat_pub_policy.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil)
|
2018-12-18 01:35:41 +01:00
|
|
|
$(base_plat_pub_policy.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy \
|
|
|
|
$(HOST_OUT_EXECUTABLES)/build_sepolicy $(base_plat_pub_policy.conf) $(reqd_policy_mask.cil)
|
2018-09-29 02:21:08 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2018-12-18 01:35:41 +01:00
|
|
|
$(hide) $(CHECKPOLICY_ASAN_OPTIONS) $< -C -M -c $(POLICYVERS) -o $@ $(PRIVATE_POL_CONF)
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/build_sepolicy -a $(HOST_OUT_EXECUTABLES) filter_out \
|
|
|
|
-f $(PRIVATE_REQD_MASK) -t $@
|
2018-09-29 02:21:08 +02:00
|
|
|
|
2019-09-20 20:16:29 +02:00
|
|
|
ifeq ($(PRODUCT_SEPOLICY_SPLIT),true)
|
2018-02-01 01:22:35 +01:00
|
|
|
# Tests for Treble compatibility of current platform policy and vendor policy of
|
|
|
|
# given release version.
|
|
|
|
version_under_treble_tests := 26.0
|
|
|
|
include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk
|
2018-02-01 01:50:28 +01:00
|
|
|
version_under_treble_tests := 27.0
|
|
|
|
include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk
|
2018-07-11 11:30:44 +02:00
|
|
|
version_under_treble_tests := 28.0
|
|
|
|
include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk
|
2019-06-02 02:04:13 +02:00
|
|
|
version_under_treble_tests := 29.0
|
|
|
|
include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk
|
2020-05-07 13:19:05 +02:00
|
|
|
version_under_treble_tests := 30.0
|
|
|
|
include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk
|
2019-09-20 20:16:29 +02:00
|
|
|
endif # PRODUCT_SEPOLICY_SPLIT
|
2018-07-11 11:30:44 +02:00
|
|
|
|
2019-05-02 22:48:44 +02:00
|
|
|
version_under_treble_tests := 26.0
|
|
|
|
include $(LOCAL_PATH)/compat.mk
|
|
|
|
version_under_treble_tests := 27.0
|
|
|
|
include $(LOCAL_PATH)/compat.mk
|
|
|
|
version_under_treble_tests := 28.0
|
|
|
|
include $(LOCAL_PATH)/compat.mk
|
2019-06-02 02:04:13 +02:00
|
|
|
version_under_treble_tests := 29.0
|
|
|
|
include $(LOCAL_PATH)/compat.mk
|
2020-05-07 13:19:05 +02:00
|
|
|
version_under_treble_tests := 30.0
|
|
|
|
include $(LOCAL_PATH)/compat.mk
|
2019-05-02 22:48:44 +02:00
|
|
|
|
2017-09-26 21:58:29 +02:00
|
|
|
base_plat_policy.conf :=
|
2018-09-29 02:21:08 +02:00
|
|
|
base_plat_pub_policy.conf :=
|
2017-09-26 21:58:29 +02:00
|
|
|
plat_sepolicy :=
|
Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.
The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.
Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.
Change-Id: I576f6f20686f6f2121204f76657274696d652121
2019-04-15 13:10:46 +02:00
|
|
|
all_fc_files :=
|
|
|
|
all_fc_args :=
|
2017-09-26 21:58:29 +02:00
|
|
|
|
2017-06-01 00:36:07 +02:00
|
|
|
#################################
|
2018-03-15 19:38:08 +01:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := sepolicy_freeze_test
|
2019-05-29 18:05:43 +02:00
|
|
|
LOCAL_MODULE_CLASS := FAKE
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
2018-03-15 19:38:08 +01:00
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2020-10-08 23:39:42 +02:00
|
|
|
define ziplist
|
|
|
|
$(if $(and $1,$2), "$(firstword $1) $(firstword $2)"\
|
|
|
|
$(call ziplist,$(wordlist 2,$(words $1),$1),$(wordlist 2,$(words $2),$2)))
|
|
|
|
endef
|
|
|
|
|
2018-03-15 19:38:08 +01:00
|
|
|
base_plat_public := $(LOCAL_PATH)/public
|
|
|
|
base_plat_private := $(LOCAL_PATH)/private
|
|
|
|
base_plat_public_prebuilt := \
|
|
|
|
$(LOCAL_PATH)/prebuilts/api/$(PLATFORM_SEPOLICY_VERSION)/public
|
|
|
|
base_plat_private_prebuilt := \
|
|
|
|
$(LOCAL_PATH)/prebuilts/api/$(PLATFORM_SEPOLICY_VERSION)/private
|
|
|
|
|
|
|
|
all_frozen_files := $(call build_policy,$(sepolicy_build_files), \
|
|
|
|
$(base_plat_public) $(base_plat_private) $(base_plat_public_prebuilt) $(base_plat_private_prebuilt))
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_PLAT_PUBLIC := $(base_plat_public)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_PLAT_PRIVATE := $(base_plat_private)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_PLAT_PUBLIC_PREBUILT := $(base_plat_public_prebuilt)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_BASE_PLAT_PRIVATE_PREBUILT := $(base_plat_private_prebuilt)
|
2020-10-08 23:39:42 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_EXTRA := $(sort $(FREEZE_TEST_EXTRA_DIRS))
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_EXTRA_PREBUILT := $(sort $(FREEZE_TEST_EXTRA_PREBUILT_DIRS))
|
2018-03-15 19:38:08 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(all_frozen_files)
|
|
|
|
ifneq ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION))
|
2018-05-22 18:22:41 +02:00
|
|
|
@diff -rq -x bug_map $(PRIVATE_BASE_PLAT_PUBLIC_PREBUILT) $(PRIVATE_BASE_PLAT_PUBLIC)
|
|
|
|
@diff -rq -x bug_map $(PRIVATE_BASE_PLAT_PRIVATE_PREBUILT) $(PRIVATE_BASE_PLAT_PRIVATE)
|
2020-10-08 23:39:42 +02:00
|
|
|
ifneq (,$(FREEZE_TEST_EXTRA_DIRS)$(FREEZE_TEST_EXTRA_PREBUILT_DIRS))
|
|
|
|
@for pair in $(call ziplist, $(PRIVATE_EXTRA_PREBUILT), $(PRIVATE_EXTRA)); \
|
|
|
|
do diff -rq -x bug_map $$pair; done
|
|
|
|
endif # (,$(FREEZE_TEST_EXTRA_DIRS)$(FREEZE_TEST_EXTRA_PREBUILT_DIRS))
|
2018-03-15 19:38:08 +01:00
|
|
|
endif # ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION))
|
|
|
|
$(hide) touch $@
|
|
|
|
|
|
|
|
base_plat_public :=
|
|
|
|
base_plat_private :=
|
|
|
|
base_plat_public_prebuilt :=
|
|
|
|
base_plat_private_prebuilt :=
|
|
|
|
all_frozen_files :=
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
2012-10-18 03:09:52 +02:00
|
|
|
|
2018-02-05 10:34:52 +01:00
|
|
|
build_vendor_policy :=
|
2017-11-29 09:14:53 +01:00
|
|
|
build_odm_policy :=
|
2016-12-16 00:28:44 +01:00
|
|
|
build_policy :=
|
2017-02-25 23:47:53 +01:00
|
|
|
built_plat_cil :=
|
2019-08-29 11:12:11 +02:00
|
|
|
built_system_ext_cil :=
|
|
|
|
built_product_cil :=
|
2019-01-15 22:31:03 +01:00
|
|
|
built_pub_vers_cil :=
|
2019-01-16 00:16:55 +01:00
|
|
|
built_plat_mapping_cil :=
|
2019-08-29 11:12:11 +02:00
|
|
|
built_system_ext_mapping_cil :=
|
2019-01-16 00:16:55 +01:00
|
|
|
built_product_mapping_cil :=
|
2018-02-05 10:34:52 +01:00
|
|
|
built_vendor_cil :=
|
2017-11-27 04:41:33 +01:00
|
|
|
built_odm_cil :=
|
2017-03-07 23:05:57 +01:00
|
|
|
built_precompiled_sepolicy :=
|
2016-12-16 00:28:44 +01:00
|
|
|
built_sepolicy :=
|
2018-01-04 01:53:24 +01:00
|
|
|
built_sepolicy_neverallows :=
|
2016-12-28 00:10:48 +01:00
|
|
|
built_plat_svc :=
|
2018-02-05 10:34:52 +01:00
|
|
|
built_vendor_svc :=
|
2018-03-23 20:40:26 +01:00
|
|
|
built_plat_sepolicy :=
|
2019-09-26 08:14:55 +02:00
|
|
|
treble_sysprop_neverallow :=
|
2020-09-28 06:32:43 +02:00
|
|
|
enforce_sysprop_owner :=
|
2017-04-22 00:57:07 +02:00
|
|
|
mapping_policy :=
|
2016-12-16 00:28:44 +01:00
|
|
|
my_target_arch :=
|
2019-01-15 22:31:03 +01:00
|
|
|
pub_policy.cil :=
|
2019-08-29 11:12:11 +02:00
|
|
|
system_ext_pub_policy.cil :=
|
|
|
|
plat_pub_policy.cil :=
|
2016-11-28 16:20:28 +01:00
|
|
|
reqd_policy_mask.cil :=
|
2016-12-16 00:28:44 +01:00
|
|
|
sepolicy_build_files :=
|
Mark all clients of Allocator HAL
This change associates all domains which are clients of Allocator HAL
with hal_allocator_client and the, required for all HAL client
domains, halclientdomain.
This enables this commit to remove the now unnecessary hwallocator_use
macro because its binder_call(..., hal_allocator_server) is covered by
binder_call(hal_allocator_client, hal_allocator_server) added in this
commit.
Unfortunately apps, except isolated app, are clients of Allocator HAL
as well. This makes it hard to use the hal_client_domain(...,
hal_allocator) macro because it translates into "typeattribute" which
currently does not support being provided with a set of types, such as
{ appdomain -isolated_app }. As a workaround, hopefully until
typeattribute is improved, this commit expresses the necessary
association operation in CIL. private/technical_debt.cil introduced by
this commit is appended into the platform policy CIL file, thus
ensuring that the hack has effect on the final monolithic policy.
P. S. This change also removes Allocator HAL access from isolated_app.
Isolated app shouldn't have access to this HAL anyway.
Test: Google Play Music plays back radios
Test: Google Camera records video with sound and that video is then
successfully played back with sound
Test: YouTube app plays back clips with sound
Test: YouTube in Chrome plays back clips with sound
Bug: 34170079
Change-Id: Id00bba6fde83e7cf04fb58bc1c353c2f66333f92
2017-03-21 22:28:53 +01:00
|
|
|
sepolicy_build_cil_workaround_files :=
|
2017-03-13 20:22:15 +01:00
|
|
|
with_asan :=
|
2012-11-01 19:33:04 +01:00
|
|
|
|
|
|
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|