blob: b06f45180c72b4f7065e977f77bff3553dbae1ff [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 {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +080083 name: "26.0.board.compat.cil",
84 srcs: [
85 "compat/26.0/26.0.compat.cil",
86 ],
87}
88
89se_filegroup {
90 name: "27.0.board.compat.cil",
91 srcs: [
92 "compat/27.0/27.0.compat.cil",
93 ],
94}
95
96se_filegroup {
97 name: "28.0.board.compat.cil",
98 srcs: [
99 "compat/28.0/28.0.compat.cil",
100 ],
101}
102
103se_filegroup {
104 name: "29.0.board.compat.cil",
105 srcs: [
106 "compat/29.0/29.0.compat.cil",
107 ],
108}
109
110se_filegroup {
111 name: "30.0.board.compat.cil",
112 srcs: [
113 "compat/30.0/30.0.compat.cil",
114 ],
115}
116
117se_filegroup {
Jinguang Donge0125692019-03-05 17:20:54 +0800118 name: "26.0.board.ignore.map",
119 srcs: [
120 "compat/26.0/26.0.ignore.cil",
121 ],
122}
123
124se_filegroup {
125 name: "27.0.board.ignore.map",
126 srcs: [
127 "compat/27.0/27.0.ignore.cil",
128 ],
129}
130
131se_filegroup {
132 name: "28.0.board.ignore.map",
133 srcs: [
134 "compat/28.0/28.0.ignore.cil",
135 ],
136}
137
Tri Vo50aa0292019-06-01 17:04:13 -0700138se_filegroup {
139 name: "29.0.board.ignore.map",
140 srcs: [
141 "compat/29.0/29.0.ignore.cil",
142 ],
143}
144
Inseob Kimace36ab2020-05-07 20:19:05 +0900145se_filegroup {
146 name: "30.0.board.ignore.map",
147 srcs: [
148 "compat/30.0/30.0.ignore.cil",
149 ],
150}
151
Tri Voa5cfd3e2018-03-22 11:35:02 -0700152se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700153 name: "plat_26.0.cil",
154 stem: "26.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700155 bottom_half: [":26.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700156 top_half: "plat_27.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700157}
158
159se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700160 name: "plat_27.0.cil",
161 stem: "27.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700162 bottom_half: [":27.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700163 top_half: "plat_28.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700164}
Jae Shin1fa96342018-07-11 18:30:44 +0900165
166se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700167 name: "plat_28.0.cil",
168 stem: "28.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700169 bottom_half: [":28.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700170 top_half: "plat_29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700171}
172
173se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700174 name: "plat_29.0.cil",
175 stem: "29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700176 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900177 top_half: "plat_30.0.cil",
178}
179
180se_cil_compat_map {
181 name: "plat_30.0.cil",
182 stem: "30.0.cil",
183 bottom_half: [":30.0.board.compat.map"],
184 // top_half: "plat_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700185}
186
187se_cil_compat_map {
188 name: "system_ext_26.0.cil",
189 stem: "26.0.cil",
190 bottom_half: [":26.0.board.compat.map"],
191 top_half: "system_ext_27.0.cil",
192 system_ext_specific: true,
193}
194
195se_cil_compat_map {
196 name: "system_ext_27.0.cil",
197 stem: "27.0.cil",
198 bottom_half: [":27.0.board.compat.map"],
199 top_half: "system_ext_28.0.cil",
200 system_ext_specific: true,
201}
202
203se_cil_compat_map {
204 name: "system_ext_28.0.cil",
205 stem: "28.0.cil",
206 bottom_half: [":28.0.board.compat.map"],
207 top_half: "system_ext_29.0.cil",
208 system_ext_specific: true,
209}
210
211se_cil_compat_map {
212 name: "system_ext_29.0.cil",
213 stem: "29.0.cil",
214 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900215 top_half: "system_ext_30.0.cil",
216 system_ext_specific: true,
217}
218
219se_cil_compat_map {
220 name: "system_ext_30.0.cil",
221 stem: "30.0.cil",
222 bottom_half: [":30.0.board.compat.map"],
223 // top_half: "system_ext_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700224 system_ext_specific: true,
225}
226
227se_cil_compat_map {
228 name: "product_26.0.cil",
229 stem: "26.0.cil",
230 bottom_half: [":26.0.board.compat.map"],
231 top_half: "product_27.0.cil",
232 product_specific: true,
233}
234
235se_cil_compat_map {
236 name: "product_27.0.cil",
237 stem: "27.0.cil",
238 bottom_half: [":27.0.board.compat.map"],
239 top_half: "product_28.0.cil",
240 product_specific: true,
241}
242
243se_cil_compat_map {
244 name: "product_28.0.cil",
245 stem: "28.0.cil",
246 bottom_half: [":28.0.board.compat.map"],
247 top_half: "product_29.0.cil",
248 product_specific: true,
249}
250
251se_cil_compat_map {
252 name: "product_29.0.cil",
253 stem: "29.0.cil",
254 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900255 top_half: "product_30.0.cil",
256 product_specific: true,
257}
258
259se_cil_compat_map {
260 name: "product_30.0.cil",
261 stem: "30.0.cil",
262 bottom_half: [":30.0.board.compat.map"],
263 // top_half: "product_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700264 product_specific: true,
Tri Vo438684b2018-09-29 17:47:10 -0700265}
266
267se_cil_compat_map {
268 name: "26.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800269 bottom_half: [":26.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700270 top_half: "27.0.ignore.cil",
271}
272
273se_cil_compat_map {
274 name: "27.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800275 bottom_half: [":27.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700276 top_half: "28.0.ignore.cil",
277}
278
279se_cil_compat_map {
280 name: "28.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800281 bottom_half: [":28.0.board.ignore.map"],
Tri Voe381deb2019-06-12 15:52:30 -0700282 top_half: "29.0.ignore.cil",
Jae Shin1fa96342018-07-11 18:30:44 +0900283}
Inseob Kimb554e592019-04-15 20:10:46 +0900284
Tri Vo50aa0292019-06-01 17:04:13 -0700285se_cil_compat_map {
286 name: "29.0.ignore.cil",
287 bottom_half: [":29.0.board.ignore.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900288 top_half: "30.0.ignore.cil",
289}
290
291se_cil_compat_map {
292 name: "30.0.ignore.cil",
293 bottom_half: [":30.0.board.ignore.map"],
294 // top_half: "31.0.ignore.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700295}
296
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700297prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700298 name: "26.0.compat.cil",
299 src: "private/compat/26.0/26.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700300 sub_dir: "selinux/mapping",
301}
302
303prebuilt_etc {
304 name: "27.0.compat.cil",
305 src: "private/compat/27.0/27.0.compat.cil",
306 sub_dir: "selinux/mapping",
307}
308
309prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700310 name: "28.0.compat.cil",
311 src: "private/compat/28.0/28.0.compat.cil",
312 sub_dir: "selinux/mapping",
313}
314
315prebuilt_etc {
316 name: "29.0.compat.cil",
317 src: "private/compat/29.0/29.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700318 sub_dir: "selinux/mapping",
319}
320
Inseob Kimace36ab2020-05-07 20:19:05 +0900321prebuilt_etc {
322 name: "30.0.compat.cil",
323 src: "private/compat/30.0/30.0.compat.cil",
324 sub_dir: "selinux/mapping",
325}
326
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +0800327se_compat_cil {
328 name: "system_ext_26.0.compat.cil",
329 srcs: [":26.0.board.compat.cil"],
330 stem: "26.0.compat.cil",
331 system_ext_specific: true,
332}
333
334se_compat_cil {
335 name: "system_ext_27.0.compat.cil",
336 srcs: [":27.0.board.compat.cil"],
337 stem: "27.0.compat.cil",
338 system_ext_specific: true,
339}
340
341se_compat_cil {
342 name: "system_ext_28.0.compat.cil",
343 srcs: [":28.0.board.compat.cil"],
344 stem: "28.0.compat.cil",
345 system_ext_specific: true,
346}
347
348se_compat_cil {
349 name: "system_ext_29.0.compat.cil",
350 srcs: [":29.0.board.compat.cil"],
351 stem: "29.0.compat.cil",
352 system_ext_specific: true,
353}
354
355se_compat_cil {
356 name: "system_ext_30.0.compat.cil",
357 srcs: [":30.0.board.compat.cil"],
358 stem: "30.0.compat.cil",
359 system_ext_specific: true,
360}
361
Inseob Kimb554e592019-04-15 20:10:46 +0900362se_filegroup {
363 name: "file_contexts_files",
364 srcs: ["file_contexts"],
365}
366
367se_filegroup {
368 name: "file_contexts_asan_files",
369 srcs: ["file_contexts_asan"],
370}
371
372se_filegroup {
373 name: "file_contexts_overlayfs_files",
374 srcs: ["file_contexts_overlayfs"],
375}
376
377se_filegroup {
378 name: "hwservice_contexts_files",
379 srcs: ["hwservice_contexts"],
380}
381
382se_filegroup {
383 name: "property_contexts_files",
384 srcs: ["property_contexts"],
385}
386
387se_filegroup {
388 name: "service_contexts_files",
389 srcs: ["service_contexts"],
390}
391
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700392se_filegroup {
393 name: "keystore2_key_contexts_files",
394 srcs: ["keystore2_key_contexts"],
395}
396
Inseob Kimb554e592019-04-15 20:10:46 +0900397file_contexts {
398 name: "plat_file_contexts",
399 srcs: [":file_contexts_files"],
400 product_variables: {
401 address_sanitize: {
402 srcs: [":file_contexts_asan_files"],
403 },
404 debuggable: {
405 srcs: [":file_contexts_overlayfs_files"],
406 },
407 },
408
409 flatten_apex: {
410 srcs: ["apex/*-file_contexts"],
411 },
412
413 recovery_available: true,
414}
415
416file_contexts {
417 name: "vendor_file_contexts",
418 srcs: [":file_contexts_files"],
419 soc_specific: true,
420 recovery_available: true,
421}
422
423file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800424 name: "system_ext_file_contexts",
425 srcs: [":file_contexts_files"],
426 system_ext_specific: true,
427 recovery_available: true,
428}
429
430file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900431 name: "product_file_contexts",
432 srcs: [":file_contexts_files"],
433 product_specific: true,
434 recovery_available: true,
435}
436
437file_contexts {
438 name: "odm_file_contexts",
439 srcs: [":file_contexts_files"],
440 device_specific: true,
441 recovery_available: true,
442}
443
444hwservice_contexts {
445 name: "plat_hwservice_contexts",
446 srcs: [":hwservice_contexts_files"],
447}
448
449hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800450 name: "system_ext_hwservice_contexts",
451 srcs: [":hwservice_contexts_files"],
452 system_ext_specific: true,
453}
454
455hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900456 name: "product_hwservice_contexts",
457 srcs: [":hwservice_contexts_files"],
458 product_specific: true,
459}
460
461hwservice_contexts {
462 name: "vendor_hwservice_contexts",
463 srcs: [":hwservice_contexts_files"],
464 reqd_mask: true,
465 soc_specific: true,
466}
467
468hwservice_contexts {
469 name: "odm_hwservice_contexts",
470 srcs: [":hwservice_contexts_files"],
471 device_specific: true,
472}
473
474property_contexts {
475 name: "plat_property_contexts",
476 srcs: [":property_contexts_files"],
477 recovery_available: true,
478}
479
480property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800481 name: "system_ext_property_contexts",
482 srcs: [":property_contexts_files"],
483 system_ext_specific: true,
484 recovery_available: true,
485}
486
487property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900488 name: "product_property_contexts",
489 srcs: [":property_contexts_files"],
490 product_specific: true,
491 recovery_available: true,
492}
493
494property_contexts {
495 name: "vendor_property_contexts",
496 srcs: [":property_contexts_files"],
497 reqd_mask: true,
498 soc_specific: true,
499 recovery_available: true,
500}
501
502property_contexts {
503 name: "odm_property_contexts",
504 srcs: [":property_contexts_files"],
505 device_specific: true,
506 recovery_available: true,
507}
508
509service_contexts {
510 name: "plat_service_contexts",
511 srcs: [":service_contexts_files"],
512}
513
514service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800515 name: "system_ext_service_contexts",
516 srcs: [":service_contexts_files"],
517 system_ext_specific: true,
518}
519
520service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900521 name: "product_service_contexts",
522 srcs: [":service_contexts_files"],
523 product_specific: true,
524}
525
526service_contexts {
527 name: "vendor_service_contexts",
528 srcs: [":service_contexts_files"],
529 reqd_mask: true,
530 soc_specific: true,
531}
yangbill3e345372020-04-15 13:55:47 +0800532
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700533keystore2_key_contexts {
534 name: "plat_keystore2_key_contexts",
535 srcs: [":keystore2_key_contexts_files"],
536}
537
538keystore2_key_contexts {
539 name: "system_keystore2_key_contexts",
540 srcs: [":keystore2_key_contexts_files"],
541 system_ext_specific: true,
542}
543
544keystore2_key_contexts {
545 name: "product_keystore2_key_contexts",
546 srcs: [":keystore2_key_contexts_files"],
547 product_specific: true,
548}
549
550keystore2_key_contexts {
551 name: "vendor_keystore2_key_contexts",
552 srcs: [":keystore2_key_contexts_files"],
553 reqd_mask: true,
554 soc_specific: true,
555}
556
yangbill3e345372020-04-15 13:55:47 +0800557// For vts_treble_sys_prop_test
558filegroup {
559 name: "private_property_contexts",
560 srcs: ["private/property_contexts"],
561 visibility: [
562 "//test/vts-testcase/security/system_property",
563 ],
564}
Inseob Kime35b49b2021-02-18 19:15:41 +0900565
Inseob Kima49e7242021-03-22 10:26:13 +0900566se_build_files {
567 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900568 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900569 "security_classes",
570 "initial_sids",
571 "access_vectors",
572 "global_macros",
573 "neverallow_macros",
574 "mls_macros",
575 "mls_decl",
576 "mls",
577 "policy_capabilities",
578 "te_macros",
579 "attributes",
580 "ioctl_defines",
581 "ioctl_macros",
582 "*.te",
583 "roles_decl",
584 "roles",
585 "users",
586 "initial_sid_contexts",
587 "fs_use",
588 "genfs_contexts",
589 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900590 ],
591}
592
Inseob Kima49e7242021-03-22 10:26:13 +0900593// reqd_policy_mask - a policy.conf file which contains only the bare minimum
594// policy necessary to use checkpolicy.
595//
596// This bare-minimum policy needs to be present in all policy.conf files, but
597// should not necessarily be exported as part of the public policy.
598//
599// The rules generated by reqd_policy_mask will allow the compilation of public
600// policy and subsequent removal of CIL policy that should not be exported.
601se_policy_conf {
602 name: "reqd_policy_mask.conf",
603 srcs: [":se_build_files{.reqd_mask}"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900604 installable: false,
605}
606
Inseob Kima49e7242021-03-22 10:26:13 +0900607se_policy_cil {
608 name: "reqd_policy_mask.cil",
609 src: ":reqd_policy_mask.conf",
610 secilc_check: false,
611 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900612}
613
Inseob Kima49e7242021-03-22 10:26:13 +0900614// pub_policy - policy that will be exported to be a part of non-platform
615// policy corresponding to this platform version.
616//
617// This is a limited subset of policy that would not compile in checkpolicy on
618// its own.
619//
620// To get around this limitation, add only the required files from private
621// policy, which will generate CIL policy that will then be filtered out by the
622// reqd_policy_mask.
623//
624// There are three pub_policy.cil files below:
625// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
626// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
627// - plat_pub_policy.cil: exported 'system' policy.
628//
629// Those above files will in turn be used to generate the following versioned cil files:
630// - product_mapping_file: the versioned, exported 'product' policy in product partition.
631// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
632// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
633// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
634// in vendor partition.
635//
636se_policy_conf {
637 name: "pub_policy.conf",
638 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
639 installable: false,
640}
641
642se_policy_cil {
643 name: "pub_policy.cil",
644 src: ":pub_policy.conf",
645 filter_out: [":reqd_policy_mask.cil"],
646 secilc_check: false,
647 installable: false,
648}
649
650se_policy_conf {
651 name: "system_ext_pub_policy.conf",
652 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
653 installable: false,
654}
655
656se_policy_cil {
657 name: "system_ext_pub_policy.cil",
658 src: ":system_ext_pub_policy.conf",
659 filter_out: [":reqd_policy_mask.cil"],
660 secilc_check: false,
661 installable: false,
662}
663
664se_policy_conf {
665 name: "plat_pub_policy.conf",
666 srcs: [":se_build_files{.plat_public}"],
667 installable: false,
668}
669
670se_policy_cil {
671 name: "plat_pub_policy.cil",
672 src: ":plat_pub_policy.conf",
673 filter_out: [":reqd_policy_mask.cil"],
674 secilc_check: false,
675 installable: false,
676}
677
678// plat_policy.conf - A combination of the private and public platform policy
679// which will ship with the device.
680//
681// The platform will always reflect the most recent platform version and is not
682// currently being attributized.
683se_policy_conf {
684 name: "plat_sepolicy.conf",
685 srcs: [":se_build_files{.plat}"],
686 installable: false,
687}
688
689se_policy_cil {
690 name: "plat_sepolicy.cil",
691 src: ":plat_sepolicy.conf",
692 additional_cil_files: ["private/technical_debt.cil"],
693}
694
695// system_ext_policy.conf - A combination of the private and public system_ext
696// policy which will ship with the device. System_ext policy is not attributized
697se_policy_conf {
698 name: "system_ext_sepolicy.conf",
699 srcs: [":se_build_files{.system_ext}"],
700 installable: false,
701}
702
703se_policy_cil {
704 name: "system_ext_sepolicy.cil",
705 src: ":system_ext_sepolicy.conf",
706 system_ext_specific: true,
707 filter_out: [":plat_sepolicy.cil"],
708 remove_line_marker: true,
709}
710
711// product_policy.conf - A combination of the private and public product policy
712// which will ship with the device. Product policy is not attributized
713se_policy_conf {
714 name: "product_sepolicy.conf",
715 srcs: [":se_build_files{.product}"],
716 installable: false,
717}
718
719se_policy_cil {
720 name: "product_sepolicy.cil",
721 src: ":product_sepolicy.conf",
722 product_specific: true,
723 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
724 remove_line_marker: true,
725}
726
Inseob Kim039175b2021-03-25 15:37:34 +0900727// policy mapping files
728// auto-generate the mapping file for current platform policy, since it needs to
729// track platform policy development
730se_versioned_policy {
731 name: "plat_mapping_file",
732 base: ":plat_pub_policy.cil",
733 mapping: true,
734 version: "current",
735 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
736}
737
738se_versioned_policy {
739 name: "system_ext_mapping_file",
740 base: ":system_ext_pub_policy.cil",
741 mapping: true,
742 version: "current",
743 filter_out: [":plat_mapping_file"],
744 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
745 system_ext_specific: true,
746}
747
748se_versioned_policy {
749 name: "product_mapping_file",
750 base: ":pub_policy.cil",
751 mapping: true,
752 version: "current",
753 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
754 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
755 product_specific: true,
756}
757
758// plat_pub_versioned.cil - the exported platform policy associated with the version
759// that non-platform policy targets.
760se_versioned_policy {
761 name: "plat_pub_versioned.cil",
762 base: ":pub_policy.cil",
763 target_policy: ":pub_policy.cil",
764 version: "current",
765 dependent_cils: [
766 ":plat_sepolicy.cil",
767 ":system_ext_sepolicy.cil",
768 ":product_sepolicy.cil",
769 ":plat_mapping_file",
770 ":system_ext_mapping_file",
771 ":product_mapping_file",
772 ],
773 vendor: true,
774}
775
776//////////////////////////////////
777// Precompiled sepolicy is loaded if and only if:
778// - plat_sepolicy_and_mapping.sha256 equals
779// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
780// AND
781// - system_ext_sepolicy_and_mapping.sha256 equals
782// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
783// AND
784// - product_sepolicy_and_mapping.sha256 equals
785// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
786// See system/core/init/selinux.cpp for details.
787//////////////////////////////////
788genrule {
789 name: "plat_sepolicy_and_mapping.sha256_gen",
790 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
791 out: ["plat_sepolicy_and_mapping.sha256"],
792 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
793}
794
795prebuilt_etc {
796 name: "plat_sepolicy_and_mapping.sha256",
797 filename: "plat_sepolicy_and_mapping.sha256",
798 src: ":plat_sepolicy_and_mapping.sha256_gen",
799 relative_install_path: "selinux",
800}
801
802genrule {
803 name: "system_ext_sepolicy_and_mapping.sha256_gen",
804 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
805 out: ["system_ext_sepolicy_and_mapping.sha256"],
806 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
807}
808
809prebuilt_etc {
810 name: "system_ext_sepolicy_and_mapping.sha256",
811 filename: "system_ext_sepolicy_and_mapping.sha256",
812 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
813 relative_install_path: "selinux",
814 system_ext_specific: true,
815}
816
817genrule {
818 name: "product_sepolicy_and_mapping.sha256_gen",
819 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
820 out: ["product_sepolicy_and_mapping.sha256"],
821 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
822}
823
824prebuilt_etc {
825 name: "product_sepolicy_and_mapping.sha256",
826 filename: "product_sepolicy_and_mapping.sha256",
827 src: ":product_sepolicy_and_mapping.sha256_gen",
828 relative_install_path: "selinux",
829 product_specific: true,
830}
831
Inseob Kima49e7242021-03-22 10:26:13 +0900832//////////////////////////////////
833// SELinux policy embedded into CTS.
834// CTS checks neverallow rules of this policy against the policy of the device under test.
835//////////////////////////////////
836se_policy_conf {
837 name: "general_sepolicy.conf",
838 srcs: [":se_build_files{.plat}"],
839 build_variant: "user",
840 cts: true,
841 exclude_build_test: true,
842}
843
844//////////////////////////////////
845// modules for microdroid
Inseob Kima49e7242021-03-22 10:26:13 +0900846//////////////////////////////////
Inseob Kime35b49b2021-02-18 19:15:41 +0900847
Inseob Kim50375ce2021-03-25 15:41:06 +0900848// microdroid's system sepolicy is almost identical to host's system sepolicy, except that
849// microdroid doesn't have system_ext and product. So microdroid's plat_pub_versioned.cil is
850// generated with plat_pub_policy.cil (exported system), not pub_policy.cil (exported system +
851// system_ext + product). Other two files, plat_sepolicy.cil and plat_mapping_file, are copied from
852// host's files.
853se_versioned_policy {
Inseob Kima49e7242021-03-22 10:26:13 +0900854 name: "microdroid_plat_pub_versioned.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900855 stem: "plat_pub_versioned.cil",
856 base: ":plat_pub_policy.cil",
857 target_policy: ":plat_pub_policy.cil",
858 version: "current",
859 dependent_cils: [
860 ":plat_sepolicy.cil",
861 ":plat_mapping_file",
862 ],
Inseob Kima49e7242021-03-22 10:26:13 +0900863 installable: false,
864}
865
Inseob Kim50375ce2021-03-25 15:41:06 +0900866// microdroid's vendor sepolicy is a minimalized sepolicy needed for microdroid to boot. It just
867// contains system/sepolicy/public and system/sepolicy/vendor.
Inseob Kim50375ce2021-03-25 15:41:06 +0900868se_policy_conf {
869 name: "microdroid_vendor_sepolicy.conf",
Inseob Kim39fbcf72021-04-05 17:52:51 +0900870 srcs: [":se_build_files{.plat_vendor}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900871 installable: false,
872}
873
Inseob Kim50375ce2021-03-25 15:41:06 +0900874se_policy_cil {
875 name: "microdroid_vendor_sepolicy.cil.raw",
876 src: ":microdroid_vendor_sepolicy.conf",
877 filter_out: [":reqd_policy_mask.cil"],
878 secilc_check: false, // will be done in se_versioned_policy module
879 installable: false,
Jiyong Parkd89564e2021-03-03 14:56:43 +0000880}
881
Inseob Kim50375ce2021-03-25 15:41:06 +0900882se_versioned_policy {
Jiyong Parkd89564e2021-03-03 14:56:43 +0000883 name: "microdroid_vendor_sepolicy.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900884 stem: "vendor_sepolicy.cil",
885 base: ":plat_pub_policy.cil",
886 target_policy: ":microdroid_vendor_sepolicy.cil.raw",
887 version: "current", // microdroid is bundled to system
888 dependent_cils: [
889 ":plat_sepolicy.cil",
890 ":microdroid_plat_pub_versioned.cil",
891 ":plat_mapping_file",
892 ],
893 filter_out: [":microdroid_plat_pub_versioned.cil"],
Jiyong Parkd89564e2021-03-03 14:56:43 +0000894 installable: false,
895}