blob: 391411b1b6108fa0051c42106806ff18855b410e [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
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800297se_compat_cil {
Tri Vo50aa0292019-06-01 17:04:13 -0700298 name: "26.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800299 srcs: [":26.0.board.compat.cil"],
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700300}
301
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800302se_compat_cil {
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700303 name: "27.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800304 srcs: [":27.0.board.compat.cil"],
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700305}
306
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800307se_compat_cil {
Tri Vo50aa0292019-06-01 17:04:13 -0700308 name: "28.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800309 srcs: [":28.0.board.compat.cil"],
Tri Vo50aa0292019-06-01 17:04:13 -0700310}
311
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800312se_compat_cil {
Tri Vo50aa0292019-06-01 17:04:13 -0700313 name: "29.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800314 srcs: [":29.0.board.compat.cil"],
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700315}
316
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800317se_compat_cil {
Inseob Kimace36ab2020-05-07 20:19:05 +0900318 name: "30.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800319 srcs: [":30.0.board.compat.cil"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900320}
321
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +0800322se_compat_cil {
323 name: "system_ext_26.0.compat.cil",
324 srcs: [":26.0.board.compat.cil"],
325 stem: "26.0.compat.cil",
326 system_ext_specific: true,
327}
328
329se_compat_cil {
330 name: "system_ext_27.0.compat.cil",
331 srcs: [":27.0.board.compat.cil"],
332 stem: "27.0.compat.cil",
333 system_ext_specific: true,
334}
335
336se_compat_cil {
337 name: "system_ext_28.0.compat.cil",
338 srcs: [":28.0.board.compat.cil"],
339 stem: "28.0.compat.cil",
340 system_ext_specific: true,
341}
342
343se_compat_cil {
344 name: "system_ext_29.0.compat.cil",
345 srcs: [":29.0.board.compat.cil"],
346 stem: "29.0.compat.cil",
347 system_ext_specific: true,
348}
349
350se_compat_cil {
351 name: "system_ext_30.0.compat.cil",
352 srcs: [":30.0.board.compat.cil"],
353 stem: "30.0.compat.cil",
354 system_ext_specific: true,
355}
356
Inseob Kimb554e592019-04-15 20:10:46 +0900357se_filegroup {
358 name: "file_contexts_files",
359 srcs: ["file_contexts"],
360}
361
362se_filegroup {
363 name: "file_contexts_asan_files",
364 srcs: ["file_contexts_asan"],
365}
366
367se_filegroup {
368 name: "file_contexts_overlayfs_files",
369 srcs: ["file_contexts_overlayfs"],
370}
371
372se_filegroup {
373 name: "hwservice_contexts_files",
374 srcs: ["hwservice_contexts"],
375}
376
377se_filegroup {
378 name: "property_contexts_files",
379 srcs: ["property_contexts"],
380}
381
382se_filegroup {
383 name: "service_contexts_files",
384 srcs: ["service_contexts"],
385}
386
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700387se_filegroup {
388 name: "keystore2_key_contexts_files",
389 srcs: ["keystore2_key_contexts"],
390}
391
Inseob Kimb554e592019-04-15 20:10:46 +0900392file_contexts {
393 name: "plat_file_contexts",
394 srcs: [":file_contexts_files"],
395 product_variables: {
396 address_sanitize: {
397 srcs: [":file_contexts_asan_files"],
398 },
399 debuggable: {
400 srcs: [":file_contexts_overlayfs_files"],
401 },
402 },
403
404 flatten_apex: {
405 srcs: ["apex/*-file_contexts"],
406 },
407
408 recovery_available: true,
409}
410
411file_contexts {
412 name: "vendor_file_contexts",
413 srcs: [":file_contexts_files"],
414 soc_specific: true,
415 recovery_available: true,
416}
417
418file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800419 name: "system_ext_file_contexts",
420 srcs: [":file_contexts_files"],
421 system_ext_specific: true,
422 recovery_available: true,
423}
424
425file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900426 name: "product_file_contexts",
427 srcs: [":file_contexts_files"],
428 product_specific: true,
429 recovery_available: true,
430}
431
432file_contexts {
433 name: "odm_file_contexts",
434 srcs: [":file_contexts_files"],
435 device_specific: true,
436 recovery_available: true,
437}
438
439hwservice_contexts {
440 name: "plat_hwservice_contexts",
441 srcs: [":hwservice_contexts_files"],
442}
443
444hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800445 name: "system_ext_hwservice_contexts",
446 srcs: [":hwservice_contexts_files"],
447 system_ext_specific: true,
448}
449
450hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900451 name: "product_hwservice_contexts",
452 srcs: [":hwservice_contexts_files"],
453 product_specific: true,
454}
455
456hwservice_contexts {
457 name: "vendor_hwservice_contexts",
458 srcs: [":hwservice_contexts_files"],
459 reqd_mask: true,
460 soc_specific: true,
461}
462
463hwservice_contexts {
464 name: "odm_hwservice_contexts",
465 srcs: [":hwservice_contexts_files"],
466 device_specific: true,
467}
468
469property_contexts {
470 name: "plat_property_contexts",
471 srcs: [":property_contexts_files"],
472 recovery_available: true,
473}
474
475property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800476 name: "system_ext_property_contexts",
477 srcs: [":property_contexts_files"],
478 system_ext_specific: true,
479 recovery_available: true,
480}
481
482property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900483 name: "product_property_contexts",
484 srcs: [":property_contexts_files"],
485 product_specific: true,
486 recovery_available: true,
487}
488
489property_contexts {
490 name: "vendor_property_contexts",
491 srcs: [":property_contexts_files"],
492 reqd_mask: true,
493 soc_specific: true,
494 recovery_available: true,
495}
496
497property_contexts {
498 name: "odm_property_contexts",
499 srcs: [":property_contexts_files"],
500 device_specific: true,
501 recovery_available: true,
502}
503
504service_contexts {
505 name: "plat_service_contexts",
506 srcs: [":service_contexts_files"],
507}
508
509service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800510 name: "system_ext_service_contexts",
511 srcs: [":service_contexts_files"],
512 system_ext_specific: true,
513}
514
515service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900516 name: "product_service_contexts",
517 srcs: [":service_contexts_files"],
518 product_specific: true,
519}
520
521service_contexts {
522 name: "vendor_service_contexts",
523 srcs: [":service_contexts_files"],
524 reqd_mask: true,
525 soc_specific: true,
526}
yangbill3e345372020-04-15 13:55:47 +0800527
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700528keystore2_key_contexts {
529 name: "plat_keystore2_key_contexts",
530 srcs: [":keystore2_key_contexts_files"],
531}
532
533keystore2_key_contexts {
534 name: "system_keystore2_key_contexts",
535 srcs: [":keystore2_key_contexts_files"],
536 system_ext_specific: true,
537}
538
539keystore2_key_contexts {
540 name: "product_keystore2_key_contexts",
541 srcs: [":keystore2_key_contexts_files"],
542 product_specific: true,
543}
544
545keystore2_key_contexts {
546 name: "vendor_keystore2_key_contexts",
547 srcs: [":keystore2_key_contexts_files"],
548 reqd_mask: true,
549 soc_specific: true,
550}
551
yangbill3e345372020-04-15 13:55:47 +0800552// For vts_treble_sys_prop_test
553filegroup {
554 name: "private_property_contexts",
555 srcs: ["private/property_contexts"],
556 visibility: [
557 "//test/vts-testcase/security/system_property",
558 ],
559}
Inseob Kime35b49b2021-02-18 19:15:41 +0900560
Inseob Kima49e7242021-03-22 10:26:13 +0900561se_build_files {
562 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900563 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900564 "security_classes",
565 "initial_sids",
566 "access_vectors",
567 "global_macros",
568 "neverallow_macros",
569 "mls_macros",
570 "mls_decl",
571 "mls",
572 "policy_capabilities",
573 "te_macros",
574 "attributes",
575 "ioctl_defines",
576 "ioctl_macros",
577 "*.te",
578 "roles_decl",
579 "roles",
580 "users",
581 "initial_sid_contexts",
582 "fs_use",
583 "genfs_contexts",
584 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900585 ],
586}
587
Inseob Kima49e7242021-03-22 10:26:13 +0900588// reqd_policy_mask - a policy.conf file which contains only the bare minimum
589// policy necessary to use checkpolicy.
590//
591// This bare-minimum policy needs to be present in all policy.conf files, but
592// should not necessarily be exported as part of the public policy.
593//
594// The rules generated by reqd_policy_mask will allow the compilation of public
595// policy and subsequent removal of CIL policy that should not be exported.
596se_policy_conf {
597 name: "reqd_policy_mask.conf",
598 srcs: [":se_build_files{.reqd_mask}"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900599 installable: false,
600}
601
Inseob Kima49e7242021-03-22 10:26:13 +0900602se_policy_cil {
603 name: "reqd_policy_mask.cil",
604 src: ":reqd_policy_mask.conf",
605 secilc_check: false,
606 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900607}
608
Inseob Kima49e7242021-03-22 10:26:13 +0900609// pub_policy - policy that will be exported to be a part of non-platform
610// policy corresponding to this platform version.
611//
612// This is a limited subset of policy that would not compile in checkpolicy on
613// its own.
614//
615// To get around this limitation, add only the required files from private
616// policy, which will generate CIL policy that will then be filtered out by the
617// reqd_policy_mask.
618//
619// There are three pub_policy.cil files below:
620// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
621// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
622// - plat_pub_policy.cil: exported 'system' policy.
623//
624// Those above files will in turn be used to generate the following versioned cil files:
625// - product_mapping_file: the versioned, exported 'product' policy in product partition.
626// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
627// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
628// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
629// in vendor partition.
630//
631se_policy_conf {
632 name: "pub_policy.conf",
633 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
634 installable: false,
635}
636
637se_policy_cil {
638 name: "pub_policy.cil",
639 src: ":pub_policy.conf",
640 filter_out: [":reqd_policy_mask.cil"],
641 secilc_check: false,
642 installable: false,
643}
644
645se_policy_conf {
646 name: "system_ext_pub_policy.conf",
647 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
648 installable: false,
649}
650
651se_policy_cil {
652 name: "system_ext_pub_policy.cil",
653 src: ":system_ext_pub_policy.conf",
654 filter_out: [":reqd_policy_mask.cil"],
655 secilc_check: false,
656 installable: false,
657}
658
659se_policy_conf {
660 name: "plat_pub_policy.conf",
661 srcs: [":se_build_files{.plat_public}"],
662 installable: false,
663}
664
665se_policy_cil {
666 name: "plat_pub_policy.cil",
667 src: ":plat_pub_policy.conf",
668 filter_out: [":reqd_policy_mask.cil"],
669 secilc_check: false,
670 installable: false,
671}
672
673// plat_policy.conf - A combination of the private and public platform policy
674// which will ship with the device.
675//
676// The platform will always reflect the most recent platform version and is not
677// currently being attributized.
678se_policy_conf {
679 name: "plat_sepolicy.conf",
680 srcs: [":se_build_files{.plat}"],
681 installable: false,
682}
683
684se_policy_cil {
685 name: "plat_sepolicy.cil",
686 src: ":plat_sepolicy.conf",
687 additional_cil_files: ["private/technical_debt.cil"],
688}
689
Florian Mayere10ceab2021-04-22 16:38:47 +0000690// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
691se_policy_conf {
692 name: "userdebug_plat_sepolicy.conf",
693 srcs: [":se_build_files{.plat}"],
694 build_variant: "userdebug",
695 installable: false,
696}
697
698se_policy_cil {
699 name: "userdebug_plat_sepolicy.cil",
700 src: ":userdebug_plat_sepolicy.conf",
701 additional_cil_files: ["private/technical_debt.cil"],
702 debug_ramdisk: true,
703}
704
Inseob Kima49e7242021-03-22 10:26:13 +0900705// system_ext_policy.conf - A combination of the private and public system_ext
706// policy which will ship with the device. System_ext policy is not attributized
707se_policy_conf {
708 name: "system_ext_sepolicy.conf",
709 srcs: [":se_build_files{.system_ext}"],
710 installable: false,
711}
712
713se_policy_cil {
714 name: "system_ext_sepolicy.cil",
715 src: ":system_ext_sepolicy.conf",
716 system_ext_specific: true,
717 filter_out: [":plat_sepolicy.cil"],
718 remove_line_marker: true,
719}
720
721// product_policy.conf - A combination of the private and public product policy
722// which will ship with the device. Product policy is not attributized
723se_policy_conf {
724 name: "product_sepolicy.conf",
725 srcs: [":se_build_files{.product}"],
726 installable: false,
727}
728
729se_policy_cil {
730 name: "product_sepolicy.cil",
731 src: ":product_sepolicy.conf",
732 product_specific: true,
733 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
734 remove_line_marker: true,
735}
736
Inseob Kim039175b2021-03-25 15:37:34 +0900737// policy mapping files
738// auto-generate the mapping file for current platform policy, since it needs to
739// track platform policy development
740se_versioned_policy {
741 name: "plat_mapping_file",
742 base: ":plat_pub_policy.cil",
743 mapping: true,
744 version: "current",
745 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
746}
747
748se_versioned_policy {
749 name: "system_ext_mapping_file",
750 base: ":system_ext_pub_policy.cil",
751 mapping: true,
752 version: "current",
753 filter_out: [":plat_mapping_file"],
754 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
755 system_ext_specific: true,
756}
757
758se_versioned_policy {
759 name: "product_mapping_file",
760 base: ":pub_policy.cil",
761 mapping: true,
762 version: "current",
763 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
764 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
765 product_specific: true,
766}
767
768// plat_pub_versioned.cil - the exported platform policy associated with the version
769// that non-platform policy targets.
770se_versioned_policy {
771 name: "plat_pub_versioned.cil",
772 base: ":pub_policy.cil",
773 target_policy: ":pub_policy.cil",
774 version: "current",
775 dependent_cils: [
776 ":plat_sepolicy.cil",
777 ":system_ext_sepolicy.cil",
778 ":product_sepolicy.cil",
779 ":plat_mapping_file",
780 ":system_ext_mapping_file",
781 ":product_mapping_file",
782 ],
783 vendor: true,
784}
785
786//////////////////////////////////
787// Precompiled sepolicy is loaded if and only if:
788// - plat_sepolicy_and_mapping.sha256 equals
789// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
790// AND
791// - system_ext_sepolicy_and_mapping.sha256 equals
792// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
793// AND
794// - product_sepolicy_and_mapping.sha256 equals
795// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
796// See system/core/init/selinux.cpp for details.
797//////////////////////////////////
798genrule {
799 name: "plat_sepolicy_and_mapping.sha256_gen",
800 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
801 out: ["plat_sepolicy_and_mapping.sha256"],
802 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
803}
804
805prebuilt_etc {
806 name: "plat_sepolicy_and_mapping.sha256",
807 filename: "plat_sepolicy_and_mapping.sha256",
808 src: ":plat_sepolicy_and_mapping.sha256_gen",
809 relative_install_path: "selinux",
810}
811
812genrule {
813 name: "system_ext_sepolicy_and_mapping.sha256_gen",
814 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
815 out: ["system_ext_sepolicy_and_mapping.sha256"],
816 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
817}
818
819prebuilt_etc {
820 name: "system_ext_sepolicy_and_mapping.sha256",
821 filename: "system_ext_sepolicy_and_mapping.sha256",
822 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
823 relative_install_path: "selinux",
824 system_ext_specific: true,
825}
826
827genrule {
828 name: "product_sepolicy_and_mapping.sha256_gen",
829 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
830 out: ["product_sepolicy_and_mapping.sha256"],
831 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
832}
833
834prebuilt_etc {
835 name: "product_sepolicy_and_mapping.sha256",
836 filename: "product_sepolicy_and_mapping.sha256",
837 src: ":product_sepolicy_and_mapping.sha256_gen",
838 relative_install_path: "selinux",
839 product_specific: true,
840}
841
Inseob Kima49e7242021-03-22 10:26:13 +0900842//////////////////////////////////
843// SELinux policy embedded into CTS.
844// CTS checks neverallow rules of this policy against the policy of the device under test.
845//////////////////////////////////
846se_policy_conf {
847 name: "general_sepolicy.conf",
848 srcs: [":se_build_files{.plat}"],
849 build_variant: "user",
850 cts: true,
851 exclude_build_test: true,
852}
853
854//////////////////////////////////
855// modules for microdroid
Inseob Kima49e7242021-03-22 10:26:13 +0900856//////////////////////////////////
Inseob Kime35b49b2021-02-18 19:15:41 +0900857
Inseob Kim50375ce2021-03-25 15:41:06 +0900858// microdroid's system sepolicy is almost identical to host's system sepolicy, except that
859// microdroid doesn't have system_ext and product. So microdroid's plat_pub_versioned.cil is
860// generated with plat_pub_policy.cil (exported system), not pub_policy.cil (exported system +
861// system_ext + product). Other two files, plat_sepolicy.cil and plat_mapping_file, are copied from
862// host's files.
863se_versioned_policy {
Inseob Kima49e7242021-03-22 10:26:13 +0900864 name: "microdroid_plat_pub_versioned.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900865 stem: "plat_pub_versioned.cil",
866 base: ":plat_pub_policy.cil",
867 target_policy: ":plat_pub_policy.cil",
868 version: "current",
869 dependent_cils: [
870 ":plat_sepolicy.cil",
871 ":plat_mapping_file",
872 ],
Inseob Kima49e7242021-03-22 10:26:13 +0900873 installable: false,
874}
875
Inseob Kim50375ce2021-03-25 15:41:06 +0900876// microdroid's vendor sepolicy is a minimalized sepolicy needed for microdroid to boot. It just
877// contains system/sepolicy/public and system/sepolicy/vendor.
Inseob Kim50375ce2021-03-25 15:41:06 +0900878se_policy_conf {
879 name: "microdroid_vendor_sepolicy.conf",
Inseob Kim39fbcf72021-04-05 17:52:51 +0900880 srcs: [":se_build_files{.plat_vendor}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900881 installable: false,
882}
883
Inseob Kim50375ce2021-03-25 15:41:06 +0900884se_policy_cil {
885 name: "microdroid_vendor_sepolicy.cil.raw",
886 src: ":microdroid_vendor_sepolicy.conf",
887 filter_out: [":reqd_policy_mask.cil"],
888 secilc_check: false, // will be done in se_versioned_policy module
889 installable: false,
Jiyong Parkd89564e2021-03-03 14:56:43 +0000890}
891
Inseob Kim50375ce2021-03-25 15:41:06 +0900892se_versioned_policy {
Jiyong Parkd89564e2021-03-03 14:56:43 +0000893 name: "microdroid_vendor_sepolicy.cil",
Inseob Kim50375ce2021-03-25 15:41:06 +0900894 stem: "vendor_sepolicy.cil",
895 base: ":plat_pub_policy.cil",
896 target_policy: ":microdroid_vendor_sepolicy.cil.raw",
897 version: "current", // microdroid is bundled to system
898 dependent_cils: [
899 ":plat_sepolicy.cil",
900 ":microdroid_plat_pub_versioned.cil",
901 ":plat_mapping_file",
902 ],
903 filter_out: [":microdroid_plat_pub_versioned.cil"],
Jiyong Parkd89564e2021-03-03 14:56:43 +0000904 installable: false,
905}