blob: 5909f8dedddc71354816396c12479057386020be [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
Lokesh Gidra1269a172022-08-01 17:20:38 +0000376
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100377se_policy_conf {
378 name: "apex_sepolicy-33.conf",
Lokesh Gidra1269a172022-08-01 17:20:38 +0000379 srcs: plat_public_policy + plat_private_policy + ["com.android.sepolicy/33/*.te"],
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100380 installable: false,
381}
382
383se_policy_cil {
384 name: "apex_sepolicy-33.cil",
385 src: ":apex_sepolicy-33.conf",
Lokesh Gidra1269a172022-08-01 17:20:38 +0000386 filter_out: [":plat_sepolicy.cil"],
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100387 installable: false,
388 stem: "apex_sepolicy.cil",
389}
390
Sandro143988d2022-08-05 11:38:56 +0000391se_policy_cil {
392 name: "decompiled_sepolicy-without_apex.cil",
393 src: ":precompiled_sepolicy-without_apex",
394 decompile_binary: true,
395}
396
397se_policy_cil {
398 name: "apex_sepolicy-decompiled.cil",
399 src: ":precompiled_sepolicy",
400 decompile_binary: true,
401 filter_out: [":decompiled_sepolicy-without_apex.cil"],
402 additional_cil_files: ["com.android.sepolicy/33/definitions/definitions.cil"],
403 secilc_check: false,
404}
405
Inseob Kim6cc75f42021-04-29 13:53:20 +0000406// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
407se_policy_conf {
408 name: "userdebug_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900409 srcs: plat_public_policy +
410 plat_private_policy,
Inseob Kim6cc75f42021-04-29 13:53:20 +0000411 build_variant: "userdebug",
412 installable: false,
413}
414
415se_policy_cil {
416 name: "userdebug_plat_sepolicy.cil",
417 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900418 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kim6cc75f42021-04-29 13:53:20 +0000419 debug_ramdisk: true,
Yi-Yo Chiang68478b12021-10-16 03:23:05 +0800420 dist: {
421 targets: ["droidcore"],
422 },
Inseob Kim6cc75f42021-04-29 13:53:20 +0000423}
424
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000425// A copy of the userdebug_plat_policy in GSI.
426soong_config_module_type {
427 name: "gsi_se_policy_cil",
428 module_type: "se_policy_cil",
429 config_namespace: "ANDROID",
430 bool_variables: [
431 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
432 ],
433 properties: [
434 "enabled",
435 "installable",
436 ],
437}
438
439gsi_se_policy_cil {
440 name: "system_ext_userdebug_plat_sepolicy.cil",
441 stem: "userdebug_plat_sepolicy.cil",
442 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900443 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000444 system_ext_specific: true,
445 enabled: false,
446 installable: false,
447 soong_config_variables: {
448 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
449 enabled: true,
450 installable: true,
451 },
452 },
453}
454
Inseob Kima49e7242021-03-22 10:26:13 +0900455// system_ext_policy.conf - A combination of the private and public system_ext
456// policy which will ship with the device. System_ext policy is not attributized
457se_policy_conf {
458 name: "system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900459 srcs: plat_public_policy +
460 plat_private_policy +
461 system_ext_public_policy +
462 system_ext_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900463 installable: false,
464}
465
466se_policy_cil {
467 name: "system_ext_sepolicy.cil",
468 src: ":system_ext_sepolicy.conf",
469 system_ext_specific: true,
470 filter_out: [":plat_sepolicy.cil"],
471 remove_line_marker: true,
472}
473
474// product_policy.conf - A combination of the private and public product policy
475// which will ship with the device. Product policy is not attributized
476se_policy_conf {
477 name: "product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900478 srcs: plat_public_policy +
479 plat_private_policy +
480 system_ext_public_policy +
481 system_ext_private_policy +
482 product_public_policy +
483 product_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900484 installable: false,
485}
486
487se_policy_cil {
488 name: "product_sepolicy.cil",
489 src: ":product_sepolicy.conf",
490 product_specific: true,
491 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
492 remove_line_marker: true,
493}
494
Inseob Kim039175b2021-03-25 15:37:34 +0900495// policy mapping files
496// auto-generate the mapping file for current platform policy, since it needs to
497// track platform policy development
498se_versioned_policy {
499 name: "plat_mapping_file",
500 base: ":plat_pub_policy.cil",
501 mapping: true,
502 version: "current",
503 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
504}
505
506se_versioned_policy {
507 name: "system_ext_mapping_file",
508 base: ":system_ext_pub_policy.cil",
509 mapping: true,
510 version: "current",
511 filter_out: [":plat_mapping_file"],
512 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
513 system_ext_specific: true,
514}
515
516se_versioned_policy {
517 name: "product_mapping_file",
518 base: ":pub_policy.cil",
519 mapping: true,
520 version: "current",
521 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
522 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
523 product_specific: true,
524}
525
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900526// vendor/odm sepolicy
527//
528// If BOARD_SEPOLICY_VERS is set to a value other than PLATFORM_SEPOLICY_VERSION,
529// policy files of platform (system, system_ext, product) can't be mixed with
530// policy files of vendor (vendor, odm). If it's the case, platform policies and
531// vendor policies are separately built. More specifically,
532//
533// - Platform policy files needed to build vendor policies, such as plat_policy,
534// plat_mapping_cil, plat_pub_policy, reqd_policy_mask, are built from the
535// prebuilts (copy of platform policy files of version BOARD_SEPOLICY_VERS).
536//
537// - sepolicy_neverallows only checks platform policies, and a new module
538// sepolicy_neverallows_vendor checks vendor policies.
539//
540// - neverallow checks are turned off while compiling precompiled_sepolicy
541// module and sepolicy module.
542//
543// - Vendor policies are not checked on the compat test (compat.mk).
544//
545// In such scenario, we can grab platform policy files from the prebuilts/api
546// directory. But we need more than that: prebuilts of system_ext, product,
547// system/sepolicy/reqd_mask, and system/sepolicy/vendor. The following
548// variables are introduced to specify such prebuilts.
549//
550// - BOARD_REQD_MASK_POLICY (prebuilt of system/sepolicy/reqd_mask)
551// - BOARD_PLAT_VENDOR_POLICY (prebuilt of system/sepolicy/vendor)
552// - BOARD_SYSTEM_EXT_PUBLIC_PREBUILT_DIRS (prebuilt of system_ext public)
553// - BOARD_SYSTEM_EXT_PRIVATE_PREBUILT_DIRS (prebuilt of system_ext private)
554// - BOARD_PRODUCT_PUBLIC_PREBUILT_DIRS (prebuilt of product public)
555// - BOARD_PRODUCT_PRIVATE_PREBUILT_DIRS (prebuilt of product private)
556//
557// Vendors are responsible for copying policy files from the old version of the
558// source tree as prebuilts, and for setting BOARD_*_POLICY variables so they
559// can be used to build vendor policies.
560//
561// To support both mixed build and normal build, platform policy files are
562// indirectly referred as {.(partition)_(scope)_for_vendor}. They will be equal
563// to {.(partition)_scope)} if BOARD_SEPOLICY_VERS == PLATFORM_SEPOLICY_VERSION.
564// Otherwise, they will be equal to the Makefile variables above.
565
566plat_public_policies_for_vendor = [
567 ":se_build_files{.plat_public_for_vendor}",
568 ":se_build_files{.system_ext_public_for_vendor}",
569 ":se_build_files{.product_public_for_vendor}",
570 ":se_build_files{.reqd_mask_for_vendor}",
571]
572
573plat_policies_for_vendor = [
574 ":se_build_files{.plat_public_for_vendor}",
575 ":se_build_files{.plat_private_for_vendor}",
576 ":se_build_files{.system_ext_public_for_vendor}",
577 ":se_build_files{.system_ext_private_for_vendor}",
578 ":se_build_files{.product_public_for_vendor}",
579 ":se_build_files{.product_private_for_vendor}",
580]
581
582se_policy_conf {
583 name: "plat_policy_for_vendor.conf",
584 srcs: plat_policies_for_vendor,
585 installable: false,
586}
587
588se_policy_cil {
589 name: "plat_policy_for_vendor.cil",
590 src: ":plat_policy_for_vendor.conf",
591 additional_cil_files: [":sepolicy_technical_debt{.plat_private_for_vendor}"],
592 installable: false,
593}
594
595se_policy_conf {
596 name: "reqd_policy_mask_for_vendor.conf",
597 srcs: [":se_build_files{.reqd_mask_for_vendor}"],
598 installable: false,
599}
600
601se_policy_cil {
602 name: "reqd_policy_mask_for_vendor.cil",
603 src: ":reqd_policy_mask_for_vendor.conf",
604 secilc_check: false,
605 installable: false,
606}
607
608se_policy_conf {
609 name: "pub_policy_for_vendor.conf",
610 srcs: plat_public_policies_for_vendor,
611 installable: false,
612}
613
614se_policy_cil {
615 name: "pub_policy_for_vendor.cil",
616 src: ":pub_policy_for_vendor.conf",
617 filter_out: [":reqd_policy_mask_for_vendor.cil"],
618 secilc_check: false,
619 installable: false,
620}
621
622se_versioned_policy {
623 name: "plat_mapping_file_for_vendor",
624 base: ":pub_policy_for_vendor.cil",
625 mapping: true,
626 version: "vendor",
627 installable: false,
628}
629
Inseob Kim039175b2021-03-25 15:37:34 +0900630// plat_pub_versioned.cil - the exported platform policy associated with the version
631// that non-platform policy targets.
632se_versioned_policy {
633 name: "plat_pub_versioned.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900634 base: ":pub_policy_for_vendor.cil",
635 target_policy: ":pub_policy_for_vendor.cil",
636 version: "vendor",
Inseob Kim039175b2021-03-25 15:37:34 +0900637 vendor: true,
638}
639
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900640// vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
641// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
642// policy and the platform public policy files in order to use checkpolicy.
643se_policy_conf {
644 name: "vendor_sepolicy.conf",
645 srcs: plat_public_policies_for_vendor + [
646 ":se_build_files{.plat_vendor_for_vendor}",
647 ":se_build_files{.vendor}",
648 ],
649 installable: false,
650}
651
652se_policy_cil {
653 name: "vendor_sepolicy.cil.raw",
654 src: ":vendor_sepolicy.conf",
655 filter_out: [":reqd_policy_mask_for_vendor.cil"],
656 secilc_check: false, // will be done in se_versioned_policy module
657 installable: false,
658}
659
660se_versioned_policy {
661 name: "vendor_sepolicy.cil",
662 base: ":pub_policy_for_vendor.cil",
663 target_policy: ":vendor_sepolicy.cil.raw",
664 version: "vendor",
665 dependent_cils: [
666 ":plat_policy_for_vendor.cil",
667 ":plat_pub_versioned.cil",
668 ":plat_mapping_file_for_vendor",
669 ],
670 filter_out: [":plat_pub_versioned.cil"],
671 vendor: true,
672}
673
674// odm_policy.cil - the odl sepolicy. This needs attributization and to be combined
675// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
676// policy and the platform public policy files in order to use checkpolicy.
677se_policy_conf {
678 name: "odm_sepolicy.conf",
679 srcs: plat_public_policies_for_vendor + [
680 ":se_build_files{.plat_vendor_for_vendor}",
681 ":se_build_files{.vendor}",
682 ":se_build_files{.odm}",
683 ],
684 installable: false,
685}
686
687se_policy_cil {
688 name: "odm_sepolicy.cil.raw",
689 src: ":odm_sepolicy.conf",
690 filter_out: [
691 ":reqd_policy_mask_for_vendor.cil",
692 ":vendor_sepolicy.cil",
693 ],
694 secilc_check: false, // will be done in se_versioned_policy module
695 installable: false,
696}
697
698se_versioned_policy {
699 name: "odm_sepolicy.cil",
700 base: ":pub_policy_for_vendor.cil",
701 target_policy: ":odm_sepolicy.cil.raw",
702 version: "vendor",
703 dependent_cils: [
704 ":plat_policy_for_vendor.cil",
705 ":plat_pub_versioned.cil",
706 ":plat_mapping_file_for_vendor",
707 ":vendor_sepolicy.cil",
708 ],
709 filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"],
710 device_specific: true,
711}
712
Inseob Kim039175b2021-03-25 15:37:34 +0900713//////////////////////////////////
714// Precompiled sepolicy is loaded if and only if:
715// - plat_sepolicy_and_mapping.sha256 equals
716// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
717// AND
718// - system_ext_sepolicy_and_mapping.sha256 equals
719// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
720// AND
721// - product_sepolicy_and_mapping.sha256 equals
722// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100723// AND
724// - apex_sepolicy.sha256 equals
725// precompiled_sepolicy.apex_sepolicy.sha256
Inseob Kim039175b2021-03-25 15:37:34 +0900726// See system/core/init/selinux.cpp for details.
727//////////////////////////////////
728genrule {
729 name: "plat_sepolicy_and_mapping.sha256_gen",
730 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
731 out: ["plat_sepolicy_and_mapping.sha256"],
732 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
733}
734
735prebuilt_etc {
736 name: "plat_sepolicy_and_mapping.sha256",
737 filename: "plat_sepolicy_and_mapping.sha256",
738 src: ":plat_sepolicy_and_mapping.sha256_gen",
739 relative_install_path: "selinux",
740}
741
742genrule {
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100743 name: "apex_sepolicy.sha256_gen",
744 srcs: [":apex_sepolicy-33.cil"],
745 out: ["apex_sepolicy.sha256"],
746 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
747}
748
749prebuilt_etc {
750 name: "apex_sepolicy.sha256",
751 filename: "apex_sepolicy.sha256",
752 src: ":apex_sepolicy.sha256_gen",
753 installable: false,
754}
755
756genrule {
Inseob Kim039175b2021-03-25 15:37:34 +0900757 name: "system_ext_sepolicy_and_mapping.sha256_gen",
758 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
759 out: ["system_ext_sepolicy_and_mapping.sha256"],
760 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
761}
762
763prebuilt_etc {
764 name: "system_ext_sepolicy_and_mapping.sha256",
765 filename: "system_ext_sepolicy_and_mapping.sha256",
766 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
767 relative_install_path: "selinux",
768 system_ext_specific: true,
769}
770
771genrule {
772 name: "product_sepolicy_and_mapping.sha256_gen",
773 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
774 out: ["product_sepolicy_and_mapping.sha256"],
775 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
776}
777
778prebuilt_etc {
779 name: "product_sepolicy_and_mapping.sha256",
780 filename: "product_sepolicy_and_mapping.sha256",
781 src: ":product_sepolicy_and_mapping.sha256_gen",
782 relative_install_path: "selinux",
783 product_specific: true,
784}
785
Inseob Kim1c056b12021-04-30 00:11:43 +0900786sepolicy_vers {
787 name: "plat_sepolicy_vers.txt",
788 version: "vendor",
789 vendor: true,
790}
791
Inseob Kim731182a2021-05-06 11:44:37 +0000792soong_config_module_type {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900793 name: "precompiled_sepolicy_prebuilts_defaults",
Inseob Kim731182a2021-05-06 11:44:37 +0000794 module_type: "prebuilt_defaults",
795 config_namespace: "ANDROID",
796 bool_variables: ["BOARD_USES_ODMIMAGE"],
797 properties: ["vendor", "device_specific"],
798}
799
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900800precompiled_sepolicy_prebuilts_defaults {
801 name: "precompiled_sepolicy_prebuilts",
Inseob Kim731182a2021-05-06 11:44:37 +0000802 soong_config_variables: {
803 BOARD_USES_ODMIMAGE: {
804 device_specific: true,
805 conditions_default: {
806 vendor: true,
807 },
808 },
809 },
810}
811
812//////////////////////////////////
813// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
814// which precompiled_policy was built.
815//////////////////////////////////
816prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900817 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000818 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
819 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
820 src: ":plat_sepolicy_and_mapping.sha256_gen",
821 relative_install_path: "selinux",
822}
823
824//////////////////////////////////
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100825// SHA-256 digest of the apex_sepolicy.cil against which precompiled_policy
826// was built.
827//////////////////////////////////
828prebuilt_etc {
829 defaults: ["precompiled_sepolicy_prebuilts"],
830 name: "precompiled_sepolicy.apex_sepolicy.sha256",
831 filename: "precompiled_sepolicy.apex_sepolicy.sha256",
832 src: ":apex_sepolicy.sha256_gen",
833 relative_install_path: "selinux",
834}
835
836//////////////////////////////////
Inseob Kim731182a2021-05-06 11:44:37 +0000837// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
838// which precompiled_policy was built.
839//////////////////////////////////
840prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900841 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000842 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
843 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
844 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
845 relative_install_path: "selinux",
846}
847
848//////////////////////////////////
849// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
850// which precompiled_policy was built.
851//////////////////////////////////
852prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900853 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +0000854 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
855 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
856 src: ":product_sepolicy_and_mapping.sha256_gen",
857 relative_install_path: "selinux",
858}
859
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900860soong_config_module_type {
861 name: "precompiled_se_policy_binary",
862 module_type: "se_policy_binary",
863 config_namespace: "ANDROID",
864 bool_variables: ["BOARD_USES_ODMIMAGE", "IS_TARGET_MIXED_SEPOLICY"],
865 value_variables: ["MIXED_SEPOLICY_VERSION"],
866 properties: ["vendor", "device_specific", "srcs", "ignore_neverallow"],
867}
868
869precompiled_se_policy_binary {
870 name: "precompiled_sepolicy",
871 srcs: [
872 ":plat_sepolicy.cil",
Jeff Vander Stoepf9348b52021-12-14 13:32:12 +0100873 ":apex_sepolicy-33.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900874 ":plat_pub_versioned.cil",
875 ":system_ext_sepolicy.cil",
876 ":product_sepolicy.cil",
877 ":vendor_sepolicy.cil",
878 ":odm_sepolicy.cil",
879 ],
880 soong_config_variables: {
881 BOARD_USES_ODMIMAGE: {
882 device_specific: true,
883 conditions_default: {
884 vendor: true,
885 },
886 },
887 IS_TARGET_MIXED_SEPOLICY: {
888 ignore_neverallow: true,
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900889 },
890 MIXED_SEPOLICY_VERSION: {
891 srcs: [
892 ":plat_%s.cil",
893 ":system_ext_%s.cil",
894 ":product_%s.cil",
895 ],
896 conditions_default: {
897 srcs: [
898 ":plat_mapping_file",
899 ":system_ext_mapping_file",
900 ":product_mapping_file",
901 ],
902 },
903 },
904 },
Inseob Kim0de7fcc2021-12-22 23:06:53 +0900905 required: [
906 "sepolicy_neverallows",
907 "sepolicy_neverallows_vendor",
908 ],
Inseob Kimeec39192022-01-21 11:47:54 +0900909 dist: {
910 targets: ["base-sepolicy-files-for-mapping"],
911 },
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900912}
Inseob Kim731182a2021-05-06 11:44:37 +0000913
Sandro143988d2022-08-05 11:38:56 +0000914precompiled_se_policy_binary {
915 name: "precompiled_sepolicy-without_apex",
916 srcs: [
917 ":plat_sepolicy.cil",
918 ":plat_pub_versioned.cil",
919 ":system_ext_sepolicy.cil",
920 ":product_sepolicy.cil",
921 ":vendor_sepolicy.cil",
922 ":odm_sepolicy.cil",
923 ],
924 soong_config_variables: {
925 BOARD_USES_ODMIMAGE: {
926 device_specific: true,
927 conditions_default: {
928 vendor: true,
929 },
930 },
931 IS_TARGET_MIXED_SEPOLICY: {
932 ignore_neverallow: true,
933 },
934 MIXED_SEPOLICY_VERSION: {
935 srcs: [
936 ":plat_%s.cil",
937 ":system_ext_%s.cil",
938 ":product_%s.cil",
939 ],
940 conditions_default: {
941 srcs: [
942 ":plat_mapping_file",
943 ":system_ext_mapping_file",
944 ":product_mapping_file",
945 ],
946 },
947 },
948 },
949 required: [
950 "sepolicy_neverallows",
951 "sepolicy_neverallows_vendor",
952 ],
953 dist: {
954 targets: ["base-sepolicy-files-for-mapping"],
955 },
956}
957
Inseob Kim5bbcd682021-12-28 14:57:03 +0900958// policy for recovery
959se_policy_conf {
960 name: "recovery_sepolicy.conf",
961 srcs: plat_policies_for_vendor + [
962 ":se_build_files{.plat_vendor_for_vendor}",
963 ":se_build_files{.vendor}",
964 ":se_build_files{.odm}",
965 ],
966 target_recovery: true,
967 installable: false,
968}
969
970se_policy_cil {
971 name: "recovery_sepolicy.cil",
972 src: ":recovery_sepolicy.conf",
973 secilc_check: false, // will be done in se_policy_binary module
974 installable: false,
975}
976
977se_policy_binary {
978 name: "sepolicy.recovery",
979 srcs: [":recovery_sepolicy.cil"],
980 stem: "sepolicy",
981 recovery: true,
982}
983
Inseob Kima49e7242021-03-22 10:26:13 +0900984//////////////////////////////////
985// SELinux policy embedded into CTS.
986// CTS checks neverallow rules of this policy against the policy of the device under test.
987//////////////////////////////////
988se_policy_conf {
989 name: "general_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900990 srcs: plat_public_policy +
991 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900992 build_variant: "user",
993 cts: true,
994 exclude_build_test: true,
995}
Inseob Kimd5816612021-09-15 03:01:05 +0000996
997//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +0000998// Base system policy for treble sepolicy tests.
999// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1000// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1001// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1002// See treble_sepolicy_tests_for_release.mk for more details.
1003//////////////////////////////////
1004se_policy_conf {
1005 name: "base_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001006 srcs: plat_public_policy +
1007 plat_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001008 build_variant: "user",
1009 installable: false,
1010}
1011
1012se_policy_cil {
1013 name: "base_plat_sepolicy.cil",
1014 src: ":base_plat_sepolicy.conf",
1015 additional_cil_files: ["private/technical_debt.cil"],
1016 installable: false,
1017 secilc_check: false, // done by se_policy_binary
1018}
1019
1020se_policy_binary {
1021 name: "base_plat_sepolicy",
1022 srcs: [":base_plat_sepolicy.cil"],
1023 installable: false,
Inseob Kimeec39192022-01-21 11:47:54 +09001024 dist: {
1025 targets: ["base-sepolicy-files-for-mapping"],
1026 },
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001027}
1028
1029se_policy_conf {
1030 name: "base_system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001031 srcs: plat_public_policy +
1032 plat_private_policy +
1033 system_ext_public_policy +
1034 system_ext_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001035 build_variant: "user",
1036 installable: false,
1037}
1038
1039se_policy_cil {
1040 name: "base_system_ext_sepolicy.cil",
1041 src: ":base_system_ext_sepolicy.conf",
1042 additional_cil_files: ["private/technical_debt.cil"],
1043 system_ext_specific: true,
1044 installable: false,
1045 secilc_check: false, // done by se_policy_binary
1046}
1047
1048se_policy_binary {
1049 name: "base_system_ext_sepolicy",
1050 srcs: [":base_system_ext_sepolicy.cil"],
1051 system_ext_specific: true,
1052 installable: false,
1053}
1054
1055se_policy_conf {
1056 name: "base_product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001057 srcs: plat_public_policy +
1058 plat_private_policy +
1059 system_ext_public_policy +
1060 system_ext_private_policy +
1061 product_public_policy +
1062 product_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001063 build_variant: "user",
1064 installable: false,
1065}
1066
1067se_policy_cil {
1068 name: "base_product_sepolicy.cil",
1069 src: ":base_product_sepolicy.conf",
1070 additional_cil_files: ["private/technical_debt.cil"],
1071 product_specific: true,
1072 installable: false,
1073 secilc_check: false, // done by se_policy_binary
1074}
1075
1076se_policy_binary {
1077 name: "base_product_sepolicy",
1078 srcs: [":base_product_sepolicy.cil"],
1079 product_specific: true,
1080 installable: false,
1081}
1082
1083se_policy_conf {
1084 name: "base_plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001085 srcs: plat_public_policy +
1086 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001087 build_variant: "user",
1088 installable: false,
1089}
1090
1091se_policy_cil {
1092 name: "base_plat_pub_policy.cil",
1093 src: ":base_plat_pub_policy.conf",
1094 filter_out: [":reqd_policy_mask.cil"],
1095 secilc_check: false,
1096 installable: false,
Inseob Kimeec39192022-01-21 11:47:54 +09001097 dist: {
1098 targets: ["base-sepolicy-files-for-mapping"],
1099 },
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001100}
1101
1102se_policy_conf {
1103 name: "base_system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001104 srcs: plat_public_policy +
1105 system_ext_public_policy +
1106 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001107 build_variant: "user",
1108 installable: false,
1109}
1110
1111se_policy_cil {
1112 name: "base_system_ext_pub_policy.cil",
1113 src: ":base_system_ext_pub_policy.conf",
1114 filter_out: [":reqd_policy_mask.cil"],
1115 secilc_check: false,
1116 installable: false,
1117}
1118
1119se_policy_conf {
1120 name: "base_product_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001121 srcs: plat_public_policy +
1122 system_ext_public_policy +
1123 product_public_policy +
1124 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001125 build_variant: "user",
1126 installable: false,
1127}
1128
1129se_policy_cil {
1130 name: "base_product_pub_policy.cil",
1131 src: ":base_product_pub_policy.conf",
1132 filter_out: [":reqd_policy_mask.cil"],
1133 secilc_check: false,
1134 installable: false,
1135}
1136
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001137// bug_map - Bug tracking information for selinux denials loaded by auditd.
Inseob Kim41964032022-04-22 07:50:22 +09001138se_build_files {
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001139 name: "bug_map_files",
1140 srcs: ["bug_map"],
1141}
1142
1143se_bug_map {
1144 name: "plat_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001145 srcs: [":bug_map_files{.plat_private}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001146 stem: "bug_map",
1147}
1148
1149se_bug_map {
1150 name: "system_ext_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001151 srcs: [":bug_map_files{.system_ext_private}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001152 stem: "bug_map",
1153 system_ext_specific: true,
1154}
1155
1156se_bug_map {
1157 name: "vendor_bug_map",
Inseob Kim41964032022-04-22 07:50:22 +09001158 srcs: [":bug_map_files{.vendor}", ":bug_map_files{.plat_vendor_for_vendor}"],
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001159 // Legacy file name of the vendor partition bug_map.
1160 stem: "selinux_denial_metadata",
1161 vendor: true,
1162}
1163
Inseob Kim0de7fcc2021-12-22 23:06:53 +09001164se_neverallow_test {
1165 name: "sepolicy_neverallows",
1166 srcs: plat_public_policy +
1167 plat_private_policy +
1168 system_ext_public_policy +
1169 system_ext_private_policy +
1170 product_public_policy +
1171 product_private_policy,
1172}
1173
1174se_neverallow_test {
1175 name: "sepolicy_neverallows_vendor",
1176 srcs: plat_policies_for_vendor + [
1177 ":se_build_files{.plat_vendor_for_vendor}",
1178 ":se_build_files{.vendor}",
1179 ":se_build_files{.odm}",
1180 ],
1181}
1182
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001183//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001184// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1185// Additional directories can be specified via Makefile variables:
1186// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1187//////////////////////////////////
1188se_freeze_test {
1189 name: "sepolicy_freeze_test",
1190}
Inseob Kim61257ca2022-02-25 11:26:16 +09001191
1192//////////////////////////////////
1193// sepolicy_test checks various types of violations, which can't be easily done
1194// by CIL itself. Refer tests/sepolicy_tests.py for more detail.
1195//////////////////////////////////
1196genrule {
1197 name: "sepolicy_test",
1198 srcs: [
1199 ":plat_file_contexts",
1200 ":vendor_file_contexts",
1201 ":system_ext_file_contexts",
1202 ":product_file_contexts",
1203 ":odm_file_contexts",
1204 ":precompiled_sepolicy",
1205 ],
1206 tools: ["sepolicy_tests"],
1207 out: ["sepolicy_test"],
1208 cmd: "$(location sepolicy_tests) " +
1209 "-f $(location :plat_file_contexts) " +
1210 "-f $(location :vendor_file_contexts) " +
1211 "-f $(location :system_ext_file_contexts) " +
1212 "-f $(location :product_file_contexts) " +
1213 "-f $(location :odm_file_contexts) " +
1214 "-p $(location :precompiled_sepolicy) && " +
1215 "touch $(out)",
1216}