blob: 9a13c9c2944e8789b4f47eaf56ebcad1d891d849 [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 Kima49e7242021-03-22 10:26:13 +0900664// reqd_policy_mask - a policy.conf file which contains only the bare minimum
665// policy necessary to use checkpolicy.
666//
667// This bare-minimum policy needs to be present in all policy.conf files, but
668// should not necessarily be exported as part of the public policy.
669//
670// The rules generated by reqd_policy_mask will allow the compilation of public
671// policy and subsequent removal of CIL policy that should not be exported.
672se_policy_conf {
673 name: "reqd_policy_mask.conf",
674 srcs: [":se_build_files{.reqd_mask}"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900675 installable: false,
676}
677
Inseob Kima49e7242021-03-22 10:26:13 +0900678se_policy_cil {
679 name: "reqd_policy_mask.cil",
680 src: ":reqd_policy_mask.conf",
681 secilc_check: false,
682 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900683}
684
Inseob Kima49e7242021-03-22 10:26:13 +0900685// pub_policy - policy that will be exported to be a part of non-platform
686// policy corresponding to this platform version.
687//
688// This is a limited subset of policy that would not compile in checkpolicy on
689// its own.
690//
691// To get around this limitation, add only the required files from private
692// policy, which will generate CIL policy that will then be filtered out by the
693// reqd_policy_mask.
694//
695// There are three pub_policy.cil files below:
696// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
697// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
698// - plat_pub_policy.cil: exported 'system' policy.
699//
700// Those above files will in turn be used to generate the following versioned cil files:
701// - product_mapping_file: the versioned, exported 'product' policy in product partition.
702// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
703// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
704// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
705// in vendor partition.
706//
707se_policy_conf {
708 name: "pub_policy.conf",
709 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
710 installable: false,
711}
712
713se_policy_cil {
714 name: "pub_policy.cil",
715 src: ":pub_policy.conf",
716 filter_out: [":reqd_policy_mask.cil"],
717 secilc_check: false,
718 installable: false,
719}
720
721se_policy_conf {
722 name: "system_ext_pub_policy.conf",
723 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
724 installable: false,
725}
726
727se_policy_cil {
728 name: "system_ext_pub_policy.cil",
729 src: ":system_ext_pub_policy.conf",
730 filter_out: [":reqd_policy_mask.cil"],
731 secilc_check: false,
732 installable: false,
733}
734
735se_policy_conf {
736 name: "plat_pub_policy.conf",
737 srcs: [":se_build_files{.plat_public}"],
738 installable: false,
739}
740
741se_policy_cil {
742 name: "plat_pub_policy.cil",
743 src: ":plat_pub_policy.conf",
744 filter_out: [":reqd_policy_mask.cil"],
745 secilc_check: false,
746 installable: false,
747}
748
749// plat_policy.conf - A combination of the private and public platform policy
750// which will ship with the device.
751//
752// The platform will always reflect the most recent platform version and is not
753// currently being attributized.
754se_policy_conf {
755 name: "plat_sepolicy.conf",
756 srcs: [":se_build_files{.plat}"],
757 installable: false,
758}
759
760se_policy_cil {
761 name: "plat_sepolicy.cil",
762 src: ":plat_sepolicy.conf",
763 additional_cil_files: ["private/technical_debt.cil"],
764}
765
Inseob Kim6cc75f42021-04-29 13:53:20 +0000766// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
767se_policy_conf {
768 name: "userdebug_plat_sepolicy.conf",
769 srcs: [":se_build_files{.plat}"],
770 build_variant: "userdebug",
771 installable: false,
772}
773
774se_policy_cil {
775 name: "userdebug_plat_sepolicy.cil",
776 src: ":userdebug_plat_sepolicy.conf",
777 additional_cil_files: ["private/technical_debt.cil"],
778 debug_ramdisk: true,
Yi-Yo Chiang68478b12021-10-16 03:23:05 +0800779 dist: {
780 targets: ["droidcore"],
781 },
Inseob Kim6cc75f42021-04-29 13:53:20 +0000782}
783
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000784// A copy of the userdebug_plat_policy in GSI.
785soong_config_module_type {
786 name: "gsi_se_policy_cil",
787 module_type: "se_policy_cil",
788 config_namespace: "ANDROID",
789 bool_variables: [
790 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
791 ],
792 properties: [
793 "enabled",
794 "installable",
795 ],
796}
797
798gsi_se_policy_cil {
799 name: "system_ext_userdebug_plat_sepolicy.cil",
800 stem: "userdebug_plat_sepolicy.cil",
801 src: ":userdebug_plat_sepolicy.conf",
802 additional_cil_files: ["private/technical_debt.cil"],
803 system_ext_specific: true,
804 enabled: false,
805 installable: false,
806 soong_config_variables: {
807 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
808 enabled: true,
809 installable: true,
810 },
811 },
812}
813
Inseob Kima49e7242021-03-22 10:26:13 +0900814// system_ext_policy.conf - A combination of the private and public system_ext
815// policy which will ship with the device. System_ext policy is not attributized
816se_policy_conf {
817 name: "system_ext_sepolicy.conf",
818 srcs: [":se_build_files{.system_ext}"],
819 installable: false,
820}
821
822se_policy_cil {
823 name: "system_ext_sepolicy.cil",
824 src: ":system_ext_sepolicy.conf",
825 system_ext_specific: true,
826 filter_out: [":plat_sepolicy.cil"],
827 remove_line_marker: true,
828}
829
830// product_policy.conf - A combination of the private and public product policy
831// which will ship with the device. Product policy is not attributized
832se_policy_conf {
833 name: "product_sepolicy.conf",
834 srcs: [":se_build_files{.product}"],
835 installable: false,
836}
837
838se_policy_cil {
839 name: "product_sepolicy.cil",
840 src: ":product_sepolicy.conf",
841 product_specific: true,
842 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
843 remove_line_marker: true,
844}
845
Inseob Kim039175b2021-03-25 15:37:34 +0900846// policy mapping files
847// auto-generate the mapping file for current platform policy, since it needs to
848// track platform policy development
849se_versioned_policy {
850 name: "plat_mapping_file",
851 base: ":plat_pub_policy.cil",
852 mapping: true,
853 version: "current",
854 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
855}
856
857se_versioned_policy {
858 name: "system_ext_mapping_file",
859 base: ":system_ext_pub_policy.cil",
860 mapping: true,
861 version: "current",
862 filter_out: [":plat_mapping_file"],
863 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
864 system_ext_specific: true,
865}
866
867se_versioned_policy {
868 name: "product_mapping_file",
869 base: ":pub_policy.cil",
870 mapping: true,
871 version: "current",
872 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
873 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
874 product_specific: true,
875}
876
877// plat_pub_versioned.cil - the exported platform policy associated with the version
878// that non-platform policy targets.
879se_versioned_policy {
880 name: "plat_pub_versioned.cil",
881 base: ":pub_policy.cil",
882 target_policy: ":pub_policy.cil",
883 version: "current",
884 dependent_cils: [
885 ":plat_sepolicy.cil",
886 ":system_ext_sepolicy.cil",
887 ":product_sepolicy.cil",
888 ":plat_mapping_file",
889 ":system_ext_mapping_file",
890 ":product_mapping_file",
891 ],
892 vendor: true,
893}
894
895//////////////////////////////////
896// Precompiled sepolicy is loaded if and only if:
897// - plat_sepolicy_and_mapping.sha256 equals
898// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
899// AND
900// - system_ext_sepolicy_and_mapping.sha256 equals
901// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
902// AND
903// - product_sepolicy_and_mapping.sha256 equals
904// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
905// See system/core/init/selinux.cpp for details.
906//////////////////////////////////
907genrule {
908 name: "plat_sepolicy_and_mapping.sha256_gen",
909 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
910 out: ["plat_sepolicy_and_mapping.sha256"],
911 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
912}
913
914prebuilt_etc {
915 name: "plat_sepolicy_and_mapping.sha256",
916 filename: "plat_sepolicy_and_mapping.sha256",
917 src: ":plat_sepolicy_and_mapping.sha256_gen",
918 relative_install_path: "selinux",
919}
920
921genrule {
922 name: "system_ext_sepolicy_and_mapping.sha256_gen",
923 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
924 out: ["system_ext_sepolicy_and_mapping.sha256"],
925 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
926}
927
928prebuilt_etc {
929 name: "system_ext_sepolicy_and_mapping.sha256",
930 filename: "system_ext_sepolicy_and_mapping.sha256",
931 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
932 relative_install_path: "selinux",
933 system_ext_specific: true,
934}
935
936genrule {
937 name: "product_sepolicy_and_mapping.sha256_gen",
938 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
939 out: ["product_sepolicy_and_mapping.sha256"],
940 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
941}
942
943prebuilt_etc {
944 name: "product_sepolicy_and_mapping.sha256",
945 filename: "product_sepolicy_and_mapping.sha256",
946 src: ":product_sepolicy_and_mapping.sha256_gen",
947 relative_install_path: "selinux",
948 product_specific: true,
949}
950
Inseob Kim1c056b12021-04-30 00:11:43 +0900951sepolicy_vers {
952 name: "plat_sepolicy_vers.txt",
953 version: "vendor",
954 vendor: true,
955}
956
Inseob Kim731182a2021-05-06 11:44:37 +0000957soong_config_module_type {
958 name: "precompiled_sepolicy_defaults",
959 module_type: "prebuilt_defaults",
960 config_namespace: "ANDROID",
961 bool_variables: ["BOARD_USES_ODMIMAGE"],
962 properties: ["vendor", "device_specific"],
963}
964
965precompiled_sepolicy_defaults {
966 name: "precompiled_sepolicy",
967 soong_config_variables: {
968 BOARD_USES_ODMIMAGE: {
969 device_specific: true,
970 conditions_default: {
971 vendor: true,
972 },
973 },
974 },
975}
976
977//////////////////////////////////
978// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
979// which precompiled_policy was built.
980//////////////////////////////////
981prebuilt_etc {
982 defaults: ["precompiled_sepolicy"],
983 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
984 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
985 src: ":plat_sepolicy_and_mapping.sha256_gen",
986 relative_install_path: "selinux",
987}
988
989//////////////////////////////////
990// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
991// which precompiled_policy was built.
992//////////////////////////////////
993prebuilt_etc {
994 defaults: ["precompiled_sepolicy"],
995 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
996 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
997 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
998 relative_install_path: "selinux",
999}
1000
1001//////////////////////////////////
1002// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
1003// which precompiled_policy was built.
1004//////////////////////////////////
1005prebuilt_etc {
1006 defaults: ["precompiled_sepolicy"],
1007 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1008 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1009 src: ":product_sepolicy_and_mapping.sha256_gen",
1010 relative_install_path: "selinux",
1011}
1012
1013
Inseob Kima49e7242021-03-22 10:26:13 +09001014//////////////////////////////////
1015// SELinux policy embedded into CTS.
1016// CTS checks neverallow rules of this policy against the policy of the device under test.
1017//////////////////////////////////
1018se_policy_conf {
1019 name: "general_sepolicy.conf",
1020 srcs: [":se_build_files{.plat}"],
1021 build_variant: "user",
1022 cts: true,
1023 exclude_build_test: true,
1024}
Inseob Kimd5816612021-09-15 03:01:05 +00001025
1026//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001027// Base system policy for treble sepolicy tests.
1028// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1029// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1030// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1031// See treble_sepolicy_tests_for_release.mk for more details.
1032//////////////////////////////////
1033se_policy_conf {
1034 name: "base_plat_sepolicy.conf",
1035 srcs: [":se_build_files{.plat}"],
1036 build_variant: "user",
1037 installable: false,
1038}
1039
1040se_policy_cil {
1041 name: "base_plat_sepolicy.cil",
1042 src: ":base_plat_sepolicy.conf",
1043 additional_cil_files: ["private/technical_debt.cil"],
1044 installable: false,
1045 secilc_check: false, // done by se_policy_binary
1046}
1047
1048se_policy_binary {
1049 name: "base_plat_sepolicy",
1050 srcs: [":base_plat_sepolicy.cil"],
1051 installable: false,
1052}
1053
1054se_policy_conf {
1055 name: "base_system_ext_sepolicy.conf",
1056 srcs: [":se_build_files{.system_ext}"],
1057 build_variant: "user",
1058 installable: false,
1059}
1060
1061se_policy_cil {
1062 name: "base_system_ext_sepolicy.cil",
1063 src: ":base_system_ext_sepolicy.conf",
1064 additional_cil_files: ["private/technical_debt.cil"],
1065 system_ext_specific: true,
1066 installable: false,
1067 secilc_check: false, // done by se_policy_binary
1068}
1069
1070se_policy_binary {
1071 name: "base_system_ext_sepolicy",
1072 srcs: [":base_system_ext_sepolicy.cil"],
1073 system_ext_specific: true,
1074 installable: false,
1075}
1076
1077se_policy_conf {
1078 name: "base_product_sepolicy.conf",
1079 srcs: [":se_build_files{.product}"],
1080 build_variant: "user",
1081 installable: false,
1082}
1083
1084se_policy_cil {
1085 name: "base_product_sepolicy.cil",
1086 src: ":base_product_sepolicy.conf",
1087 additional_cil_files: ["private/technical_debt.cil"],
1088 product_specific: true,
1089 installable: false,
1090 secilc_check: false, // done by se_policy_binary
1091}
1092
1093se_policy_binary {
1094 name: "base_product_sepolicy",
1095 srcs: [":base_product_sepolicy.cil"],
1096 product_specific: true,
1097 installable: false,
1098}
1099
1100se_policy_conf {
1101 name: "base_plat_pub_policy.conf",
1102 srcs: [":se_build_files{.plat_public}"],
1103 build_variant: "user",
1104 installable: false,
1105}
1106
1107se_policy_cil {
1108 name: "base_plat_pub_policy.cil",
1109 src: ":base_plat_pub_policy.conf",
1110 filter_out: [":reqd_policy_mask.cil"],
1111 secilc_check: false,
1112 installable: false,
1113}
1114
1115se_policy_conf {
1116 name: "base_system_ext_pub_policy.conf",
1117 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
1118 build_variant: "user",
1119 installable: false,
1120}
1121
1122se_policy_cil {
1123 name: "base_system_ext_pub_policy.cil",
1124 src: ":base_system_ext_pub_policy.conf",
1125 filter_out: [":reqd_policy_mask.cil"],
1126 secilc_check: false,
1127 installable: false,
1128}
1129
1130se_policy_conf {
1131 name: "base_product_pub_policy.conf",
1132 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
1133 build_variant: "user",
1134 installable: false,
1135}
1136
1137se_policy_cil {
1138 name: "base_product_pub_policy.cil",
1139 src: ":base_product_pub_policy.conf",
1140 filter_out: [":reqd_policy_mask.cil"],
1141 secilc_check: false,
1142 installable: false,
1143}
1144
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001145// bug_map - Bug tracking information for selinux denials loaded by auditd.
1146se_filegroup {
1147 name: "bug_map_files",
1148 srcs: ["bug_map"],
1149}
1150
1151se_bug_map {
1152 name: "plat_bug_map",
1153 srcs: [":bug_map_files"],
1154 stem: "bug_map",
1155}
1156
1157se_bug_map {
1158 name: "system_ext_bug_map",
1159 srcs: [":bug_map_files"],
1160 stem: "bug_map",
1161 system_ext_specific: true,
1162}
1163
1164se_bug_map {
1165 name: "vendor_bug_map",
1166 srcs: [":bug_map_files"],
1167 // Legacy file name of the vendor partition bug_map.
1168 stem: "selinux_denial_metadata",
1169 vendor: true,
1170}
1171
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001172//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001173// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1174// Additional directories can be specified via Makefile variables:
1175// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1176//////////////////////////////////
1177se_freeze_test {
1178 name: "sepolicy_freeze_test",
1179}
Yuntao Xu42e732c2021-11-18 22:33:02 +00001180
1181//////////////////////////////////
1182// Makefile rules temporary imported to Soong
1183// TODO(b/33691272): remove these after migrating seapp to Soong
1184//////////////////////////////////
1185makefile_goal {
1186 name: "plat_seapp_contexts_rule",
1187 product_out_path: "obj/ETC/plat_seapp_contexts_intermediates/plat_seapp_contexts",
1188}
1189
1190makefile_goal {
1191 name: "plat_seapp_neverallows_rule",
1192 product_out_path: "obj/ETC/plat_seapp_neverallows_intermediates/plat_seapp_neverallows",
1193}