Skip to content

Commit 2e00e63

Browse files
author
dcashman
committed
sepolicy: add version_policy tool and version non-platform policy.
In order to support platform changes without simultaneous updates from non-platform components, the platform and non-platform policies must be split. In order to provide a guarantee that policy written for non-platform objects continues to provide the same access, all types exposed to non-platform policy are versioned by converting them and the policy using them into attributes. This change performs that split, the subsequent versioning and also generates a mapping file to glue the different policy components together. Test: Device boots and runs. Bug: 31369363 Change-Id: Ibfd3eb077bd9b8e2ff3b2e6a0ca87e44d78b1317
1 parent fed665e commit 2e00e63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+550
-151
lines changed

Android.mk

+160-26
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@ endif
3838
# in this policy to ensure that policy targeting attributes from public
3939
# policy from an older platform version continues to work.
4040

41-
# TODO - build process for device:
41+
# build process for device:
4242
# 1) convert policies to CIL:
4343
# - private + public platform policy to CIL
4444
# - mapping file to CIL (should already be in CIL form)
4545
# - non-platform public policy to CIL
4646
# - non-platform public + private policy to CIL
4747
# 2) attributize policy
48-
# - TODO: do this for platform policy?
4948
# - run script which takes non-platform public and non-platform combined
5049
# private + public policy and produces attributized and versioned
5150
# non-platform policy
@@ -55,6 +54,27 @@ endif
5554

5655
PLAT_PUBLIC_POLICY := $(LOCAL_PATH)/public
5756
PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private
57+
REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask
58+
59+
# TODO: move to README when doing the README update and finalizing versioning.
60+
# BOARD_SEPOLICY_VERS should contain the platform version identifier
61+
# corresponding to the platform on which the non-platform policy is to be
62+
# based. If unspecified, this will build against the current public platform
63+
# policy in tree.
64+
# BOARD_SEPOLICY_VERS_DIR should contain the public platform policy which
65+
# is associated with the given BOARD_SEPOLICY_VERS. The policy therein will be
66+
# versioned according to the BOARD_SEPOLICY_VERS identifier and included as
67+
# part of the non-platform policy to ensure removal of access in future
68+
# platform policy does not break non-platform policy.
69+
ifndef BOARD_SEPOLICY_VERS
70+
$(warning BOARD_SEPOLICY_VERS not specified, assuming current platform version)
71+
BOARD_SEPOLICY_VERS := current
72+
BOARD_SEPOLICY_VERS_DIR := $(PLAT_PUBLIC_POLICY)
73+
else
74+
ifndef BOARD_SEPOLICY_VERS_DIR
75+
$(error BOARD_SEPOLICY_VERS_DIR not specified for versioned sepolicy.)
76+
endif
77+
endif
5878

5979
###########################################################
6080
# Compute policy files to be used in policy build.
@@ -83,13 +103,15 @@ sepolicy_build_files := security_classes \
83103
global_macros \
84104
neverallow_macros \
85105
mls_macros \
106+
mls_decl \
86107
mls \
87108
policy_capabilities \
88109
te_macros \
89110
attributes \
90111
ioctl_defines \
91112
ioctl_macros \
92113
*.te \
114+
roles_decl \
93115
roles \
94116
users \
95117
initial_sid_contexts \
@@ -128,11 +150,64 @@ endif
128150

129151
include $(BUILD_SYSTEM)/base_rules.mk
130152

