blob: 15adf7e71f5680eada7c46bbc36ab9e5a8c26baf [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
Tri Vo84e247a2018-03-25 20:03:58 -070047se_filegroup {
48 name: "26.0.board.compat.map",
49 srcs: [
50 "compat/26.0/26.0.cil",
51 ],
52}
53
54se_filegroup {
55 name: "27.0.board.compat.map",
56 srcs: [
57 "compat/27.0/27.0.cil",
58 ],
59}
60
Jae Shin1fa96342018-07-11 18:30:44 +090061se_filegroup {
62 name: "28.0.board.compat.map",
63 srcs: [
64 "compat/28.0/28.0.cil",
65 ],
66}
67
Jinguang Donge0125692019-03-05 17:20:54 +080068se_filegroup {
Tri Vo50aa0292019-06-01 17:04:13 -070069 name: "29.0.board.compat.map",
70 srcs: [
71 "compat/29.0/29.0.cil",
72 ],
73}
74
75se_filegroup {
Inseob Kimace36ab2020-05-07 20:19:05 +090076 name: "30.0.board.compat.map",
77 srcs: [
78 "compat/30.0/30.0.cil",
79 ],
80}
81
82se_filegroup {
Jinguang Donge0125692019-03-05 17:20:54 +080083 name: "26.0.board.ignore.map",
84 srcs: [
85 "compat/26.0/26.0.ignore.cil",
86 ],
87}
88
89se_filegroup {
90 name: "27.0.board.ignore.map",
91 srcs: [
92 "compat/27.0/27.0.ignore.cil",
93 ],
94}
95
96se_filegroup {
97 name: "28.0.board.ignore.map",
98 srcs: [
99 "compat/28.0/28.0.ignore.cil",
100 ],
101}
102
Tri Vo50aa0292019-06-01 17:04:13 -0700103se_filegroup {
104 name: "29.0.board.ignore.map",
105 srcs: [
106 "compat/29.0/29.0.ignore.cil",
107 ],
108}
109
Inseob Kimace36ab2020-05-07 20:19:05 +0900110se_filegroup {
111 name: "30.0.board.ignore.map",
112 srcs: [
113 "compat/30.0/30.0.ignore.cil",
114 ],
115}
116
Tri Voa5cfd3e2018-03-22 11:35:02 -0700117se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700118 name: "plat_26.0.cil",
119 stem: "26.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700120 bottom_half: [":26.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700121 top_half: "plat_27.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700122}
123
124se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700125 name: "plat_27.0.cil",
126 stem: "27.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700127 bottom_half: [":27.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700128 top_half: "plat_28.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700129}
Jae Shin1fa96342018-07-11 18:30:44 +0900130
131se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700132 name: "plat_28.0.cil",
133 stem: "28.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700134 bottom_half: [":28.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700135 top_half: "plat_29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700136}
137
138se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700139 name: "plat_29.0.cil",
140 stem: "29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700141 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900142 top_half: "plat_30.0.cil",
143}
144
145se_cil_compat_map {
146 name: "plat_30.0.cil",
147 stem: "30.0.cil",
148 bottom_half: [":30.0.board.compat.map"],
149 // top_half: "plat_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700150}
151
152se_cil_compat_map {
153 name: "system_ext_26.0.cil",
154 stem: "26.0.cil",
155 bottom_half: [":26.0.board.compat.map"],
156 top_half: "system_ext_27.0.cil",
157 system_ext_specific: true,
158}
159
160se_cil_compat_map {
161 name: "system_ext_27.0.cil",
162 stem: "27.0.cil",
163 bottom_half: [":27.0.board.compat.map"],
164 top_half: "system_ext_28.0.cil",
165 system_ext_specific: true,
166}
167
168se_cil_compat_map {
169 name: "system_ext_28.0.cil",
170 stem: "28.0.cil",
171 bottom_half: [":28.0.board.compat.map"],
172 top_half: "system_ext_29.0.cil",
173 system_ext_specific: true,
174}
175
176se_cil_compat_map {
177 name: "system_ext_29.0.cil",
178 stem: "29.0.cil",
179 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900180 top_half: "system_ext_30.0.cil",
181 system_ext_specific: true,
182}
183
184se_cil_compat_map {
185 name: "system_ext_30.0.cil",
186 stem: "30.0.cil",
187 bottom_half: [":30.0.board.compat.map"],
188 // top_half: "system_ext_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700189 system_ext_specific: true,
190}
191
192se_cil_compat_map {
193 name: "product_26.0.cil",
194 stem: "26.0.cil",
195 bottom_half: [":26.0.board.compat.map"],
196 top_half: "product_27.0.cil",
197 product_specific: true,
198}
199
200se_cil_compat_map {
201 name: "product_27.0.cil",
202 stem: "27.0.cil",
203 bottom_half: [":27.0.board.compat.map"],
204 top_half: "product_28.0.cil",
205 product_specific: true,
206}
207
208se_cil_compat_map {
209 name: "product_28.0.cil",
210 stem: "28.0.cil",
211 bottom_half: [":28.0.board.compat.map"],
212 top_half: "product_29.0.cil",
213 product_specific: true,
214}
215
216se_cil_compat_map {
217 name: "product_29.0.cil",
218 stem: "29.0.cil",
219 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900220 top_half: "product_30.0.cil",
221 product_specific: true,
222}
223
224se_cil_compat_map {
225 name: "product_30.0.cil",
226 stem: "30.0.cil",
227 bottom_half: [":30.0.board.compat.map"],
228 // top_half: "product_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700229 product_specific: true,
Tri Vo438684b2018-09-29 17:47:10 -0700230}
231
232se_cil_compat_map {
233 name: "26.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800234 bottom_half: [":26.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700235 top_half: "27.0.ignore.cil",
236}
237
238se_cil_compat_map {
239 name: "27.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800240 bottom_half: [":27.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700241 top_half: "28.0.ignore.cil",
242}
243
244se_cil_compat_map {
245 name: "28.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800246 bottom_half: [":28.0.board.ignore.map"],
Tri Voe381deb2019-06-12 15:52:30 -0700247 top_half: "29.0.ignore.cil",
Jae Shin1fa96342018-07-11 18:30:44 +0900248}
Inseob Kimb554e592019-04-15 20:10:46 +0900249
Tri Vo50aa0292019-06-01 17:04:13 -0700250se_cil_compat_map {
251 name: "29.0.ignore.cil",
252 bottom_half: [":29.0.board.ignore.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900253 top_half: "30.0.ignore.cil",
254}
255
256se_cil_compat_map {
257 name: "30.0.ignore.cil",
258 bottom_half: [":30.0.board.ignore.map"],
259 // top_half: "31.0.ignore.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700260}
261
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700262prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700263 name: "26.0.compat.cil",
264 src: "private/compat/26.0/26.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700265 sub_dir: "selinux/mapping",
266}
267
268prebuilt_etc {
269 name: "27.0.compat.cil",
270 src: "private/compat/27.0/27.0.compat.cil",
271 sub_dir: "selinux/mapping",
272}
273
274prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700275 name: "28.0.compat.cil",
276 src: "private/compat/28.0/28.0.compat.cil",
277 sub_dir: "selinux/mapping",
278}
279
280prebuilt_etc {
281 name: "29.0.compat.cil",
282 src: "private/compat/29.0/29.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700283 sub_dir: "selinux/mapping",
284}
285
Inseob Kimace36ab2020-05-07 20:19:05 +0900286prebuilt_etc {
287 name: "30.0.compat.cil",
288 src: "private/compat/30.0/30.0.compat.cil",
289 sub_dir: "selinux/mapping",
290}
291
Inseob Kimb554e592019-04-15 20:10:46 +0900292se_filegroup {
293 name: "file_contexts_files",
294 srcs: ["file_contexts"],
295}
296
297se_filegroup {
298 name: "file_contexts_asan_files",
299 srcs: ["file_contexts_asan"],
300}
301
302se_filegroup {
303 name: "file_contexts_overlayfs_files",
304 srcs: ["file_contexts_overlayfs"],
305}
306
307se_filegroup {
308 name: "hwservice_contexts_files",
309 srcs: ["hwservice_contexts"],
310}
311
312se_filegroup {
313 name: "property_contexts_files",
314 srcs: ["property_contexts"],
315}
316
317se_filegroup {
318 name: "service_contexts_files",
319 srcs: ["service_contexts"],
320}
321
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700322se_filegroup {
323 name: "keystore2_key_contexts_files",
324 srcs: ["keystore2_key_contexts"],
325}
326
Inseob Kimb554e592019-04-15 20:10:46 +0900327file_contexts {
328 name: "plat_file_contexts",
329 srcs: [":file_contexts_files"],
330 product_variables: {
331 address_sanitize: {
332 srcs: [":file_contexts_asan_files"],
333 },
334 debuggable: {
335 srcs: [":file_contexts_overlayfs_files"],
336 },
337 },
338
339 flatten_apex: {
340 srcs: ["apex/*-file_contexts"],
341 },
342
343 recovery_available: true,
344}
345
346file_contexts {
347 name: "vendor_file_contexts",
348 srcs: [":file_contexts_files"],
349 soc_specific: true,
350 recovery_available: true,
351}
352
353file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800354 name: "system_ext_file_contexts",
355 srcs: [":file_contexts_files"],
356 system_ext_specific: true,
357 recovery_available: true,
358}
359
360file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900361 name: "product_file_contexts",
362 srcs: [":file_contexts_files"],
363 product_specific: true,
364 recovery_available: true,
365}
366
367file_contexts {
368 name: "odm_file_contexts",
369 srcs: [":file_contexts_files"],
370 device_specific: true,
371 recovery_available: true,
372}
373
374hwservice_contexts {
375 name: "plat_hwservice_contexts",
376 srcs: [":hwservice_contexts_files"],
377}
378
379hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800380 name: "system_ext_hwservice_contexts",
381 srcs: [":hwservice_contexts_files"],
382 system_ext_specific: true,
383}
384
385hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900386 name: "product_hwservice_contexts",
387 srcs: [":hwservice_contexts_files"],
388 product_specific: true,
389}
390
391hwservice_contexts {
392 name: "vendor_hwservice_contexts",
393 srcs: [":hwservice_contexts_files"],
394 reqd_mask: true,
395 soc_specific: true,
396}
397
398hwservice_contexts {
399 name: "odm_hwservice_contexts",
400 srcs: [":hwservice_contexts_files"],
401 device_specific: true,
402}
403
404property_contexts {
405 name: "plat_property_contexts",
406 srcs: [":property_contexts_files"],
407 recovery_available: true,
408}
409
410property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800411 name: "system_ext_property_contexts",
412 srcs: [":property_contexts_files"],
413 system_ext_specific: true,
414 recovery_available: true,
415}
416
417property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900418 name: "product_property_contexts",
419 srcs: [":property_contexts_files"],
420 product_specific: true,
421 recovery_available: true,
422}
423
424property_contexts {
425 name: "vendor_property_contexts",
426 srcs: [":property_contexts_files"],
427 reqd_mask: true,
428 soc_specific: true,
429 recovery_available: true,
430}
431
432property_contexts {
433 name: "odm_property_contexts",
434 srcs: [":property_contexts_files"],
435 device_specific: true,
436 recovery_available: true,
437}
438
439service_contexts {
440 name: "plat_service_contexts",
441 srcs: [":service_contexts_files"],
442}
443
444service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800445 name: "system_ext_service_contexts",
446 srcs: [":service_contexts_files"],
447 system_ext_specific: true,
448}
449
450service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900451 name: "product_service_contexts",
452 srcs: [":service_contexts_files"],
453 product_specific: true,
454}
455
456service_contexts {
457 name: "vendor_service_contexts",
458 srcs: [":service_contexts_files"],
459 reqd_mask: true,
460 soc_specific: true,
461}
yangbill3e345372020-04-15 13:55:47 +0800462
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700463keystore2_key_contexts {
464 name: "plat_keystore2_key_contexts",
465 srcs: [":keystore2_key_contexts_files"],
466}
467
468keystore2_key_contexts {
469 name: "system_keystore2_key_contexts",
470 srcs: [":keystore2_key_contexts_files"],
471 system_ext_specific: true,
472}
473
474keystore2_key_contexts {
475 name: "product_keystore2_key_contexts",
476 srcs: [":keystore2_key_contexts_files"],
477 product_specific: true,
478}
479
480keystore2_key_contexts {
481 name: "vendor_keystore2_key_contexts",
482 srcs: [":keystore2_key_contexts_files"],
483 reqd_mask: true,
484 soc_specific: true,
485}
486
yangbill3e345372020-04-15 13:55:47 +0800487// For vts_treble_sys_prop_test
488filegroup {
489 name: "private_property_contexts",
490 srcs: ["private/property_contexts"],
491 visibility: [
492 "//test/vts-testcase/security/system_property",
493 ],
494}
Inseob Kime35b49b2021-02-18 19:15:41 +0900495
Inseob Kima49e7242021-03-22 10:26:13 +0900496se_build_files {
497 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900498 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900499 "security_classes",
500 "initial_sids",
501 "access_vectors",
502 "global_macros",
503 "neverallow_macros",
504 "mls_macros",
505 "mls_decl",
506 "mls",
507 "policy_capabilities",
508 "te_macros",
509 "attributes",
510 "ioctl_defines",
511 "ioctl_macros",
512 "*.te",
513 "roles_decl",
514 "roles",
515 "users",
516 "initial_sid_contexts",
517 "fs_use",
518 "genfs_contexts",
519 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900520 ],
521}
522
Inseob Kima49e7242021-03-22 10:26:13 +0900523// reqd_policy_mask - a policy.conf file which contains only the bare minimum
524// policy necessary to use checkpolicy.
525//
526// This bare-minimum policy needs to be present in all policy.conf files, but
527// should not necessarily be exported as part of the public policy.
528//
529// The rules generated by reqd_policy_mask will allow the compilation of public
530// policy and subsequent removal of CIL policy that should not be exported.
531se_policy_conf {
532 name: "reqd_policy_mask.conf",
533 srcs: [":se_build_files{.reqd_mask}"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900534 installable: false,
535}
536
Inseob Kima49e7242021-03-22 10:26:13 +0900537se_policy_cil {
538 name: "reqd_policy_mask.cil",
539 src: ":reqd_policy_mask.conf",
540 secilc_check: false,
541 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900542}
543
Inseob Kima49e7242021-03-22 10:26:13 +0900544// pub_policy - policy that will be exported to be a part of non-platform
545// policy corresponding to this platform version.
546//
547// This is a limited subset of policy that would not compile in checkpolicy on
548// its own.
549//
550// To get around this limitation, add only the required files from private
551// policy, which will generate CIL policy that will then be filtered out by the
552// reqd_policy_mask.
553//
554// There are three pub_policy.cil files below:
555// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
556// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
557// - plat_pub_policy.cil: exported 'system' policy.
558//
559// Those above files will in turn be used to generate the following versioned cil files:
560// - product_mapping_file: the versioned, exported 'product' policy in product partition.
561// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
562// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
563// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
564// in vendor partition.
565//
566se_policy_conf {
567 name: "pub_policy.conf",
568 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
569 installable: false,
570}
571
572se_policy_cil {
573 name: "pub_policy.cil",
574 src: ":pub_policy.conf",
575 filter_out: [":reqd_policy_mask.cil"],
576 secilc_check: false,
577 installable: false,
578}
579
580se_policy_conf {
581 name: "system_ext_pub_policy.conf",
582 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
583 installable: false,
584}
585
586se_policy_cil {
587 name: "system_ext_pub_policy.cil",
588 src: ":system_ext_pub_policy.conf",
589 filter_out: [":reqd_policy_mask.cil"],
590 secilc_check: false,
591 installable: false,
592}
593
594se_policy_conf {
595 name: "plat_pub_policy.conf",
596 srcs: [":se_build_files{.plat_public}"],
597 installable: false,
598}
599
600se_policy_cil {
601 name: "plat_pub_policy.cil",
602 src: ":plat_pub_policy.conf",
603 filter_out: [":reqd_policy_mask.cil"],
604 secilc_check: false,
605 installable: false,
606}
607
608// plat_policy.conf - A combination of the private and public platform policy
609// which will ship with the device.
610//
611// The platform will always reflect the most recent platform version and is not
612// currently being attributized.
613se_policy_conf {
614 name: "plat_sepolicy.conf",
615 srcs: [":se_build_files{.plat}"],
616 installable: false,
617}
618
619se_policy_cil {
620 name: "plat_sepolicy.cil",
621 src: ":plat_sepolicy.conf",
622 additional_cil_files: ["private/technical_debt.cil"],
623}
624
625// system_ext_policy.conf - A combination of the private and public system_ext
626// policy which will ship with the device. System_ext policy is not attributized
627se_policy_conf {
628 name: "system_ext_sepolicy.conf",
629 srcs: [":se_build_files{.system_ext}"],
630 installable: false,
631}
632
633se_policy_cil {
634 name: "system_ext_sepolicy.cil",
635 src: ":system_ext_sepolicy.conf",
636 system_ext_specific: true,
637 filter_out: [":plat_sepolicy.cil"],
638 remove_line_marker: true,
639}
640
641// product_policy.conf - A combination of the private and public product policy
642// which will ship with the device. Product policy is not attributized
643se_policy_conf {
644 name: "product_sepolicy.conf",
645 srcs: [":se_build_files{.product}"],
646 installable: false,
647}
648
649se_policy_cil {
650 name: "product_sepolicy.cil",
651 src: ":product_sepolicy.conf",
652 product_specific: true,
653 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
654 remove_line_marker: true,
655}
656
Inseob Kim039175b2021-03-25 15:37:34 +0900657// policy mapping files
658// auto-generate the mapping file for current platform policy, since it needs to
659// track platform policy development
660se_versioned_policy {
661 name: "plat_mapping_file",
662 base: ":plat_pub_policy.cil",
663 mapping: true,
664 version: "current",
665 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
666}
667
668se_versioned_policy {
669 name: "system_ext_mapping_file",
670 base: ":system_ext_pub_policy.cil",
671 mapping: true,
672 version: "current",
673 filter_out: [":plat_mapping_file"],
674 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
675 system_ext_specific: true,
676}
677
678se_versioned_policy {
679 name: "product_mapping_file",
680 base: ":pub_policy.cil",
681 mapping: true,
682 version: "current",
683 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
684 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
685 product_specific: true,
686}
687
688// plat_pub_versioned.cil - the exported platform policy associated with the version
689// that non-platform policy targets.
690se_versioned_policy {
691 name: "plat_pub_versioned.cil",
692 base: ":pub_policy.cil",
693 target_policy: ":pub_policy.cil",
694 version: "current",
695 dependent_cils: [
696 ":plat_sepolicy.cil",
697 ":system_ext_sepolicy.cil",
698 ":product_sepolicy.cil",
699 ":plat_mapping_file",
700 ":system_ext_mapping_file",
701 ":product_mapping_file",
702 ],
703 vendor: true,
704}
705
706//////////////////////////////////
707// Precompiled sepolicy is loaded if and only if:
708// - plat_sepolicy_and_mapping.sha256 equals
709// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
710// AND
711// - system_ext_sepolicy_and_mapping.sha256 equals
712// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
713// AND
714// - product_sepolicy_and_mapping.sha256 equals
715// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
716// See system/core/init/selinux.cpp for details.
717//////////////////////////////////
718genrule {
719 name: "plat_sepolicy_and_mapping.sha256_gen",
720 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
721 out: ["plat_sepolicy_and_mapping.sha256"],
722 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
723}
724
725prebuilt_etc {
726 name: "plat_sepolicy_and_mapping.sha256",
727 filename: "plat_sepolicy_and_mapping.sha256",
728 src: ":plat_sepolicy_and_mapping.sha256_gen",
729 relative_install_path: "selinux",
730}
731
732genrule {
733 name: "system_ext_sepolicy_and_mapping.sha256_gen",
734 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
735 out: ["system_ext_sepolicy_and_mapping.sha256"],
736 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
737}
738
739prebuilt_etc {
740 name: "system_ext_sepolicy_and_mapping.sha256",
741 filename: "system_ext_sepolicy_and_mapping.sha256",
742 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
743 relative_install_path: "selinux",
744 system_ext_specific: true,
745}
746
747genrule {
748 name: "product_sepolicy_and_mapping.sha256_gen",
749 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
750 out: ["product_sepolicy_and_mapping.sha256"],
751 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
752}
753
754prebuilt_etc {
755 name: "product_sepolicy_and_mapping.sha256",
756 filename: "product_sepolicy_and_mapping.sha256",
757 src: ":product_sepolicy_and_mapping.sha256_gen",
758 relative_install_path: "selinux",
759 product_specific: true,
760}
761
Inseob Kima49e7242021-03-22 10:26:13 +0900762//////////////////////////////////
763// SELinux policy embedded into CTS.
764// CTS checks neverallow rules of this policy against the policy of the device under test.
765//////////////////////////////////
766se_policy_conf {
767 name: "general_sepolicy.conf",
768 srcs: [":se_build_files{.plat}"],
769 build_variant: "user",
770 cts: true,
771 exclude_build_test: true,
772}
773
774//////////////////////////////////
775// modules for microdroid
Inseob Kima49e7242021-03-22 10:26:13 +0900776//////////////////////////////////
Inseob Kime35b49b2021-02-18 19:15:41 +0900777
Inseob Kim50375ce2021-03-25 15:41:06 +0900778// microdroid's system sepolicy is almost identical to host's system sepolicy, except that
779// microdroid doesn't have system_ext and product. So microdroid's plat_pub_versioned.cil is
780// generated with plat_pub_policy.cil (exported system), not pub_policy.cil (exported system +
781// system_ext + product). Other two files, plat_sepolicy.cil and plat_mapping_file, are copied from
782// host's files.
783se_versioned_policy {
Inseob Kima49e7242021-03-22 10:26:13 +0900784 name: "microdroid_plat_pub_versioned.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900785 stem: "plat_pub_versioned.cil",
786 base: ":plat_pub_policy.cil",
787 target_policy: ":plat_pub_policy.cil",
788 version: "current",
789 dependent_cils: [
790 ":plat_sepolicy.cil",
791 ":plat_mapping_file",
792 ],
Inseob Kima49e7242021-03-22 10:26:13 +0900793 installable: false,
794}
795
Inseob Kim50375ce2021-03-25 15:41:06 +0900796// microdroid's vendor sepolicy is a minimalized sepolicy needed for microdroid to boot. It just
797// contains system/sepolicy/public and system/sepolicy/vendor.
Inseob Kim50375ce2021-03-25 15:41:06 +0900798se_policy_conf {
799 name: "microdroid_vendor_sepolicy.conf",
Inseob Kim39fbcf72021-04-05 17:52:51 +0900800 srcs: [":se_build_files{.plat_vendor}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900801 installable: false,
802}
803
Inseob Kim50375ce2021-03-25 15:41:06 +0900804se_policy_cil {
805 name: "microdroid_vendor_sepolicy.cil.raw",
806 src: ":microdroid_vendor_sepolicy.conf",
807 filter_out: [":reqd_policy_mask.cil"],
808 secilc_check: false, // will be done in se_versioned_policy module
809 installable: false,
Jiyong Parkd89564e2021-03-03 14:56:43 +0000810}
811
Inseob Kim50375ce2021-03-25 15:41:06 +0900812se_versioned_policy {
Jiyong Parkd89564e2021-03-03 14:56:43 +0000813 name: "microdroid_vendor_sepolicy.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900814 stem: "vendor_sepolicy.cil",
815 base: ":plat_pub_policy.cil",
816 target_policy: ":microdroid_vendor_sepolicy.cil.raw",
817 version: "current", // microdroid is bundled to system
818 dependent_cils: [
819 ":plat_sepolicy.cil",
820 ":microdroid_plat_pub_versioned.cil",
821 ":plat_mapping_file",
822 ],
823 filter_out: [":microdroid_plat_pub_versioned.cil"],
Jiyong Parkd89564e2021-03-03 14:56:43 +0000824 installable: false,
825}