aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Klyubin2017-04-06 16:45:50 -0500
committerAlex Klyubin2017-04-07 14:22:10 -0500
commit446279a6b9bcc9689c73c5e27f3f4757e1edd661 (patch)
tree38ea35bfa12a9068f9d0db527c67109710ee4f28 /Android.mk
parent42424f13e5e222267138155dc42cde7f50ec9665 (diff)
downloadsystem-sepolicy-446279a6b9bcc9689c73c5e27f3f4757e1edd661.tar.gz
system-sepolicy-446279a6b9bcc9689c73c5e27f3f4757e1edd661.tar.xz
system-sepolicy-446279a6b9bcc9689c73c5e27f3f4757e1edd661.zip
Preserve treble-only flag for CTS neverallows
CTS includes general_sepolicy.conf built from this project. CTS then tests this file's neverallow rules against the policy of the device under test. Prior to this commit, neverallow rules which must be enforced only for Treble devices we not included into general_sepolicy.conf. As a result, these rules were not enforced for Treble devices. This commit fixes the issue as follows. Because CTS includes only one policy, the policy now contains also the rules which are only for Treble devices. To enable CTS to distinguish rules needed for all devices from rules needed only on Treble devices, the latter rules are contained in sections delimited with BEGIN_TREBLE_ONLY and END_TREBLE_ONLY comments. This commit also removes the unnecessary sepolicy.general target. This target is not used anywhere and is causing trouble because it is verifying neverallows of the policy meant to be used by CTS. This policy can no longer be verified with checkpolicy without conditionally including or excluding Treble-only neverallows. Test: mmm system/sepolicy Test: Device boots -- no new denials Bug: 37082262 Change-Id: I15172a7efd9374543ba521e17aead1bdda7451bf
Diffstat (limited to 'Android.mk')
-rw-r--r--Android.mk25
1 files changed, 4 insertions, 21 deletions
diff --git a/Android.mk b/Android.mk
index 3f691e90..025347e2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -648,6 +648,9 @@ mapping_policy_nvr.recovery :=
648nonplat_policy_nvr.recovery := 648nonplat_policy_nvr.recovery :=
649 649
650################################## 650##################################
651# SELinux policy embedded into CTS.
652# CTS checks neverallow rules of this policy against the policy of the device under test.
653##################################
651include $(CLEAR_VARS) 654include $(CLEAR_VARS)
652 655
653LOCAL_MODULE := general_sepolicy.conf 656LOCAL_MODULE := general_sepolicy.conf
@@ -667,28 +670,10 @@ $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
667 -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ 670 -D target_with_dexpreopt=$(WITH_DEXPREOPT) \
668 -D target_arch=$(PRIVATE_TGT_ARCH) \ 671 -D target_arch=$(PRIVATE_TGT_ARCH) \
669 -D target_with_asan=false \ 672 -D target_with_asan=false \
673 -D target_full_treble=cts \
670 -s $^ > $@ 674 -s $^ > $@
671 $(hide) sed '/dontaudit/d' $@ > $@.dontaudit 675 $(hide) sed '/dontaudit/d' $@ > $@.dontaudit
672 676
673built_general_sepolicy.conf := $(LOCAL_BUILT_MODULE)
674exp_sepolicy_build_files :=
675
676##################################
677include $(CLEAR_VARS)
678
679LOCAL_MODULE := sepolicy.general
680LOCAL_MODULE_CLASS := ETC
681LOCAL_MODULE_TAGS := tests
682
683include $(BUILD_SYSTEM)/base_rules.mk
684
685$(LOCAL_BUILT_MODULE): PRIVATE_BUILT_SEPOLICY.CONF := $(built_general_sepolicy.conf)
686$(LOCAL_BUILT_MODULE): $(built_general_sepolicy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
687 @mkdir -p $(dir $@)
688 $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $@ $(PRIVATE_BUILT_SEPOLICY.CONF) > /dev/null
689
690built_general_sepolicy := $(LOCAL_BUILT_MODULE)
691
692################################## 677##################################
693# TODO - remove this. Keep around until we get the filesystem creation stuff taken care of. 678# TODO - remove this. Keep around until we get the filesystem creation stuff taken care of.
694# 679#
@@ -1164,8 +1149,6 @@ build_device_policy :=
1164build_policy := 1149build_policy :=
1165built_plat_fc := 1150built_plat_fc :=
1166built_nonplat_fc := 1151built_nonplat_fc :=
1167built_general_sepolicy :=
1168built_general_sepolicy.conf :=
1169built_nl := 1152built_nl :=
1170built_plat_cil := 1153built_plat_cil :=
1171built_mapping_cil := 1154built_mapping_cil :=