blob: 6b4e3e05ccb24654061cc6e3d1d6fc99ea69a8da [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 {
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
Jinguang Donge0125692019-03-05 17:20:54 +080054se_filegroup {
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
61se_filegroup {
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
68se_filegroup {
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
75se_filegroup {
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
82se_filegroup {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +080083 name: "28.0.board.compat.cil",
84 srcs: [
85 "compat/28.0/28.0.compat.cil",
86 ],
87}
88
89se_filegroup {
90 name: "29.0.board.compat.cil",
91 srcs: [
92 "compat/29.0/29.0.compat.cil",
93 ],
94}
95
96se_filegroup {
97 name: "30.0.board.compat.cil",
98 srcs: [
99 "compat/30.0/30.0.compat.cil",
100 ],
101}
102
103se_filegroup {
Inseob Kim4f20ff72021-06-15 21:05:39 +0900104 name: "31.0.board.compat.cil",
105 srcs: [
106 "compat/31.0/31.0.compat.cil",
107 ],
108}
109
110se_filegroup {
Inseob Kimbee558e2021-11-30 14:58:10 +0900111 name: "32.0.board.compat.cil",
112 srcs: [
113 "compat/32.0/32.0.compat.cil",
114 ],
115}
116
117se_filegroup {
Jinguang Donge0125692019-03-05 17:20:54 +0800118 name: "28.0.board.ignore.map",
119 srcs: [
120 "compat/28.0/28.0.ignore.cil",
121 ],
122}
123
Tri Vo50aa0292019-06-01 17:04:13 -0700124se_filegroup {
125 name: "29.0.board.ignore.map",
126 srcs: [
127 "compat/29.0/29.0.ignore.cil",
128 ],
129}
130
Inseob Kimace36ab2020-05-07 20:19:05 +0900131se_filegroup {
132 name: "30.0.board.ignore.map",
133 srcs: [
134 "compat/30.0/30.0.ignore.cil",
135 ],
136}
137
Inseob Kim4f20ff72021-06-15 21:05:39 +0900138se_filegroup {
139 name: "31.0.board.ignore.map",
140 srcs: [
141 "compat/31.0/31.0.ignore.cil",
142 ],
143}
144
Inseob Kimbee558e2021-11-30 14:58:10 +0900145se_filegroup {
146 name: "32.0.board.ignore.map",
147 srcs: [
148 "compat/32.0/32.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_28.0.cil",
154 stem: "28.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700155 bottom_half: [":28.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700156 top_half: "plat_29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700157}
158
159se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700160 name: "plat_29.0.cil",
161 stem: "29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700162 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900163 top_half: "plat_30.0.cil",
164}
165
166se_cil_compat_map {
167 name: "plat_30.0.cil",
168 stem: "30.0.cil",
169 bottom_half: [":30.0.board.compat.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900170 top_half: "plat_31.0.cil",
171}
172
173se_cil_compat_map {
174 name: "plat_31.0.cil",
175 stem: "31.0.cil",
176 bottom_half: [":31.0.board.compat.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900177 top_half: "plat_32.0.cil",
178}
179
180se_cil_compat_map {
181 name: "plat_32.0.cil",
182 stem: "32.0.cil",
183 bottom_half: [":32.0.board.compat.map"],
184 // top_half: "plat_33.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700185}
186
187se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700188 name: "system_ext_28.0.cil",
189 stem: "28.0.cil",
190 bottom_half: [":28.0.board.compat.map"],
191 top_half: "system_ext_29.0.cil",
192 system_ext_specific: true,
193}
194
195se_cil_compat_map {
196 name: "system_ext_29.0.cil",
197 stem: "29.0.cil",
198 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900199 top_half: "system_ext_30.0.cil",
200 system_ext_specific: true,
201}
202
203se_cil_compat_map {
204 name: "system_ext_30.0.cil",
205 stem: "30.0.cil",
206 bottom_half: [":30.0.board.compat.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900207 top_half: "system_ext_31.0.cil",
208 system_ext_specific: true,
209}
210
211se_cil_compat_map {
212 name: "system_ext_31.0.cil",
213 stem: "31.0.cil",
214 bottom_half: [":31.0.board.compat.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900215 top_half: "system_ext_32.0.cil",
216 system_ext_specific: true,
217}
218
219se_cil_compat_map {
220 name: "system_ext_32.0.cil",
221 stem: "32.0.cil",
222 bottom_half: [":32.0.board.compat.map"],
223 // top_half: "system_ext_33.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700224 system_ext_specific: true,
225}
226
227se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700228 name: "product_28.0.cil",
229 stem: "28.0.cil",
230 bottom_half: [":28.0.board.compat.map"],
231 top_half: "product_29.0.cil",
232 product_specific: true,
233}
234
235se_cil_compat_map {
236 name: "product_29.0.cil",
237 stem: "29.0.cil",
238 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900239 top_half: "product_30.0.cil",
240 product_specific: true,
241}
242
243se_cil_compat_map {
244 name: "product_30.0.cil",
245 stem: "30.0.cil",
246 bottom_half: [":30.0.board.compat.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900247 top_half: "product_31.0.cil",
248 product_specific: true,
249}
250
251se_cil_compat_map {
252 name: "product_31.0.cil",
253 stem: "31.0.cil",
254 bottom_half: [":31.0.board.compat.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900255 top_half: "product_32.0.cil",
256 product_specific: true,
257}
258
259se_cil_compat_map {
260 name: "product_32.0.cil",
261 stem: "32.0.cil",
262 bottom_half: [":32.0.board.compat.map"],
263 // top_half: "product_33.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 {
Tri Vo438684b2018-09-29 17:47:10 -0700268 name: "28.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800269 bottom_half: [":28.0.board.ignore.map"],
Tri Voe381deb2019-06-12 15:52:30 -0700270 top_half: "29.0.ignore.cil",
Jae Shin1fa96342018-07-11 18:30:44 +0900271}
Inseob Kimb554e592019-04-15 20:10:46 +0900272
Tri Vo50aa0292019-06-01 17:04:13 -0700273se_cil_compat_map {
274 name: "29.0.ignore.cil",
275 bottom_half: [":29.0.board.ignore.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900276 top_half: "30.0.ignore.cil",
277}
278
279se_cil_compat_map {
280 name: "30.0.ignore.cil",
281 bottom_half: [":30.0.board.ignore.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900282 top_half: "31.0.ignore.cil",
283}
284
285se_cil_compat_map {
286 name: "31.0.ignore.cil",
287 bottom_half: [":31.0.board.ignore.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900288 top_half: "32.0.ignore.cil",
289}
290
291se_cil_compat_map {
292 name: "32.0.ignore.cil",
293 bottom_half: [":32.0.board.ignore.map"],
294 // top_half: "33.0.ignore.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700295}
296
P.Adarsh Reddy07dd59f2021-03-22 15:55:09 +0530297se_cil_compat_map {
298 name: "system_ext_30.0.ignore.cil",
299 bottom_half: [":30.0.board.ignore.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900300 top_half: "system_ext_31.0.ignore.cil",
301 system_ext_specific: true,
302}
303
304se_cil_compat_map {
305 name: "system_ext_31.0.ignore.cil",
306 bottom_half: [":31.0.board.ignore.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900307 top_half: "system_ext_32.0.ignore.cil",
308 system_ext_specific: true,
309}
310
311se_cil_compat_map {
312 name: "system_ext_32.0.ignore.cil",
313 bottom_half: [":32.0.board.ignore.map"],
314 // top_half: "system_ext_33.0.ignore.cil",
P.Adarsh Reddy07dd59f2021-03-22 15:55:09 +0530315 system_ext_specific: true,
316}
317
318se_cil_compat_map {
319 name: "product_30.0.ignore.cil",
320 bottom_half: [":30.0.board.ignore.map"],
Inseob Kim4f20ff72021-06-15 21:05:39 +0900321 top_half: "product_31.0.ignore.cil",
322 product_specific: true,
323}
324
325se_cil_compat_map {
326 name: "product_31.0.ignore.cil",
327 bottom_half: [":31.0.board.ignore.map"],
Inseob Kimbee558e2021-11-30 14:58:10 +0900328 top_half: "product_32.0.ignore.cil",
329 product_specific: true,
330}
331
332se_cil_compat_map {
333 name: "product_32.0.ignore.cil",
334 bottom_half: [":32.0.board.ignore.map"],
335 // top_half: "product_33.0.ignore.cil",
P.Adarsh Reddy07dd59f2021-03-22 15:55:09 +0530336 product_specific: true,
337}
338
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800339se_compat_cil {
Tri Vo50aa0292019-06-01 17:04:13 -0700340 name: "28.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800341 srcs: [":28.0.board.compat.cil"],
Tri Vo50aa0292019-06-01 17:04:13 -0700342}
343
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800344se_compat_cil {
Tri Vo50aa0292019-06-01 17:04:13 -0700345 name: "29.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800346 srcs: [":29.0.board.compat.cil"],
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700347}
348
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800349se_compat_cil {
Inseob Kimace36ab2020-05-07 20:19:05 +0900350 name: "30.0.compat.cil",
Yi-Yo Chianga2251122021-04-13 02:51:48 +0800351 srcs: [":30.0.board.compat.cil"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900352}
353
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +0800354se_compat_cil {
Inseob Kim4f20ff72021-06-15 21:05:39 +0900355 name: "31.0.compat.cil",
356 srcs: [":31.0.board.compat.cil"],
357}
358
359se_compat_cil {
Inseob Kimbee558e2021-11-30 14:58:10 +0900360 name: "32.0.compat.cil",
361 srcs: [":32.0.board.compat.cil"],
362}
363
364se_compat_cil {
Yi-Yo Chiang8be93c02021-04-13 02:49:29 +0800365 name: "system_ext_28.0.compat.cil",
366 srcs: [":28.0.board.compat.cil"],
367 stem: "28.0.compat.cil",
368 system_ext_specific: true,
369}
370
371se_compat_cil {
372 name: "system_ext_29.0.compat.cil",
373 srcs: [":29.0.board.compat.cil"],
374 stem: "29.0.compat.cil",
375 system_ext_specific: true,
376}
377
378se_compat_cil {
379 name: "system_ext_30.0.compat.cil",
380 srcs: [":30.0.board.compat.cil"],
381 stem: "30.0.compat.cil",
382 system_ext_specific: true,
383}
384
Inseob Kim4f20ff72021-06-15 21:05:39 +0900385se_compat_cil {
386 name: "system_ext_31.0.compat.cil",
387 srcs: [":31.0.board.compat.cil"],
388 stem: "31.0.compat.cil",
389 system_ext_specific: true,
390}
391
Inseob Kimbee558e2021-11-30 14:58:10 +0900392se_compat_cil {
393 name: "system_ext_32.0.compat.cil",
394 srcs: [":32.0.board.compat.cil"],
395 stem: "32.0.compat.cil",
396 system_ext_specific: true,
397}
398
Inseob Kimb554e592019-04-15 20:10:46 +0900399se_filegroup {
400 name: "file_contexts_files",
401 srcs: ["file_contexts"],
402}
403
404se_filegroup {
405 name: "file_contexts_asan_files",
406 srcs: ["file_contexts_asan"],
407}
408
409se_filegroup {
410 name: "file_contexts_overlayfs_files",
411 srcs: ["file_contexts_overlayfs"],
412}
413
414se_filegroup {
415 name: "hwservice_contexts_files",
416 srcs: ["hwservice_contexts"],
417}
418
419se_filegroup {
420 name: "property_contexts_files",
421 srcs: ["property_contexts"],
422}
423
424se_filegroup {
425 name: "service_contexts_files",
426 srcs: ["service_contexts"],
427}
428
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700429se_filegroup {
430 name: "keystore2_key_contexts_files",
431 srcs: ["keystore2_key_contexts"],
432}
433
Inseob Kimb554e592019-04-15 20:10:46 +0900434file_contexts {
435 name: "plat_file_contexts",
436 srcs: [":file_contexts_files"],
437 product_variables: {
438 address_sanitize: {
439 srcs: [":file_contexts_asan_files"],
440 },
441 debuggable: {
442 srcs: [":file_contexts_overlayfs_files"],
443 },
444 },
445
446 flatten_apex: {
447 srcs: ["apex/*-file_contexts"],
448 },
Yuntao Xu42e732c2021-11-18 22:33:02 +0000449}
Inseob Kimb554e592019-04-15 20:10:46 +0900450
Yuntao Xu42e732c2021-11-18 22:33:02 +0000451file_contexts {
452 name: "plat_file_contexts.recovery",
453 srcs: [":file_contexts_files"],
454 stem: "plat_file_contexts",
455 product_variables: {
456 address_sanitize: {
457 srcs: [":file_contexts_asan_files"],
458 },
459 debuggable: {
460 srcs: [":file_contexts_overlayfs_files"],
461 },
462 },
463
464 flatten_apex: {
465 srcs: ["apex/*-file_contexts"],
466 },
467
468 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900469}
470
471file_contexts {
472 name: "vendor_file_contexts",
473 srcs: [":file_contexts_files"],
474 soc_specific: true,
475 recovery_available: true,
476}
477
478file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800479 name: "system_ext_file_contexts",
480 srcs: [":file_contexts_files"],
481 system_ext_specific: true,
482 recovery_available: true,
483}
484
485file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900486 name: "product_file_contexts",
487 srcs: [":file_contexts_files"],
488 product_specific: true,
489 recovery_available: true,
490}
491
492file_contexts {
493 name: "odm_file_contexts",
494 srcs: [":file_contexts_files"],
495 device_specific: true,
496 recovery_available: true,
497}
498
499hwservice_contexts {
500 name: "plat_hwservice_contexts",
501 srcs: [":hwservice_contexts_files"],
502}
503
504hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800505 name: "system_ext_hwservice_contexts",
506 srcs: [":hwservice_contexts_files"],
507 system_ext_specific: true,
508}
509
510hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900511 name: "product_hwservice_contexts",
512 srcs: [":hwservice_contexts_files"],
513 product_specific: true,
514}
515
516hwservice_contexts {
517 name: "vendor_hwservice_contexts",
518 srcs: [":hwservice_contexts_files"],
519 reqd_mask: true,
520 soc_specific: true,
521}
522
523hwservice_contexts {
524 name: "odm_hwservice_contexts",
525 srcs: [":hwservice_contexts_files"],
526 device_specific: true,
527}
528
529property_contexts {
530 name: "plat_property_contexts",
531 srcs: [":property_contexts_files"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000532}
533
534property_contexts {
535 name: "plat_property_contexts.recovery",
536 srcs: [":property_contexts_files"],
537 stem: "plat_property_contexts",
538 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900539}
540
541property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800542 name: "system_ext_property_contexts",
543 srcs: [":property_contexts_files"],
544 system_ext_specific: true,
545 recovery_available: true,
546}
547
548property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900549 name: "product_property_contexts",
550 srcs: [":property_contexts_files"],
551 product_specific: true,
552 recovery_available: true,
553}
554
555property_contexts {
556 name: "vendor_property_contexts",
557 srcs: [":property_contexts_files"],
558 reqd_mask: true,
559 soc_specific: true,
560 recovery_available: true,
561}
562
563property_contexts {
564 name: "odm_property_contexts",
565 srcs: [":property_contexts_files"],
566 device_specific: true,
567 recovery_available: true,
568}
569
570service_contexts {
571 name: "plat_service_contexts",
572 srcs: [":service_contexts_files"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000573}
574
575service_contexts {
576 name: "plat_service_contexts.recovery",
577 srcs: [":service_contexts_files"],
578 stem: "plat_service_contexts",
579 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900580}
581
582service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800583 name: "system_ext_service_contexts",
584 srcs: [":service_contexts_files"],
585 system_ext_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800586 recovery_available: true,
Bowgo Tsai98231162019-09-09 22:05:29 +0800587}
588
589service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900590 name: "product_service_contexts",
591 srcs: [":service_contexts_files"],
592 product_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800593 recovery_available: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900594}
595
596service_contexts {
597 name: "vendor_service_contexts",
598 srcs: [":service_contexts_files"],
599 reqd_mask: true,
600 soc_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800601 recovery_available: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900602}
yangbill3e345372020-04-15 13:55:47 +0800603
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700604keystore2_key_contexts {
605 name: "plat_keystore2_key_contexts",
606 srcs: [":keystore2_key_contexts_files"],
607}
608
609keystore2_key_contexts {
610 name: "system_keystore2_key_contexts",
611 srcs: [":keystore2_key_contexts_files"],
612 system_ext_specific: true,
613}
614
615keystore2_key_contexts {
616 name: "product_keystore2_key_contexts",
617 srcs: [":keystore2_key_contexts_files"],
618 product_specific: true,
619}
620
621keystore2_key_contexts {
622 name: "vendor_keystore2_key_contexts",
623 srcs: [":keystore2_key_contexts_files"],
624 reqd_mask: true,
625 soc_specific: true,
626}
627
yangbill3e345372020-04-15 13:55:47 +0800628// For vts_treble_sys_prop_test
629filegroup {
630 name: "private_property_contexts",
631 srcs: ["private/property_contexts"],
632 visibility: [
633 "//test/vts-testcase/security/system_property",
634 ],
635}
Inseob Kime35b49b2021-02-18 19:15:41 +0900636
Inseob Kima49e7242021-03-22 10:26:13 +0900637se_build_files {
638 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900639 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900640 "security_classes",
641 "initial_sids",
642 "access_vectors",
643 "global_macros",
644 "neverallow_macros",
645 "mls_macros",
646 "mls_decl",
647 "mls",
648 "policy_capabilities",
649 "te_macros",
650 "attributes",
651 "ioctl_defines",
652 "ioctl_macros",
653 "*.te",
654 "roles_decl",
655 "roles",
656 "users",
657 "initial_sid_contexts",
658 "fs_use",
659 "genfs_contexts",
660 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900661 ],
662}
663
Inseob Kim7cb20812021-12-16 16:52:14 +0900664se_build_files {
665 name: "sepolicy_technical_debt",
666 srcs: ["technical_debt.cil"],
667}
668
Inseob Kim0a707fa2021-12-09 23:35:11 +0900669reqd_mask_policy = [":se_build_files{.reqd_mask}"]
670plat_public_policy = [":se_build_files{.plat_public}"]
671plat_private_policy = [":se_build_files{.plat_private}"]
672system_ext_public_policy = [":se_build_files{.system_ext_public}"]
673system_ext_private_policy = [":se_build_files{.system_ext_private}"]
674product_public_policy = [":se_build_files{.product_public}"]
675product_private_policy = [":se_build_files{.product_private}"]
676
Inseob Kima49e7242021-03-22 10:26:13 +0900677// reqd_policy_mask - a policy.conf file which contains only the bare minimum
678// policy necessary to use checkpolicy.
679//
680// This bare-minimum policy needs to be present in all policy.conf files, but
681// should not necessarily be exported as part of the public policy.
682//
683// The rules generated by reqd_policy_mask will allow the compilation of public
684// policy and subsequent removal of CIL policy that should not be exported.
685se_policy_conf {
686 name: "reqd_policy_mask.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900687 srcs: reqd_mask_policy,
Inseob Kime35b49b2021-02-18 19:15:41 +0900688 installable: false,
689}
690
Inseob Kima49e7242021-03-22 10:26:13 +0900691se_policy_cil {
692 name: "reqd_policy_mask.cil",
693 src: ":reqd_policy_mask.conf",
694 secilc_check: false,
695 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900696}
697
Inseob Kima49e7242021-03-22 10:26:13 +0900698// pub_policy - policy that will be exported to be a part of non-platform
699// policy corresponding to this platform version.
700//
701// This is a limited subset of policy that would not compile in checkpolicy on
702// its own.
703//
704// To get around this limitation, add only the required files from private
705// policy, which will generate CIL policy that will then be filtered out by the
706// reqd_policy_mask.
707//
708// There are three pub_policy.cil files below:
709// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
710// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
711// - plat_pub_policy.cil: exported 'system' policy.
712//
713// Those above files will in turn be used to generate the following versioned cil files:
714// - product_mapping_file: the versioned, exported 'product' policy in product partition.
715// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
716// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
717// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
718// in vendor partition.
719//
720se_policy_conf {
721 name: "pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900722 srcs: plat_public_policy +
723 system_ext_public_policy +
724 product_public_policy +
725 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900726 installable: false,
727}
728
729se_policy_cil {
730 name: "pub_policy.cil",
731 src: ":pub_policy.conf",
732 filter_out: [":reqd_policy_mask.cil"],
733 secilc_check: false,
734 installable: false,
735}
736
737se_policy_conf {
738 name: "system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900739 srcs: plat_public_policy +
740 system_ext_public_policy +
741 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900742 installable: false,
743}
744
745se_policy_cil {
746 name: "system_ext_pub_policy.cil",
747 src: ":system_ext_pub_policy.conf",
748 filter_out: [":reqd_policy_mask.cil"],
749 secilc_check: false,
750 installable: false,
751}
752
753se_policy_conf {
754 name: "plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900755 srcs: plat_public_policy +
756 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900757 installable: false,
758}
759
760se_policy_cil {
761 name: "plat_pub_policy.cil",
762 src: ":plat_pub_policy.conf",
763 filter_out: [":reqd_policy_mask.cil"],
764 secilc_check: false,
765 installable: false,
766}
767
768// plat_policy.conf - A combination of the private and public platform policy
769// which will ship with the device.
770//
771// The platform will always reflect the most recent platform version and is not
772// currently being attributized.
773se_policy_conf {
774 name: "plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900775 srcs: plat_public_policy +
776 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900777 installable: false,
778}
779
780se_policy_cil {
781 name: "plat_sepolicy.cil",
782 src: ":plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900783 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900784}
785
Inseob Kim6cc75f42021-04-29 13:53:20 +0000786// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
787se_policy_conf {
788 name: "userdebug_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900789 srcs: plat_public_policy +
790 plat_private_policy,
Inseob Kim6cc75f42021-04-29 13:53:20 +0000791 build_variant: "userdebug",
792 installable: false,
793}
794
795se_policy_cil {
796 name: "userdebug_plat_sepolicy.cil",
797 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900798 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kim6cc75f42021-04-29 13:53:20 +0000799 debug_ramdisk: true,
Yi-Yo Chiang68478b12021-10-16 03:23:05 +0800800 dist: {
801 targets: ["droidcore"],
802 },
Inseob Kim6cc75f42021-04-29 13:53:20 +0000803}
804
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000805// A copy of the userdebug_plat_policy in GSI.
806soong_config_module_type {
807 name: "gsi_se_policy_cil",
808 module_type: "se_policy_cil",
809 config_namespace: "ANDROID",
810 bool_variables: [
811 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
812 ],
813 properties: [
814 "enabled",
815 "installable",
816 ],
817}
818
819gsi_se_policy_cil {
820 name: "system_ext_userdebug_plat_sepolicy.cil",
821 stem: "userdebug_plat_sepolicy.cil",
822 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900823 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000824 system_ext_specific: true,
825 enabled: false,
826 installable: false,
827 soong_config_variables: {
828 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
829 enabled: true,
830 installable: true,
831 },
832 },
833}
834
Inseob Kima49e7242021-03-22 10:26:13 +0900835// system_ext_policy.conf - A combination of the private and public system_ext
836// policy which will ship with the device. System_ext policy is not attributized
837se_policy_conf {
838 name: "system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900839 srcs: plat_public_policy +
840 plat_private_policy +
841 system_ext_public_policy +
842 system_ext_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900843 installable: false,
844}
845
846se_policy_cil {
847 name: "system_ext_sepolicy.cil",
848 src: ":system_ext_sepolicy.conf",
849 system_ext_specific: true,
850 filter_out: [":plat_sepolicy.cil"],
851 remove_line_marker: true,
852}
853
854// product_policy.conf - A combination of the private and public product policy
855// which will ship with the device. Product policy is not attributized
856se_policy_conf {
857 name: "product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900858 srcs: plat_public_policy +
859 plat_private_policy +
860 system_ext_public_policy +
861 system_ext_private_policy +
862 product_public_policy +
863 product_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900864 installable: false,
865}
866
867se_policy_cil {
868 name: "product_sepolicy.cil",
869 src: ":product_sepolicy.conf",
870 product_specific: true,
871 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
872 remove_line_marker: true,
873}
874
Inseob Kim039175b2021-03-25 15:37:34 +0900875// policy mapping files
876// auto-generate the mapping file for current platform policy, since it needs to
877// track platform policy development
878se_versioned_policy {
879 name: "plat_mapping_file",
880 base: ":plat_pub_policy.cil",
881 mapping: true,
882 version: "current",
883 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
884}
885
886se_versioned_policy {
887 name: "system_ext_mapping_file",
888 base: ":system_ext_pub_policy.cil",
889 mapping: true,
890 version: "current",
891 filter_out: [":plat_mapping_file"],
892 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
893 system_ext_specific: true,
894}
895
896se_versioned_policy {
897 name: "product_mapping_file",
898 base: ":pub_policy.cil",
899 mapping: true,
900 version: "current",
901 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
902 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
903 product_specific: true,
904}
905
906// plat_pub_versioned.cil - the exported platform policy associated with the version
907// that non-platform policy targets.
908se_versioned_policy {
909 name: "plat_pub_versioned.cil",
910 base: ":pub_policy.cil",
911 target_policy: ":pub_policy.cil",
912 version: "current",
913 dependent_cils: [
914 ":plat_sepolicy.cil",
915 ":system_ext_sepolicy.cil",
916 ":product_sepolicy.cil",
917 ":plat_mapping_file",
918 ":system_ext_mapping_file",
919 ":product_mapping_file",
920 ],
921 vendor: true,
922}
923
924//////////////////////////////////
925// Precompiled sepolicy is loaded if and only if:
926// - plat_sepolicy_and_mapping.sha256 equals
927// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
928// AND
929// - system_ext_sepolicy_and_mapping.sha256 equals
930// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
931// AND
932// - product_sepolicy_and_mapping.sha256 equals
933// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
934// See system/core/init/selinux.cpp for details.
935//////////////////////////////////
936genrule {
937 name: "plat_sepolicy_and_mapping.sha256_gen",
938 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
939 out: ["plat_sepolicy_and_mapping.sha256"],
940 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
941}
942
943prebuilt_etc {
944 name: "plat_sepolicy_and_mapping.sha256",
945 filename: "plat_sepolicy_and_mapping.sha256",
946 src: ":plat_sepolicy_and_mapping.sha256_gen",
947 relative_install_path: "selinux",
948}
949
950genrule {
951 name: "system_ext_sepolicy_and_mapping.sha256_gen",
952 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
953 out: ["system_ext_sepolicy_and_mapping.sha256"],
954 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
955}
956
957prebuilt_etc {
958 name: "system_ext_sepolicy_and_mapping.sha256",
959 filename: "system_ext_sepolicy_and_mapping.sha256",
960 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
961 relative_install_path: "selinux",
962 system_ext_specific: true,
963}
964
965genrule {
966 name: "product_sepolicy_and_mapping.sha256_gen",
967 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
968 out: ["product_sepolicy_and_mapping.sha256"],
969 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
970}
971
972prebuilt_etc {
973 name: "product_sepolicy_and_mapping.sha256",
974 filename: "product_sepolicy_and_mapping.sha256",
975 src: ":product_sepolicy_and_mapping.sha256_gen",
976 relative_install_path: "selinux",
977 product_specific: true,
978}
979
Inseob Kim1c056b12021-04-30 00:11:43 +0900980sepolicy_vers {
981 name: "plat_sepolicy_vers.txt",
982 version: "vendor",
983 vendor: true,
984}
985
Inseob Kim731182a2021-05-06 11:44:37 +0000986soong_config_module_type {
987 name: "precompiled_sepolicy_defaults",
988 module_type: "prebuilt_defaults",
989 config_namespace: "ANDROID",
990 bool_variables: ["BOARD_USES_ODMIMAGE"],
991 properties: ["vendor", "device_specific"],
992}
993
994precompiled_sepolicy_defaults {
995 name: "precompiled_sepolicy",
996 soong_config_variables: {
997 BOARD_USES_ODMIMAGE: {
998 device_specific: true,
999 conditions_default: {
1000 vendor: true,
1001 },
1002 },
1003 },
1004}
1005
1006//////////////////////////////////
1007// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
1008// which precompiled_policy was built.
1009//////////////////////////////////
1010prebuilt_etc {
1011 defaults: ["precompiled_sepolicy"],
1012 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1013 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1014 src: ":plat_sepolicy_and_mapping.sha256_gen",
1015 relative_install_path: "selinux",
1016}
1017
1018//////////////////////////////////
1019// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
1020// which precompiled_policy was built.
1021//////////////////////////////////
1022prebuilt_etc {
1023 defaults: ["precompiled_sepolicy"],
1024 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1025 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1026 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
1027 relative_install_path: "selinux",
1028}
1029
1030//////////////////////////////////
1031// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
1032// which precompiled_policy was built.
1033//////////////////////////////////
1034prebuilt_etc {
1035 defaults: ["precompiled_sepolicy"],
1036 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1037 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1038 src: ":product_sepolicy_and_mapping.sha256_gen",
1039 relative_install_path: "selinux",
1040}
1041
1042
Inseob Kima49e7242021-03-22 10:26:13 +09001043//////////////////////////////////
1044// SELinux policy embedded into CTS.
1045// CTS checks neverallow rules of this policy against the policy of the device under test.
1046//////////////////////////////////
1047se_policy_conf {
1048 name: "general_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001049 srcs: plat_public_policy +
1050 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +09001051 build_variant: "user",
1052 cts: true,
1053 exclude_build_test: true,
1054}
Inseob Kimd5816612021-09-15 03:01:05 +00001055
1056//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001057// Base system policy for treble sepolicy tests.
1058// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1059// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1060// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1061// See treble_sepolicy_tests_for_release.mk for more details.
1062//////////////////////////////////
1063se_policy_conf {
1064 name: "base_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001065 srcs: plat_public_policy +
1066 plat_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001067 build_variant: "user",
1068 installable: false,
1069}
1070
1071se_policy_cil {
1072 name: "base_plat_sepolicy.cil",
1073 src: ":base_plat_sepolicy.conf",
1074 additional_cil_files: ["private/technical_debt.cil"],
1075 installable: false,
1076 secilc_check: false, // done by se_policy_binary
1077}
1078
1079se_policy_binary {
1080 name: "base_plat_sepolicy",
1081 srcs: [":base_plat_sepolicy.cil"],
1082 installable: false,
1083}
1084
1085se_policy_conf {
1086 name: "base_system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001087 srcs: plat_public_policy +
1088 plat_private_policy +
1089 system_ext_public_policy +
1090 system_ext_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001091 build_variant: "user",
1092 installable: false,
1093}
1094
1095se_policy_cil {
1096 name: "base_system_ext_sepolicy.cil",
1097 src: ":base_system_ext_sepolicy.conf",
1098 additional_cil_files: ["private/technical_debt.cil"],
1099 system_ext_specific: true,
1100 installable: false,
1101 secilc_check: false, // done by se_policy_binary
1102}
1103
1104se_policy_binary {
1105 name: "base_system_ext_sepolicy",
1106 srcs: [":base_system_ext_sepolicy.cil"],
1107 system_ext_specific: true,
1108 installable: false,
1109}
1110
1111se_policy_conf {
1112 name: "base_product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001113 srcs: plat_public_policy +
1114 plat_private_policy +
1115 system_ext_public_policy +
1116 system_ext_private_policy +
1117 product_public_policy +
1118 product_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001119 build_variant: "user",
1120 installable: false,
1121}
1122
1123se_policy_cil {
1124 name: "base_product_sepolicy.cil",
1125 src: ":base_product_sepolicy.conf",
1126 additional_cil_files: ["private/technical_debt.cil"],
1127 product_specific: true,
1128 installable: false,
1129 secilc_check: false, // done by se_policy_binary
1130}
1131
1132se_policy_binary {
1133 name: "base_product_sepolicy",
1134 srcs: [":base_product_sepolicy.cil"],
1135 product_specific: true,
1136 installable: false,
1137}
1138
1139se_policy_conf {
1140 name: "base_plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001141 srcs: plat_public_policy +
1142 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001143 build_variant: "user",
1144 installable: false,
1145}
1146
1147se_policy_cil {
1148 name: "base_plat_pub_policy.cil",
1149 src: ":base_plat_pub_policy.conf",
1150 filter_out: [":reqd_policy_mask.cil"],
1151 secilc_check: false,
1152 installable: false,
1153}
1154
1155se_policy_conf {
1156 name: "base_system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001157 srcs: plat_public_policy +
1158 system_ext_public_policy +
1159 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001160 build_variant: "user",
1161 installable: false,
1162}
1163
1164se_policy_cil {
1165 name: "base_system_ext_pub_policy.cil",
1166 src: ":base_system_ext_pub_policy.conf",
1167 filter_out: [":reqd_policy_mask.cil"],
1168 secilc_check: false,
1169 installable: false,
1170}
1171
1172se_policy_conf {
1173 name: "base_product_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001174 srcs: plat_public_policy +
1175 system_ext_public_policy +
1176 product_public_policy +
1177 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001178 build_variant: "user",
1179 installable: false,
1180}
1181
1182se_policy_cil {
1183 name: "base_product_pub_policy.cil",
1184 src: ":base_product_pub_policy.conf",
1185 filter_out: [":reqd_policy_mask.cil"],
1186 secilc_check: false,
1187 installable: false,
1188}
1189
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001190// bug_map - Bug tracking information for selinux denials loaded by auditd.
1191se_filegroup {
1192 name: "bug_map_files",
1193 srcs: ["bug_map"],
1194}
1195
1196se_bug_map {
1197 name: "plat_bug_map",
1198 srcs: [":bug_map_files"],
1199 stem: "bug_map",
1200}
1201
1202se_bug_map {
1203 name: "system_ext_bug_map",
1204 srcs: [":bug_map_files"],
1205 stem: "bug_map",
1206 system_ext_specific: true,
1207}
1208
1209se_bug_map {
1210 name: "vendor_bug_map",
1211 srcs: [":bug_map_files"],
1212 // Legacy file name of the vendor partition bug_map.
1213 stem: "selinux_denial_metadata",
1214 vendor: true,
1215}
1216
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001217//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001218// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1219// Additional directories can be specified via Makefile variables:
1220// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1221//////////////////////////////////
1222se_freeze_test {
1223 name: "sepolicy_freeze_test",
1224}
Yuntao Xu42e732c2021-11-18 22:33:02 +00001225
1226//////////////////////////////////
1227// Makefile rules temporary imported to Soong
1228// TODO(b/33691272): remove these after migrating seapp to Soong
1229//////////////////////////////////
1230makefile_goal {
1231 name: "plat_seapp_contexts_rule",
1232 product_out_path: "obj/ETC/plat_seapp_contexts_intermediates/plat_seapp_contexts",
1233}
1234
1235makefile_goal {
1236 name: "plat_seapp_neverallows_rule",
1237 product_out_path: "obj/ETC/plat_seapp_neverallows_intermediates/plat_seapp_neverallows",
1238}