blob: 0770a649827942cc95e921d21fe8d6f270bed05a [file] [log] [blame]
Tri Voa5cfd3e2018-03-22 11:35:02 -07001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badour601ebb42021-02-03 23:07:40 -080015package {
16 default_applicable_licenses: ["system_sepolicy_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'filegroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// http://go/android-license-faq
33license {
34 name: "system_sepolicy_license",
35 visibility: [":__subpackages__"],
36 license_kinds: [
37 "SPDX-license-identifier-Apache-2.0",
38 "legacy_unencumbered",
39 ],
40 license_text: [
41 "NOTICE",
42 ],
43}
44
Jeff Vander Stoepecd288f2019-02-15 12:18:15 -080045cc_defaults { name: "selinux_policy_version", cflags: ["-DSEPOLICY_VERSION=30"], }
46
Inseob Kim41964032022-04-22 07:50:22 +090047se_build_files {
Jae Shin1fa96342018-07-11 18:30:44 +090048 name: "28.0.board.compat.map",
49 srcs: [
50 "compat/28.0/28.0.cil",
51 ],
52}
53
Inseob Kim41964032022-04-22 07:50:22 +090054se_build_files {
Tri Vo50aa0292019-06-01 17:04:13 -070055 name: "29.0.board.compat.map",
56 srcs: [
57 "compat/29.0/29.0.cil",
58 ],
59}
60
Inseob Kim41964032022-04-22 07:50:22 +090061se_build_files {
Inseob Kimace36ab2020-05-07 20:19:05 +090062 name: "30.0.board.compat.map",
63 srcs: [
64 "compat/30.0/30.0.cil",
65 ],
66}
67
Inseob Kim41964032022-04-22 07:50:22 +090068se_build_files {
Inseob Kim4f20ff72021-06-15 21:05:39 +090069 name: "31.0.board.compat.map",
70 srcs: [
71 "compat/31.0/31.0.cil",
72 ],
73}
74
Inseob Kim41964032022-04-22 07:50:22 +090075se_build_files {
Inseob Kimbee558e2021-11-30 14:58:10 +090076 name: "32.0.board.compat.map",
77 srcs: [
78 "compat/32.0/32.0.cil",
79 ],
80}
81
Inseob Kim41964032022-04-22 07:50:22 +090082se_build_files {
Inseob Kim4ae05112022-05-02 14:03:46 +090083 name: "33.0.board.compat.map",
84 srcs: [
85 "compat/33.0/33.0.cil",
86 ],
87}
88
89se_build_files {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +080090 name: "28.0.board.compat.cil",
91 srcs: [
92 "compat/28.0/28.0.compat.cil",
93 ],
94}
95
Inseob Kim41964032022-04-22 07:50:22 +090096se_build_files {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +080097 name: "29.0.board.compat.cil",
98 srcs: [
99 "compat/29.0/29.0.compat.cil",
100 ],
101}
102
Inseob Kim41964032022-04-22 07:50:22 +0900103se_build_files {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +0800104 name: "30.0.board.compat.cil",
105 srcs: [
106 "compat/30.0/30.0.compat.cil",
107 ],
108}
109
Inseob Kim41964032022-04-22 07:50:22 +0900110se_build_files {
Inseob Kim4f20ff72021-06-15 21:05:39 +0900111 name: "31.0.board.compat.cil",
112 srcs: [
113 "compat/31.0/31.0.compat.cil",
114 ],
115}
116
Inseob Kim41964032022-04-22 07:50:22 +0900117se_build_files {
Inseob Kimbee558e2021-11-30 14:58:10 +0900118 name: "32.0.board.compat.cil",
119 srcs: [
120 "compat/32.0/32.0.compat.cil",
121 ],
122}
123
Inseob Kim41964032022-04-22 07:50:22 +0900124se_build_files {
Inseob Kim4ae05112022-05-02 14:03:46 +0900125 name: "33.0.board.compat.cil",
126 srcs: [
127 "compat/33.0/33.0.compat.cil",
128 ],
129}
130
131se_build_files {
Jinguang Donge0125692019-03-05 17:20:54 +0800132 name: "28.0.board.ignore.map",
133 srcs: [
134 "compat/28.0/28.0.ignore.cil",
135 ],
136}
137
Inseob Kim41964032022-04-22 07:50:22 +0900138se_build_files {
Tri Vo50aa0292019-06-01 17:04:13 -0700139 name: "29.0.board.ignore.map",
140 srcs: [
141 "compat/29.0/29.0.ignore.cil",
142 ],
143}
144
Inseob Kim41964032022-04-22 07:50:22 +0900145se_build_files {
Inseob Kimace36ab2020-05-07 20:19:05 +0900146 name: "30.0.board.ignore.map",
147 srcs: [
148 "compat/30.0/30.0.ignore.cil",
149 ],
150}
151
Inseob Kim41964032022-04-22 07:50:22 +0900152se_build_files {
Inseob Kim4f20ff72021-06-15 21:05:39 +0900153 name: "31.0.board.ignore.map",
154 srcs: [
155 "compat/31.0/31.0.ignore.cil",
156 ],
157}
158
Inseob Kim41964032022-04-22 07:50:22 +0900159se_build_files {
Inseob Kimbee558e2021-11-30 14:58:10 +0900160 name: "32.0.board.ignore.map",
161 srcs: [
162 "compat/32.0/32.0.ignore.cil",
163 ],
164}
165
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900166se_build_files {
Inseob Kim4ae05112022-05-02 14:03:46 +0900167 name: "33.0.board.ignore.map",
168 srcs: [
169 "compat/33.0/33.0.ignore.cil",
170 ],
171}
172
173se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900174 name: "file_contexts_files",
175 srcs: ["file_contexts"],
176}
177
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900178se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900179 name: "file_contexts_asan_files",
180 srcs: ["file_contexts_asan"],
181}
182
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900183se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900184 name: "file_contexts_overlayfs_files",
185 srcs: ["file_contexts_overlayfs"],
186}
187
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900188se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900189 name: "hwservice_contexts_files",
190 srcs: ["hwservice_contexts"],
191}
192
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900193se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900194 name: "property_contexts_files",
195 srcs: ["property_contexts"],
196}
197
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900198se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900199 name: "service_contexts_files",
200 srcs: ["service_contexts"],
201}
202
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900203se_build_files {
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700204 name: "keystore2_key_contexts_files",
205 srcs: ["keystore2_key_contexts"],
206}
207
Inseob Kim2dac2672021-12-29 17:54:57 +0900208se_build_files {
209 name: "seapp_contexts_files",
210 srcs: ["seapp_contexts"],
211}
212
Inseob Kimc7596c42022-02-25 11:45:41 +0900213se_build_files {
214 name: "vndservice_contexts_files",
215 srcs: ["vndservice_contexts"],
216}
217
yangbill3e345372020-04-15 13:55:47 +0800218// For vts_treble_sys_prop_test
219filegroup {
220 name: "private_property_contexts",
221 srcs: ["private/property_contexts"],
222 visibility: [
223 "//test/vts-testcase/security/system_property",
224 ],
225}
Inseob Kime35b49b2021-02-18 19:15:41 +0900226
Inseob Kima49e7242021-03-22 10:26:13 +0900227se_build_files {
228 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900229 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900230 "security_classes",
231 "initial_sids",
232 "access_vectors",
233 "global_macros",
234 "neverallow_macros",
235 "mls_macros",
236 "mls_decl",
237 "mls",
238 "policy_capabilities",
239 "te_macros",
240 "attributes",
241 "ioctl_defines",
242 "ioctl_macros",
243 "*.te",
244 "roles_decl",
245 "roles",
246 "users",
247 "initial_sid_contexts",
248 "fs_use",
249 "genfs_contexts",
250 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900251 ],
252}
253
Inseob Kim7cb20812021-12-16 16:52:14 +0900254se_build_files {
255 name: "sepolicy_technical_debt",
256 srcs: ["technical_debt.cil"],
257}
258
Inseob Kim0a707fa2021-12-09 23:35:11 +0900259reqd_mask_policy = [":se_build_files{.reqd_mask}"]
260plat_public_policy = [":se_build_files{.plat_public}"]
261plat_private_policy = [":se_build_files{.plat_private}"]
262system_ext_public_policy = [":se_build_files{.system_ext_public}"]
263system_ext_private_policy = [":se_build_files{.system_ext_private}"]
264product_public_policy = [":se_build_files{.product_public}"]
265product_private_policy = [":se_build_files{.product_private}"]
266
Inseob Kima49e7242021-03-22 10:26:13 +0900267// reqd_policy_mask - a policy.conf file which contains only the bare minimum
268// policy necessary to use checkpolicy.
269//
270// This bare-minimum policy needs to be present in all policy.conf files, but
271// should not necessarily be exported as part of the public policy.
272//
273// The rules generated by reqd_policy_mask will allow the compilation of public
274// policy and subsequent removal of CIL policy that should not be exported.
275se_policy_conf {
276 name: "reqd_policy_mask.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900277 srcs: reqd_mask_policy,
Inseob Kime35b49b2021-02-18 19:15:41 +0900278 installable: false,
279}
280
Inseob Kima49e7242021-03-22 10:26:13 +0900281se_policy_cil {
282 name: "reqd_policy_mask.cil",
283 src: ":reqd_policy_mask.conf",
284 secilc_check: false,
285 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900286}
287
Inseob Kima49e7242021-03-22 10:26:13 +0900288// pub_policy - policy that will be exported to be a part of non-platform
289// policy corresponding to this platform version.
290//
291// This is a limited subset of policy that would not compile in checkpolicy on
292// its own.
293//
294// To get around this limitation, add only the required files from private
295// policy, which will generate CIL policy that will then be filtered out by the
296// reqd_policy_mask.
297//
298// There are three pub_policy.cil files below:
299// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
300// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
301// - plat_pub_policy.cil: exported 'system' policy.
302//
303// Those above files will in turn be used to generate the following versioned cil files:
304// - product_mapping_file: the versioned, exported 'product' policy in product partition.
305// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
306// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
307// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
308// in vendor partition.
309//
310se_policy_conf {
311 name: "pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900312 srcs: plat_public_policy +
313 system_ext_public_policy +
314 product_public_policy +
315 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900316 installable: false,
317}
318
319se_policy_cil {
320 name: "pub_policy.cil",
321 src: ":pub_policy.conf",
322 filter_out: [":reqd_policy_mask.cil"],
323 secilc_check: false,
324 installable: false,
325}
326
327se_policy_conf {
328 name: "system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900329 srcs: plat_public_policy +
330 system_ext_public_policy +
331 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900332 installable: false,
333}
334
335se_policy_cil {
336 name: "system_ext_pub_policy.cil",
337 src: ":system_ext_pub_policy.conf",
338 filter_out: [":reqd_policy_mask.cil"],
339 secilc_check: false,
340 installable: false,
341}
342
343se_policy_conf {
344 name: "plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900345 srcs: plat_public_policy +
346 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900347 installable: false,
348}
349
350se_policy_cil {
351 name: "plat_pub_policy.cil",
352 src: ":plat_pub_policy.conf",
353 filter_out: [":reqd_policy_mask.cil"],
354 secilc_check: false,
355 installable: false,
356}
357
358// plat_policy.conf - A combination of the private and public platform policy
359// which will ship with the device.
360//
361// The platform will always reflect the most recent platform version and is not
362// currently being attributized.
363se_policy_conf {
364 name: "plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900365 srcs: plat_public_policy +
366 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900367 installable: false,
368}
369
370se_policy_cil {
371 name: "plat_sepolicy.cil",
372 src: ":plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900373 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900374}
375
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100376se_policy_conf {
377 name: "apex_sepolicy-33.conf",
sandrome6971f12022-05-31 08:50:55 +0000378 srcs: plat_public_policy +
379 plat_private_policy +
380 system_ext_public_policy +
381 system_ext_private_policy +
382 product_public_policy +
383 product_private_policy +
384 ["com.android.sepolicy/33/*.te"],
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100385 installable: false,
386}
387
388se_policy_cil {
389 name: "apex_sepolicy-33.cil",
390 src: ":apex_sepolicy-33.conf",
sandrome6971f12022-05-31 08:50:55 +0000391 filter_out: [
392 ":plat_sepolicy.cil",
393 ":system_ext_sepolicy.cil",
394 ":product_sepolicy.cil",
395 ],
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100396 installable: false,
397 stem: "apex_sepolicy.cil",
sandrome6971f12022-05-31 08:50:55 +0000398 remove_line_marker: true,
399}
400
401se_policy_cil {
402 name: "decompiled_sepolicy-without_apex.cil",
403 src: ":precompiled_sepolicy-without_apex",
404 decompile_binary: true,
405}
406
407se_policy_cil {
408 name: "apex_sepolicy-decompiled.cil",
409 src: ":precompiled_sepolicy",
410 decompile_binary: true,
411 filter_out: [":decompiled_sepolicy-without_apex.cil"],
412 additional_cil_files: ["com.android.sepolicy/33/definitions/definitions.cil"],
413 secilc_check: false,
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100414}
415
Inseob Kim6cc75f42021-04-29 13:53:20 +0000416// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
417se_policy_conf {
418 name: "userdebug_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900419 srcs: plat_public_policy +
420 plat_private_policy,
Inseob Kim6cc75f42021-04-29 13:53:20 +0000421 build_variant: "userdebug",
422 installable: false,
423}
424
425se_policy_cil {
426 name: "userdebug_plat_sepolicy.cil",
427 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900428 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kim6cc75f42021-04-29 13:53:20 +0000429 debug_ramdisk: true,
Yi-Yo Chiang68478b12021-10-16 03:23:05 +0800430 dist: {
431 targets: ["droidcore"],
432 },
Inseob Kim6cc75f42021-04-29 13:53:20 +0000433}
434
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000435// A copy of the userdebug_plat_policy in GSI.
436soong_config_module_type {
437 name: "gsi_se_policy_cil",
438 module_type: "se_policy_cil",
439 config_namespace: "ANDROID",
440 bool_variables: [
441 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
442 ],
443 properties: [
444 "enabled",
445 "installable",
446 ],
447}
448
449gsi_se_policy_cil {
450 name: "system_ext_userdebug_plat_sepolicy.cil",
451 stem: "userdebug_plat_sepolicy.cil",
452 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900453 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000454 system_ext_specific: true,
455 enabled: false,
456 installable: false,
457 soong_config_variables: {
458 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
459 enabled: true,
460 installable: true,
461 },
462 },
463}
464
Inseob Kima49e7242021-03-22 10:26:13 +0900465// system_ext_policy.conf - A combination of the private and public system_ext
466// policy which will ship with the device. System_ext policy is not attributized
467se_policy_conf {
468 name: "system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900469 srcs: plat_public_policy +
470 plat_private_policy +
471 system_ext_public_policy +
472 system_ext_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900473 installable: false,
474}
475
476se_policy_cil {
477 name: "system_ext_sepolicy.cil",
478 src: ":system_ext_sepolicy.conf",
479 system_ext_specific: true,
480 filter_out: [":plat_sepolicy.cil"],
481 remove_line_marker: true,
482}
483
484// product_policy.conf - A combination of the private and public product policy
485// which will ship with the device. Product policy is not attributized
486se_policy_conf {
487 name: "product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900488 srcs: plat_public_policy +
489 plat_private_policy +
490 system_ext_public_policy +
491 system_ext_private_policy +
492 product_public_policy +
493 product_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900494 installable: false,
495}
496
497se_policy_cil {
498 name: "product_sepolicy.cil",
499 src: ":product_sepolicy.conf",
500 product_specific: true,
501 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
502 remove_line_marker: true,
503}
504
Inseob Kim039175b2021-03-25 15:37:34 +0900505// policy mapping files
506// auto-generate the mapping file for current platform policy, since it needs to
507// track platform policy development
508se_versioned_policy {
509 name: "plat_mapping_file",
510 base: ":plat_pub_policy.cil",
511 mapping: true,
512 version: "current",
513 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
514}
515
516se_versioned_policy {
517 name: "system_ext_mapping_file",
518 base: ":system_ext_pub_policy.cil",
519 mapping: true,
520 version: "current",
521 filter_out: [":plat_mapping_file"],
522 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
523 system_ext_specific: true,
524}
525
526se_versioned_policy {
527 name: "product_mapping_file",
528 base: ":pub_policy.cil",
529 mapping: true,
530 version: "current",
531 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
532 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
533 product_specific: true,
534}
535
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900536// vendor/odm sepolicy
537//
538// If BOARD_SEPOLICY_VERS is set to a value other than PLATFORM_SEPOLICY_VERSION,
539// policy files of platform (system, system_ext, product) can't be mixed with
540// policy files of vendor (vendor, odm). If it's the case, platform policies and
541// vendor policies are separately built. More specifically,
542//
543// - Platform policy files needed to build vendor policies, such as plat_policy,
544// plat_mapping_cil, plat_pub_policy, reqd_policy_mask, are built from the
545// prebuilts (copy of platform policy files of version BOARD_SEPOLICY_VERS).
546//
547// - sepolicy_neverallows only checks platform policies, and a new module
548// sepolicy_neverallows_vendor checks vendor policies.
549//
550// - neverallow checks are turned off while compiling precompiled_sepolicy
551// module and sepolicy module.
552//
553// - Vendor policies are not checked on the compat test (compat.mk).
554//
555// In such scenario, we can grab platform policy files from the prebuilts/api
556// directory. But we need more than that: prebuilts of system_ext, product,
557// system/sepolicy/reqd_mask, and system/sepolicy/vendor. The following
558// variables are introduced to specify such prebuilts.
559//
560// - BOARD_REQD_MASK_POLICY (prebuilt of system/sepolicy/reqd_mask)
561// - BOARD_PLAT_VENDOR_POLICY (prebuilt of system/sepolicy/vendor)
562// - BOARD_SYSTEM_EXT_PUBLIC_PREBUILT_DIRS (prebuilt of system_ext public)
563// - BOARD_SYSTEM_EXT_PRIVATE_PREBUILT_DIRS (prebuilt of system_ext private)
564// - BOARD_PRODUCT_PUBLIC_PREBUILT_DIRS (prebuilt of product public)
565// - BOARD_PRODUCT_PRIVATE_PREBUILT_DIRS (prebuilt of product private)
566//
567// Vendors are responsible for copying policy files from the old version of the
568// source tree as prebuilts, and for setting BOARD_*_POLICY variables so they
569// can be used to build vendor policies.
570//
571// To support both mixed build and normal build, platform policy files are
572// indirectly referred as {.(partition)_(scope)_for_vendor}. They will be equal
573// to {.(partition)_scope)} if BOARD_SEPOLICY_VERS == PLATFORM_SEPOLICY_VERSION.
574// Otherwise, they will be equal to the Makefile variables above.
575
576plat_public_policies_for_vendor = [
577 ":se_build_files{.plat_public_for_vendor}",
578 ":se_build_files{.system_ext_public_for_vendor}",
579 ":se_build_files{.product_public_for_vendor}",
580 ":se_build_files{.reqd_mask_for_vendor}",
581]
582
583plat_policies_for_vendor = [
584 ":se_build_files{.plat_public_for_vendor}",
585 ":se_build_files{.plat_private_for_vendor}",
586 ":se_build_files{.system_ext_public_for_vendor}",
587 ":se_build_files{.system_ext_private_for_vendor}",
588 ":se_build_files{.product_public_for_vendor}",
589 ":se_build_files{.product_private_for_vendor}",
590]
591
592se_policy_conf {
593 name: "plat_policy_for_vendor.conf",
594 srcs: plat_policies_for_vendor,
595 installable: false,
596}
597
598se_policy_cil {
599 name: "plat_policy_for_vendor.cil",
600 src: ":plat_policy_for_vendor.conf",
601 additional_cil_files: [":sepolicy_technical_debt{.plat_private_for_vendor}"],
602 installable: false,
603}
604
605se_policy_conf {
606 name: "reqd_policy_mask_for_vendor.conf",
607 srcs: [":se_build_files{.reqd_mask_for_vendor}"],
608 installable: false,
609}
610
611se_policy_cil {
612 name: "reqd_policy_mask_for_vendor.cil",
613 src: ":reqd_policy_mask_for_vendor.conf",
614 secilc_check: false,
615 installable: false,
616}
617
618se_policy_conf {
619 name: "pub_policy_for_vendor.conf",
620 srcs: plat_public_policies_for_vendor,
621 installable: false,
622}
623
624se_policy_cil {
625 name: "pub_policy_for_vendor.cil",
626 src: ":pub_policy_for_vendor.conf",
627 filter_out: [":reqd_policy_mask_for_vendor.cil"],
628 secilc_check: false,
629 installable: false,
630}
631
632se_versioned_policy {
633 name: "plat_mapping_file_for_vendor",
634 base: ":pub_policy_for_vendor.cil",
635 mapping: true,
636 version: "vendor",
637 installable: false,
638}
639
Inseob Kim039175b2021-03-25 15:37:34 +0900640// plat_pub_versioned.cil - the exported platform policy associated with the version
641// that non-platform policy targets.
642se_versioned_policy {
643 name: "plat_pub_versioned.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900644 base: ":pub_policy_for_vendor.cil",
645 target_policy: ":pub_policy_for_vendor.cil",
646 version: "vendor",
Inseob Kim039175b2021-03-25 15:37:34 +0900647 vendor: true,
648}
649
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900650// vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
651// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
652// policy and the platform public policy files in order to use checkpolicy.
653se_policy_conf {
654 name: "vendor_sepolicy.conf",
655 srcs: plat_public_policies_for_vendor + [
656 ":se_build_files{.plat_vendor_for_vendor}",
657 ":se_build_files{.vendor}",
658 ],
659 installable: false,
660}
661
662se_policy_cil {
663 name: "vendor_sepolicy.cil.raw",
664 src: ":vendor_sepolicy.conf",
665 filter_out: [":reqd_policy_mask_for_vendor.cil"],
666 secilc_check: false, // will be done in se_versioned_policy module
667 installable: false,
668}
669
670se_versioned_policy {
671 name: "vendor_sepolicy.cil",
672 base: ":pub_policy_for_vendor.cil",
673 target_policy: ":vendor_sepolicy.cil.raw",
674 version: "vendor",
675 dependent_cils: [
676 ":plat_policy_for_vendor.cil",
677 ":plat_pub_versioned.cil",
678 ":plat_mapping_file_for_vendor",
679 ],
680 filter_out: [":plat_pub_versioned.cil"],
681 vendor: true,
682}
683
684// odm_policy.cil - the odl sepolicy. This needs attributization and to be combined
685// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
686// policy and the platform public policy files in order to use checkpolicy.
687se_policy_conf {
688 name: "odm_sepolicy.conf",
689 srcs: plat_public_policies_for_vendor + [
690 ":se_build_files{.plat_vendor_for_vendor}",
691 ":se_build_files{.vendor}",
692 ":se_build_files{.odm}",
693 ],
694 installable: false,
695}
696
697se_policy_cil {
698 name: "odm_sepolicy.cil.raw",
699 src: ":odm_sepolicy.conf",
700 filter_out: [
701 ":reqd_policy_mask_for_vendor.cil",
702 ":vendor_sepolicy.cil",
703 ],
704 secilc_check: false, // will be done in se_versioned_policy module
705 installable: false,
706}
707
708se_versioned_policy {
709 name: "odm_sepolicy.cil",
710 base: ":pub_policy_for_vendor.cil",
711 target_policy: ":odm_sepolicy.cil.raw",
712 version: "vendor",
713 dependent_cils: [
714 ":plat_policy_for_vendor.cil",
715 ":plat_pub_versioned.cil",
716 ":plat_mapping_file_for_vendor",
717 ":vendor_sepolicy.cil",
718 ],
719 filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"],
720 device_specific: true,
721}
722
Inseob Kim039175b2021-03-25 15:37:34 +0900723//////////////////////////////////
724// Precompiled sepolicy is loaded if and only if:
725// - plat_sepolicy_and_mapping.sha256 equals
726// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
727// AND
728// - system_ext_sepolicy_and_mapping.sha256 equals
729// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
730// AND
731// - product_sepolicy_and_mapping.sha256 equals
732// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100733// AND
734// - apex_sepolicy.sha256 equals
735// precompiled_sepolicy.apex_sepolicy.sha256
Inseob Kim039175b2021-03-25 15:37:34 +0900736// See system/core/init/selinux.cpp for details.
737//////////////////////////////////
738genrule {
739 name: "plat_sepolicy_and_mapping.sha256_gen",
740 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
741 out: ["plat_sepolicy_and_mapping.sha256"],
742 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
743}
744
745prebuilt_etc {
746 name: "plat_sepolicy_and_mapping.sha256",
747 filename: "plat_sepolicy_and_mapping.sha256",
748 src: ":plat_sepolicy_and_mapping.sha256_gen",
749 relative_install_path: "selinux",
750}
751
752genrule {
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100753 name: "apex_sepolicy.sha256_gen",
754 srcs: [":apex_sepolicy-33.cil"],
755 out: ["apex_sepolicy.sha256"],
756 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
757}
758
759prebuilt_etc {
760 name: "apex_sepolicy.sha256",
761 filename: "apex_sepolicy.sha256",
762 src: ":apex_sepolicy.sha256_gen",
763 installable: false,
764}
765
766genrule {
Inseob Kim039175b2021-03-25 15:37:34 +0900767 name: "system_ext_sepolicy_and_mapping.sha256_gen",
768 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
769 out: ["system_ext_sepolicy_and_mapping.sha256"],
770 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
771}
772
773prebuilt_etc {
774 name: "system_ext_sepolicy_and_mapping.sha256",
775 filename: "system_ext_sepolicy_and_mapping.sha256",
776 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
777 relative_install_path: "selinux",
778 system_ext_specific: true,
779}
780
781genrule {
782 name: "product_sepolicy_and_mapping.sha256_gen",
783 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
784 out: ["product_sepolicy_and_mapping.sha256"],
785 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
786}
787
788prebuilt_etc {
789 name: "product_sepolicy_and_mapping.sha256",
790 filename: "product_sepolicy_and_mapping.sha256",
791 src: ":product_sepolicy_and_mapping.sha256_gen",
792 relative_install_path: "selinux",
793 product_specific: true,
794}
795
Inseob Kim1c056b12021-04-30 00:11:43 +0900796sepolicy_vers {
797 name: "plat_sepolicy_vers.txt",
798 version: "vendor",
799 vendor: true,
800}
801
Inseob Kim731182a2021-05-06 11:44:37 +0000802soong_config_module_type {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900803 name: "precompiled_sepolicy_prebuilts_defaults",
Inseob Kim731182a2021-05-06 11:44:37 +0000804 module_type: "prebuilt_defaults",
805 config_namespace: "ANDROID",
806 bool_variables: ["BOARD_USES_ODMIMAGE"],
807 properties: ["vendor", "device_specific"],
808}
809
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900810precompiled_sepolicy_prebuilts_defaults {
811 name: "precompiled_sepolicy_prebuilts",
Inseob Kim731182a2021-05-06 11:44:37 +0000812 soong_config_variables: {
813 BOARD_USES_ODMIMAGE: {
814 device_specific: true,
815 conditions_default: {
816 vendor: true,
817 },
818 },
819 },
820}
821
822//////////////////////////////////
823// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
824// which precompiled_policy was built.
825//////////////////////////////////
826prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900827 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000828 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
829 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
830 src: ":plat_sepolicy_and_mapping.sha256_gen",
831 relative_install_path: "selinux",
832}
833
834//////////////////////////////////
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100835// SHA-256 digest of the apex_sepolicy.cil against which precompiled_policy
836// was built.
837//////////////////////////////////
838prebuilt_etc {
839 defaults: ["precompiled_sepolicy_prebuilts"],
840 name: "precompiled_sepolicy.apex_sepolicy.sha256",
841 filename: "precompiled_sepolicy.apex_sepolicy.sha256",
842 src: ":apex_sepolicy.sha256_gen",
843 relative_install_path: "selinux",
844}
845
846//////////////////////////////////
Inseob Kim731182a2021-05-06 11:44:37 +0000847// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
848// which precompiled_policy was built.
849//////////////////////////////////
850prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900851 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000852 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
853 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
854 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
855 relative_install_path: "selinux",
856}
857
858//////////////////////////////////
859// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
860// which precompiled_policy was built.
861//////////////////////////////////
862prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900863 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000864 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
865 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
866 src: ":product_sepolicy_and_mapping.sha256_gen",
867 relative_install_path: "selinux",
868}
869
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900870soong_config_module_type {
871 name: "precompiled_se_policy_binary",
872 module_type: "se_policy_binary",
873 config_namespace: "ANDROID",
874 bool_variables: ["BOARD_USES_ODMIMAGE", "IS_TARGET_MIXED_SEPOLICY"],
875 value_variables: ["MIXED_SEPOLICY_VERSION"],
876 properties: ["vendor", "device_specific", "srcs", "ignore_neverallow"],
877}
878
879precompiled_se_policy_binary {
880 name: "precompiled_sepolicy",
881 srcs: [
882 ":plat_sepolicy.cil",
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100883 ":apex_sepolicy-33.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900884 ":plat_pub_versioned.cil",
885 ":system_ext_sepolicy.cil",
886 ":product_sepolicy.cil",
887 ":vendor_sepolicy.cil",
888 ":odm_sepolicy.cil",
889 ],
890 soong_config_variables: {
891 BOARD_USES_ODMIMAGE: {
892 device_specific: true,
893 conditions_default: {
894 vendor: true,
895 },
896 },
897 IS_TARGET_MIXED_SEPOLICY: {
898 ignore_neverallow: true,
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900899 },
900 MIXED_SEPOLICY_VERSION: {
901 srcs: [
902 ":plat_%s.cil",
903 ":system_ext_%s.cil",
904 ":product_%s.cil",
905 ],
906 conditions_default: {
907 srcs: [
908 ":plat_mapping_file",
909 ":system_ext_mapping_file",
910 ":product_mapping_file",
911 ],
912 },
913 },
914 },
Inseob Kim0de7fcc2021-12-22 23:06:53 +0900915 required: [
916 "sepolicy_neverallows",
917 "sepolicy_neverallows_vendor",
918 ],
Inseob Kimeec39192022-01-21 11:47:54 +0900919 dist: {
920 targets: ["base-sepolicy-files-for-mapping"],
921 },
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900922}
Inseob Kim731182a2021-05-06 11:44:37 +0000923
sandrome6971f12022-05-31 08:50:55 +0000924precompiled_se_policy_binary {
925 name: "precompiled_sepolicy-without_apex",
926 srcs: [
927 ":plat_sepolicy.cil",
928 ":plat_pub_versioned.cil",
929 ":system_ext_sepolicy.cil",
930 ":product_sepolicy.cil",
931 ":vendor_sepolicy.cil",
932 ":odm_sepolicy.cil",
933 ],
934 soong_config_variables: {
935 BOARD_USES_ODMIMAGE: {
936 device_specific: true,
937 conditions_default: {
938 vendor: true,
939 },
940 },
941 IS_TARGET_MIXED_SEPOLICY: {
942 ignore_neverallow: true,
943 },
944 MIXED_SEPOLICY_VERSION: {
945 srcs: [
946 ":plat_%s.cil",
947 ":system_ext_%s.cil",
948 ":product_%s.cil",
949 ],
950 conditions_default: {
951 srcs: [
952 ":plat_mapping_file",
953 ":system_ext_mapping_file",
954 ":product_mapping_file",
955 ],
956 },
957 },
958 },
959 required: [
960 "sepolicy_neverallows",
961 "sepolicy_neverallows_vendor",
962 ],
963 dist: {
964 targets: ["base-sepolicy-files-for-mapping"],
965 },
966}
967
Inseob Kim5bbcd682021-12-28 14:57:03 +0900968// policy for recovery
969se_policy_conf {
970 name: "recovery_sepolicy.conf",
971 srcs: plat_policies_for_vendor + [
972 ":se_build_files{.plat_vendor_for_vendor}",
973 ":se_build_files{.vendor}",
974 ":se_build_files{.odm}",
975 ],
976 target_recovery: true,
977 installable: false,
978}
979
980se_policy_cil {
981 name: "recovery_sepolicy.cil",
982 src: ":recovery_sepolicy.conf",
983 secilc_check: false, // will be done in se_policy_binary module
984 installable: false,
985}
986
987se_policy_binary {
988 name: "sepolicy.recovery",
989 srcs: [":recovery_sepolicy.cil"],
990 stem: "sepolicy",
991 recovery: true,
992}
993
Inseob Kima49e7242021-03-22 10:26:13 +0900994//////////////////////////////////
995// SELinux policy embedded into CTS.
996// CTS checks neverallow rules of this policy against the policy of the device under test.
997//////////////////////////////////
998se_policy_conf {
999 name: "general_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001000 srcs: plat_public_policy +
1001 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +09001002 build_variant: "user",
1003 cts: true,
1004 exclude_build_test: true,
1005}
Inseob Kimd5816612021-09-15 03:01:05 +00001006
1007//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001008// Base system policy for treble sepolicy tests.
1009// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1010// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1011// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1012// See treble_sepolicy_tests_for_release.mk for more details.
1013//////////////////////////////////
1014se_policy_conf {
1015 name: "base_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001016 srcs: plat_public_policy +
1017 plat_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001018 build_variant: "user",
1019 installable: false,
1020}
1021
1022se_policy_cil {
1023 name: "base_plat_sepolicy.cil",
1024 src: ":base_plat_sepolicy.conf",
1025 additional_cil_files: ["private/technical_debt.cil"],
1026 installable: false,
1027 secilc_check: false, // done by se_policy_binary
1028}
1029
1030se_policy_binary {
1031 name: "base_plat_sepolicy",
1032 srcs: [":base_plat_sepolicy.cil"],
1033 installable: false,
Inseob Kimeec39192022-01-21 11:47:54 +09001034 dist: {
1035 targets: ["base-sepolicy-files-for-mapping"],
1036 },
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001037}
1038
1039se_policy_conf {
1040 name: "base_system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001041 srcs: plat_public_policy +
1042 plat_private_policy +
1043 system_ext_public_policy +
1044 system_ext_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001045 build_variant: "user",
1046 installable: false,
1047}
1048
1049se_policy_cil {
1050 name: "base_system_ext_sepolicy.cil",
1051 src: ":base_system_ext_sepolicy.conf",
1052 additional_cil_files: ["private/technical_debt.cil"],
1053 system_ext_specific: true,
1054 installable: false,
1055 secilc_check: false, // done by se_policy_binary
1056}
1057
1058se_policy_binary {
1059 name: "base_system_ext_sepolicy",
1060 srcs: [":base_system_ext_sepolicy.cil"],
1061 system_ext_specific: true,
1062 installable: false,
1063}
1064
1065se_policy_conf {
1066 name: "base_product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001067 srcs: plat_public_policy +
1068 plat_private_policy +
1069 system_ext_public_policy +
1070 system_ext_private_policy +
1071 product_public_policy +
1072 product_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001073 build_variant: "user",
1074 installable: false,
1075}
1076
1077se_policy_cil {
1078 name: "base_product_sepolicy.cil",
1079 src: ":base_product_sepolicy.conf",
1080 additional_cil_files: ["private/technical_debt.cil"],
1081 product_specific: true,
1082 installable: false,
1083 secilc_check: false, // done by se_policy_binary
1084}
1085
1086se_policy_binary {
1087 name: "base_product_sepolicy",
1088 srcs: [":base_product_sepolicy.cil"],
1089 product_specific: true,
1090 installable: false,
1091}
1092
1093se_policy_conf {
1094 name: "base_plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001095 srcs: plat_public_policy +
1096 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001097 build_variant: "user",
1098 installable: false,
1099}
1100
1101se_policy_cil {
1102 name: "base_plat_pub_policy.cil",
1103 src: ":base_plat_pub_policy.conf",
1104 filter_out: [":reqd_policy_mask.cil"],
1105 secilc_check: false,
1106 installable: false,
Inseob Kimeec39192022-01-21 11:47:54 +09001107 dist: {
1108 targets: ["base-sepolicy-files-for-mapping"],
1109 },
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001110}
1111
1112se_policy_conf {
1113 name: "base_system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001114 srcs: plat_public_policy +
1115 system_ext_public_policy +
1116 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001117 build_variant: "user",
1118 installable: false,
1119}
1120
1121se_policy_cil {
1122 name: "base_system_ext_pub_policy.cil",
1123 src: ":base_system_ext_pub_policy.conf",
1124 filter_out: [":reqd_policy_mask.cil"],
1125 secilc_check: false,
1126 installable: false,
1127}
1128
1129se_policy_conf {
1130 name: "base_product_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001131 srcs: plat_public_policy +
1132 system_ext_public_policy +
1133 product_public_policy +
1134 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001135 build_variant: "user",
1136 installable: false,
1137}
1138
1139se_policy_cil {
1140 name: "base_product_pub_policy.cil",
1141 src: ":base_product_pub_policy.conf",
1142 filter_out: [":reqd_policy_mask.cil"],
1143 secilc_check: false,
1144 installable: false,
1145}
1146
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001147// bug_map - Bug tracking information for selinux denials loaded by auditd.
Inseob Kim41964032022-04-22 07:50:22 +09001148se_build_files {
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001149 name: "bug_map_files",
1150 srcs: ["bug_map"],
1151}
1152
1153se_bug_map {
1154 name: "plat_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001155 srcs: [":bug_map_files{.plat_private}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001156 stem: "bug_map",
1157}
1158
1159se_bug_map {
1160 name: "system_ext_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001161 srcs: [":bug_map_files{.system_ext_private}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001162 stem: "bug_map",
1163 system_ext_specific: true,
1164}
1165
1166se_bug_map {
1167 name: "vendor_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001168 srcs: [":bug_map_files{.vendor}", ":bug_map_files{.plat_vendor_for_vendor}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001169 // Legacy file name of the vendor partition bug_map.
1170 stem: "selinux_denial_metadata",
1171 vendor: true,
1172}
1173
Inseob Kim0de7fcc2021-12-22 23:06:53 +09001174se_neverallow_test {
1175 name: "sepolicy_neverallows",
1176 srcs: plat_public_policy +
1177 plat_private_policy +
1178 system_ext_public_policy +
1179 system_ext_private_policy +
1180 product_public_policy +
1181 product_private_policy,
1182}
1183
1184se_neverallow_test {
1185 name: "sepolicy_neverallows_vendor",
1186 srcs: plat_policies_for_vendor + [
1187 ":se_build_files{.plat_vendor_for_vendor}",
1188 ":se_build_files{.vendor}",
1189 ":se_build_files{.odm}",
1190 ],
1191}
1192
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001193//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001194// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1195// Additional directories can be specified via Makefile variables:
1196// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1197//////////////////////////////////
1198se_freeze_test {
1199 name: "sepolicy_freeze_test",
1200}
Inseob Kim61257ca2022-02-25 11:26:16 +09001201
1202//////////////////////////////////
1203// sepolicy_test checks various types of violations, which can't be easily done
1204// by CIL itself. Refer tests/sepolicy_tests.py for more detail.
1205//////////////////////////////////
1206genrule {
1207 name: "sepolicy_test",
1208 srcs: [
1209 ":plat_file_contexts",
1210 ":vendor_file_contexts",
1211 ":system_ext_file_contexts",
1212 ":product_file_contexts",
1213 ":odm_file_contexts",
1214 ":precompiled_sepolicy",
1215 ],
1216 tools: ["sepolicy_tests"],
1217 out: ["sepolicy_test"],
1218 cmd: "$(location sepolicy_tests) " +
1219 "-f $(location :plat_file_contexts) " +
1220 "-f $(location :vendor_file_contexts) " +
1221 "-f $(location :system_ext_file_contexts) " +
1222 "-f $(location :product_file_contexts) " +
1223 "-f $(location :odm_file_contexts) " +
1224 "-p $(location :precompiled_sepolicy) && " +
1225 "touch $(out)",
1226}