131-
platform_policy.conf := $(intermediates)/plat_policy.conf
132-
$(platform_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
133-
$(platform_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
134-
$(platform_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
135-
$(platform_policy.conf): $(call build_policy, $(sepolicy_build_files), \
153+
# reqd_policy_mask - a policy.conf file which contains only the bare minimum
154+
# policy necessary to use checkpolicy. This bare-minimum policy needs to be
155+
# present in all policy.conf files, but should not necessarily be exported as
156+
# part of the public policy. The rules generated by reqd_policy_mask will allow
157+
# the compilation of public policy and subsequent removal of CIL policy that
158+
# should not be exported.
159+
160+
reqd_policy_mask.conf := $(intermediates)/reqd_policy_mask.conf
161+
$(reqd_policy_mask.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
162+
$(reqd_policy_mask.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
163+
$(reqd_policy_mask.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
164+
$(reqd_policy_mask.conf): $(call build_policy, $(sepolicy_build_files), $(REQD_MASK_POLICY))
165+
@mkdir -p $(dir $@)
166+
$(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \
167+
-D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
168+
-D target_build_variant=$(TARGET_BUILD_VARIANT) \
169+
-s $^ > $@
170+
171+
reqd_policy_mask.cil := $(intermediates)/reqd_policy_mask.cil
172+
$(reqd_policy_mask.cil): $(reqd_policy_mask.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
173+
@mkdir -p $(dir $@)
174+
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -C -M -c $(POLICYVERS) -o $@ $<
175+
176+
# plat_pub_policy - policy that will be exported to be a part of non-platform
177+
# policy corresponding to this platform version. This is a limited subset of
178+
# policy that would not compile in checkpolicy on its own. To get around this
179+
# limitation, add only the required files from private policy, which will
180+
# generate CIL policy that will then be filtered out by the reqd_policy_mask.
181+
plat_pub_policy.conf := $(intermediates)/plat_pub_policy.conf
182+
$(plat_pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
183+
$(plat_pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
184+
$(plat_pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
185+
$(plat_pub_policy.conf): $(call build_policy, $(sepolicy_build_files), \
186+
$(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY))
187+
@mkdir -p $(dir $@)
188+
$(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \
189+
-D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
190+
-D target_build_variant=$(TARGET_BUILD_VARIANT) \
191+
-s $^ > $@
192+
193+
plat_pub_policy.cil := $(intermediates)/plat_pub_policy.cil
194+
$(plat_pub_policy.cil): $(plat_pub_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
195+
@mkdir -p $(dir $@)
196+
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -C -M -c $(POLICYVERS) -o $@ $<
197+
198+
pruned_plat_pub_policy.cil := $(intermediates)/pruned_plat_pub_policy.cil
199+
$(pruned_plat_pub_policy.cil): $(reqd_policy_mask.cil) $(plat_pub_policy.cil)
200+
@mkdir -p $(dir $@)
201+
$(hide) grep -Fxv -f $^ > $@
202+
203+
# plat_policy.conf - A combination of the private and public platform policy
204+
# which will ship with the device. The platform will always reflect the most
205+
# recent platform version and is not currently being attributized.
206+
plat_policy.conf := $(intermediates)/plat_policy.conf
207+
$(plat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
208+
$(plat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
209+
$(plat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
210+
$(plat_policy.conf): $(call build_policy, $(sepolicy_build_files), \
136211
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
137212
@mkdir -p $(dir $@)
138213
$(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \
@@ -144,15 +219,23 @@ $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY))
144219
-s $^ > $@
145220
$(hide) sed '/dontaudit/d' $@ > $@.dontaudit
146221

147-
# TODO: add steps for non-platform public and combined files with checkpolicy
148-
# support. b/31932523
149-
150-
sepolicy_policy.conf := $(intermediates)/policy.conf
151-
$(sepolicy_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
152-
$(sepolicy_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
153-
$(sepolicy_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
154-
$(sepolicy_policy.conf): $(call build_policy, $(sepolicy_build_files), \
155-
$(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) $(BOARD_SEPOLICY_DIRS))
222+
plat_policy.cil := $(intermediates)/plat_policy.cil
223+
$(plat_policy.cil): $(plat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
224+
@mkdir -p $(dir $@)
225+
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c $(POLICYVERS) -o $@.tmp $<
226+
$(hide) grep -v neverallow $@.tmp > $@
227+
228+
# nonplat_policy.conf - A combination of the non-platform private and the
229+
# exported platform policy associated with the version the non-platform policy
230+
# targets. This needs attributization and to be combined with the
231+
# platform-provided policy. Like plat_pub_policy.conf, this needs to make use
232+
# of the reqd_policy_mask files from private policy in order to use checkpolicy.
233+
nonplat_policy.conf := $(intermediates)/nonplat_policy.conf
234+
$(nonplat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
235+
$(nonplat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
236+
$(nonplat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
237+
$(nonplat_policy.conf): $(call build_policy, $(sepolicy_build_files), \
238+
$(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY) $(BOARD_SEPOLICY_DIRS))
156239
@mkdir -p $(dir $@)
157240
$(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \
158241
-D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
@@ -164,10 +247,47 @@ $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY) $(BOARD_SEPOLICY_DIRS))
164247
-s $^ > $@
165248
$(hide) sed '/dontaudit/d' $@ > $@.dontaudit
166249

167-
$(LOCAL_BUILT_MODULE): $(sepolicy_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy $(HOST_OUT_EXECUTABLES)/sepolicy-analyze
250+
nonplat_policy.cil := $(intermediates)/nonplat_policy.cil
251+
$(nonplat_policy.cil): $(nonplat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
168252
@mkdir -p $(dir $@)
169-
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $@.tmp $< > /dev/null
170-
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $(dir $<)/$(notdir $@).dontaudit $<.dontaudit > /dev/null
253+
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -C -M -c $(POLICYVERS) -o $@ $<
254+
255+
pruned_nonplat_policy.cil := $(intermediates)/pruned_nonplat_policy.cil
256+
$(pruned_nonplat_policy.cil): $(reqd_policy_mask.cil) $(nonplat_policy.cil)
257+
@mkdir -p $(dir $@)
258+
$(hide) grep -Fxv -f $^ | grep -v neverallow > $@
259+
260+
vers_nonplat_policy.cil := $(intermediates)/vers_nonplat_policy.cil
261+
$(vers_nonplat_policy.cil) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS)
262+
$(vers_nonplat_policy.cil) : PRIVATE_TGT_POL := $(pruned_nonplat_policy.cil)
263+
$(vers_nonplat_policy.cil) : $(pruned_plat_pub_policy.cil) $(pruned_nonplat_policy.cil) \
264+
$(HOST_OUT_EXECUTABLES)/version_policy
265+
@mkdir -p $(dir $@)
266+
$(HOST_OUT_EXECUTABLES)/version_policy -b $< -t $(PRIVATE_TGT_POL) -n $(PRIVATE_VERS) -o $@
267+
268+
# auto-generate the mapping file for current platform policy, since it needs to
269+
# track platform policy development
270+
current_mapping.cil := $(intermediates)/mapping/current.cil
271+
$(current_mapping.cil) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS)
272+
$(current_mapping.cil) : $(pruned_plat_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy
273+
@mkdir -p $(dir $@)
274+
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
275+
276+
ifeq ($(BOARD_SEPOLICY_VERS), current)
277+
mapping.cil := $(current_mapping.cil)
278+
else
279+
mapping.cil := $(addsuffix /$(BOARD_SEPOLICY_VERS).cil, $(PLAT_PRIVATE_POLICY)/mapping)
280+
endif
281+
282+
all_cil_files := \
283+
$(plat_policy.cil) \
284+
$(vers_nonplat_policy.cil) \
285+
$(mapping.cil)
286+
287+
$(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(all_cil_files)
288+
$(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $(all_cil_files)
289+
@mkdir -p $(dir $@)
290+
$(hide) $< -M true -c $(POLICYVERS) $(PRIVATE_CIL_FILES) -o $@.tmp
171291
$(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp permissive > $@.permissivedomains
172292
$(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s $@.permissivedomains ]; then \
173293
echo "==========" 1>&2; \
@@ -179,6 +299,20 @@ $(LOCAL_BUILT_MODULE): $(sepolicy_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpoli
179299
$(hide) mv $@.tmp $@
180300

181301
built_sepolicy := $(LOCAL_BUILT_MODULE)
302+
reqd_policy_mask.conf :=
303+
reqd_policy_mask.cil :=
304+
plat_pub_policy.conf :=
305+
plat_pub_policy.cil :=
306+
pruned_plat_pub_policy.cil :=
307+
plat_policy.conf :=
308+
plat_policy.cil :=
309+
nonplat_policy.conf :=
310+
nonplat_policy.cil :=
311+
pruned_nonplat_policy.cil :=
312+
vers_nonplat_policy.cil :=
313+
current_mapping.cil :=
314+
mapping.cil :=
315+
all_cil_files :=
182316
sepolicy_policy.conf :=
183317

184318
##################################
@@ -311,7 +445,7 @@ file_contexts.device.sorted.tmp := $(intermediates)/file_contexts.device.sorted.
311445
$(file_contexts.device.sorted.tmp): PRIVATE_SEPOLICY := $(built_sepolicy)
312446
$(file_contexts.device.sorted.tmp): $(file_contexts.device.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/fc_sort $(HOST_OUT_EXECUTABLES)/checkfc
313447
@mkdir -p $(dir $@)
314-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e $(PRIVATE_SEPOLICY) $<
448+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e $(PRIVATE_SEPOLICY) $<
315449
$(hide) $(HOST_OUT_EXECUTABLES)/fc_sort $< $@
316450

317451
file_contexts.concat.tmp := $(intermediates)/file_contexts.concat.tmp
@@ -322,7 +456,7 @@ $(file_contexts.concat.tmp): $(file_contexts.local.tmp) $(file_contexts.device.s
322456
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
323457
$(LOCAL_BUILT_MODULE): $(file_contexts.concat.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/sefcontext_compile $(HOST_OUT_EXECUTABLES)/checkfc
324458
@mkdir -p $(dir $@)
325-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $<
459+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $<
326460
$(hide) $(HOST_OUT_EXECUTABLES)/sefcontext_compile -o $@ $<
327461

328462
built_fc := $(LOCAL_BUILT_MODULE)
@@ -352,7 +486,7 @@ $(general_file_contexts.tmp): $(addprefix $(PLAT_PRIVATE_POLICY)/, file_contexts
352486
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_general_sepolicy)
353487
$(LOCAL_BUILT_MODULE): $(general_file_contexts.tmp) $(built_general_sepolicy) $(HOST_OUT_EXECUTABLES)/sefcontext_compile $(HOST_OUT_EXECUTABLES)/checkfc
354488
@mkdir -p $(dir $@)
355-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $<
489+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $<
356490
$(hide) $(HOST_OUT_EXECUTABLES)/sefcontext_compile -o $@ $<
357491

358492
general_file_contexts.tmp :=
@@ -433,7 +567,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
433567
$(LOCAL_BUILT_MODULE): $(property_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc
434568
@mkdir -p $(dir $@)
435569
$(hide) sed -e 's/#.*$$//' -e '/^$$/d' $< > $@
436-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@
570+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@
437571

438572
built_pc := $(LOCAL_BUILT_MODULE)
439573
all_pc_files :=
@@ -458,7 +592,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_general_sepolicy)
458592
$(LOCAL_BUILT_MODULE): $(general_property_contexts.tmp) $(built_general_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP)
459593
@mkdir -p $(dir $@)
460594
$(hide) sed -e 's/#.*$$//' -e '/^$$/d' $< > $@
461-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@
595+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@
462596

463597
general_property_contexts.tmp :=
464598

@@ -486,7 +620,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
486620
$(LOCAL_BUILT_MODULE): $(service_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP)
487621
@mkdir -p $(dir $@)
488622
sed -e 's/#.*$$//' -e '/^$$/d' $< > $@
489-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@
623+
# TODO: fix with attributized types$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@
490624

491625
built_svc := $(LOCAL_BUILT_MODULE)
492626
all_svc_files :=
@@ -511,7 +645,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_general_sepolicy)
511645
$(LOCAL_BUILT_MODULE): $(general_service_contexts.tmp) $(built_general_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP)
512646
@mkdir -p $(dir $@)
513647
sed -e 's/#.*$$//' -e '/^$$/d' $< > $@
514-
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@
648+
# TODO: fix with attributized types $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@
515649

516650
general_service_contexts.tmp :=
517651

private/app.te

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TODO: deal with tmpfs_domain pub/priv split properly
2+
# Read system properties managed by zygote.
3+
allow appdomain zygote_tmpfs:file read;

private/bluetooth.te

+5
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
# public, but conceptually should go with this
33
# Socket creation under /data/misc/bluedroid.
44
type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
5+
6+
# app_domain macro fallout
7+
tmpfs_domain(bluetooth)
8+
# Map with PROT_EXEC.
9+
allow bluetooth bluetooth_tmpfs:file execute;

private/domain.te

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Limit ability to ptrace or read sensitive /proc/pid files of processes
2+
# with other UIDs to these whitelisted domains.
3+
neverallow {
4+
domain
5+
-debuggerd
6+
-vold
7+
-dumpstate
8+
-system_server
9+
userdebug_or_eng(`-perfprofd')
10+
} self:capability sys_ptrace;

private/drmserver.te

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# type_transition must be private policy the domain_trans rules could stay
22
# public, but conceptually should go with this
33
init_daemon_domain(drmserver)
4+
5+
type_transition drmserver apk_data_file:sock_file drmserver_socket;

private/dumpstate.te

+9
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ init_daemon_domain(dumpstate)
44

55
# Execute and transition to the vdc domain
66
domain_auto_trans(dumpstate, vdc_exec, vdc)
7+
8+
# TODO: deal with tmpfs_domain pub/priv split properly
9+
allow dumpstate dumpstate_tmpfs:file execute;
10+
11+
# systrace support - allow atrace to run
12+
allow dumpstate debugfs_tracing:dir r_dir_perms;
13+
allow dumpstate debugfs_tracing:file rw_file_perms;
14+
allow dumpstate debugfs_trace_marker:file getattr;
15+
allow dumpstate atrace_exec:file rx_file_perms;

private/ephemeral_app.te

+6
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
# Define and allow access to our own type for ashmem regions.
44
# Label ashmem objects with our own unique type.
55
tmpfs_domain(ephemeral_app)
6+
# TODO: deal with tmpfs_domain pub/priv split properly
7+
# Map with PROT_EXEC.
8+
allow ephemeral_app ephemeral_app_tmpfs:file execute;
9+
10+
# Read system properties managed by zygote.
11+
allow ephemeral_app zygote_tmpfs:file read;

private/file.te

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Compatibility with type names used in vanilla Android 4.3 and 4.4.
2+
typealias audio_data_file alias audio_firmware_file;
3+
typealias app_data_file alias platform_app_data_file;
4+
typealias app_data_file alias download_file;

private/installd.te

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ domain_auto_trans(installd, profman_exec, profman)
1010

1111
# Run idmap in its own sandbox.
1212
domain_auto_trans(installd, idmap_exec, idmap)
13+
14+
# Create /data/.layout_version.* file
15+
type_transition installd system_data_file:file install_data_file;

private/isolated_app.te

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# app_domain fallout
2+
tmpfs_domain(isolated_app)
3+
# Map with PROT_EXEC.
4+
allow isolated_app isolated_app_tmpfs:file execute;
5+
6+
# Read system properties managed by webview_zygote.
7+
allow isolated_app webview_zygote_tmpfs:file read;

private/logd.te

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# type_transition must be private policy the domain_trans rules could stay
22
# public, but conceptually should go with this
33
init_daemon_domain(logd)
4+
5+
# logd is not allowed to write anywhere other than /data/misc/logd, and then
6+
# only on userdebug or eng builds
7+
# TODO: deal with tmpfs_domain pub/priv split properly
8+
neverallow logd { file_type -logd_tmpfs userdebug_or_eng(` -misc_logd_file -coredump_file ') }:file { create write append };

private/mls

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
#########################################
2-
# MLS declarations
3-
#
4-
5-
# Generate the desired number of sensitivities and categories.
6-
gen_sens(mls_num_sens)
7-
gen_cats(mls_num_cats)
8-
9-
# Generate level definitions for each sensitivity and category.
10-
gen_levels(mls_num_sens,mls_num_cats)
11-
12-
131
#################################################
142
# MLS policy constraints
153
#

0 commit comments

Comments
 (0)