blob: 21916b87e25f3d476cf4cf9aa8a7e4e6f76d6168 [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
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900906// vendor/odm sepolicy
907//
908// If BOARD_SEPOLICY_VERS is set to a value other than PLATFORM_SEPOLICY_VERSION,
909// policy files of platform (system, system_ext, product) can't be mixed with
910// policy files of vendor (vendor, odm). If it's the case, platform policies and
911// vendor policies are separately built. More specifically,
912//
913// - Platform policy files needed to build vendor policies, such as plat_policy,
914// plat_mapping_cil, plat_pub_policy, reqd_policy_mask, are built from the
915// prebuilts (copy of platform policy files of version BOARD_SEPOLICY_VERS).
916//
917// - sepolicy_neverallows only checks platform policies, and a new module
918// sepolicy_neverallows_vendor checks vendor policies.
919//
920// - neverallow checks are turned off while compiling precompiled_sepolicy
921// module and sepolicy module.
922//
923// - Vendor policies are not checked on the compat test (compat.mk).
924//
925// In such scenario, we can grab platform policy files from the prebuilts/api
926// directory. But we need more than that: prebuilts of system_ext, product,
927// system/sepolicy/reqd_mask, and system/sepolicy/vendor. The following
928// variables are introduced to specify such prebuilts.
929//
930// - BOARD_REQD_MASK_POLICY (prebuilt of system/sepolicy/reqd_mask)
931// - BOARD_PLAT_VENDOR_POLICY (prebuilt of system/sepolicy/vendor)
932// - BOARD_SYSTEM_EXT_PUBLIC_PREBUILT_DIRS (prebuilt of system_ext public)
933// - BOARD_SYSTEM_EXT_PRIVATE_PREBUILT_DIRS (prebuilt of system_ext private)
934// - BOARD_PRODUCT_PUBLIC_PREBUILT_DIRS (prebuilt of product public)
935// - BOARD_PRODUCT_PRIVATE_PREBUILT_DIRS (prebuilt of product private)
936//
937// Vendors are responsible for copying policy files from the old version of the
938// source tree as prebuilts, and for setting BOARD_*_POLICY variables so they
939// can be used to build vendor policies.
940//
941// To support both mixed build and normal build, platform policy files are
942// indirectly referred as {.(partition)_(scope)_for_vendor}. They will be equal
943// to {.(partition)_scope)} if BOARD_SEPOLICY_VERS == PLATFORM_SEPOLICY_VERSION.
944// Otherwise, they will be equal to the Makefile variables above.
945
946plat_public_policies_for_vendor = [
947 ":se_build_files{.plat_public_for_vendor}",
948 ":se_build_files{.system_ext_public_for_vendor}",
949 ":se_build_files{.product_public_for_vendor}",
950 ":se_build_files{.reqd_mask_for_vendor}",
951]
952
953plat_policies_for_vendor = [
954 ":se_build_files{.plat_public_for_vendor}",
955 ":se_build_files{.plat_private_for_vendor}",
956 ":se_build_files{.system_ext_public_for_vendor}",
957 ":se_build_files{.system_ext_private_for_vendor}",
958 ":se_build_files{.product_public_for_vendor}",
959 ":se_build_files{.product_private_for_vendor}",
960]
961
962se_policy_conf {
963 name: "plat_policy_for_vendor.conf",
964 srcs: plat_policies_for_vendor,
965 installable: false,
966}
967
968se_policy_cil {
969 name: "plat_policy_for_vendor.cil",
970 src: ":plat_policy_for_vendor.conf",
971 additional_cil_files: [":sepolicy_technical_debt{.plat_private_for_vendor}"],
972 installable: false,
973}
974
975se_policy_conf {
976 name: "reqd_policy_mask_for_vendor.conf",
977 srcs: [":se_build_files{.reqd_mask_for_vendor}"],
978 installable: false,
979}
980
981se_policy_cil {
982 name: "reqd_policy_mask_for_vendor.cil",
983 src: ":reqd_policy_mask_for_vendor.conf",
984 secilc_check: false,
985 installable: false,
986}
987
988se_policy_conf {
989 name: "pub_policy_for_vendor.conf",
990 srcs: plat_public_policies_for_vendor,
991 installable: false,
992}
993
994se_policy_cil {
995 name: "pub_policy_for_vendor.cil",
996 src: ":pub_policy_for_vendor.conf",
997 filter_out: [":reqd_policy_mask_for_vendor.cil"],
998 secilc_check: false,
999 installable: false,
1000}
1001
1002se_versioned_policy {
1003 name: "plat_mapping_file_for_vendor",
1004 base: ":pub_policy_for_vendor.cil",
1005 mapping: true,
1006 version: "vendor",
1007 installable: false,
1008}
1009
Inseob Kim039175b2021-03-25 15:37:34 +09001010// plat_pub_versioned.cil - the exported platform policy associated with the version
1011// that non-platform policy targets.
1012se_versioned_policy {
1013 name: "plat_pub_versioned.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001014 base: ":pub_policy_for_vendor.cil",
1015 target_policy: ":pub_policy_for_vendor.cil",
1016 version: "vendor",
Inseob Kim039175b2021-03-25 15:37:34 +09001017 vendor: true,
1018}
1019
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001020// vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
1021// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
1022// policy and the platform public policy files in order to use checkpolicy.
1023se_policy_conf {
1024 name: "vendor_sepolicy.conf",
1025 srcs: plat_public_policies_for_vendor + [
1026 ":se_build_files{.plat_vendor_for_vendor}",
1027 ":se_build_files{.vendor}",
1028 ],
1029 installable: false,
1030}
1031
1032se_policy_cil {
1033 name: "vendor_sepolicy.cil.raw",
1034 src: ":vendor_sepolicy.conf",
1035 filter_out: [":reqd_policy_mask_for_vendor.cil"],
1036 secilc_check: false, // will be done in se_versioned_policy module
1037 installable: false,
1038}
1039
1040se_versioned_policy {
1041 name: "vendor_sepolicy.cil",
1042 base: ":pub_policy_for_vendor.cil",
1043 target_policy: ":vendor_sepolicy.cil.raw",
1044 version: "vendor",
1045 dependent_cils: [
1046 ":plat_policy_for_vendor.cil",
1047 ":plat_pub_versioned.cil",
1048 ":plat_mapping_file_for_vendor",
1049 ],
1050 filter_out: [":plat_pub_versioned.cil"],
1051 vendor: true,
1052}
1053
1054// odm_policy.cil - the odl sepolicy. This needs attributization and to be combined
1055// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
1056// policy and the platform public policy files in order to use checkpolicy.
1057se_policy_conf {
1058 name: "odm_sepolicy.conf",
1059 srcs: plat_public_policies_for_vendor + [
1060 ":se_build_files{.plat_vendor_for_vendor}",
1061 ":se_build_files{.vendor}",
1062 ":se_build_files{.odm}",
1063 ],
1064 installable: false,
1065}
1066
1067se_policy_cil {
1068 name: "odm_sepolicy.cil.raw",
1069 src: ":odm_sepolicy.conf",
1070 filter_out: [
1071 ":reqd_policy_mask_for_vendor.cil",
1072 ":vendor_sepolicy.cil",
1073 ],
1074 secilc_check: false, // will be done in se_versioned_policy module
1075 installable: false,
1076}
1077
1078se_versioned_policy {
1079 name: "odm_sepolicy.cil",
1080 base: ":pub_policy_for_vendor.cil",
1081 target_policy: ":odm_sepolicy.cil.raw",
1082 version: "vendor",
1083 dependent_cils: [
1084 ":plat_policy_for_vendor.cil",
1085 ":plat_pub_versioned.cil",
1086 ":plat_mapping_file_for_vendor",
1087 ":vendor_sepolicy.cil",
1088 ],
1089 filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"],
1090 device_specific: true,
1091}
1092
Inseob Kim039175b2021-03-25 15:37:34 +09001093//////////////////////////////////
1094// Precompiled sepolicy is loaded if and only if:
1095// - plat_sepolicy_and_mapping.sha256 equals
1096// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
1097// AND
1098// - system_ext_sepolicy_and_mapping.sha256 equals
1099// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
1100// AND
1101// - product_sepolicy_and_mapping.sha256 equals
1102// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
1103// See system/core/init/selinux.cpp for details.
1104//////////////////////////////////
1105genrule {
1106 name: "plat_sepolicy_and_mapping.sha256_gen",
1107 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
1108 out: ["plat_sepolicy_and_mapping.sha256"],
1109 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1110}
1111
1112prebuilt_etc {
1113 name: "plat_sepolicy_and_mapping.sha256",
1114 filename: "plat_sepolicy_and_mapping.sha256",
1115 src: ":plat_sepolicy_and_mapping.sha256_gen",
1116 relative_install_path: "selinux",
1117}
1118
1119genrule {
1120 name: "system_ext_sepolicy_and_mapping.sha256_gen",
1121 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
1122 out: ["system_ext_sepolicy_and_mapping.sha256"],
1123 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1124}
1125
1126prebuilt_etc {
1127 name: "system_ext_sepolicy_and_mapping.sha256",
1128 filename: "system_ext_sepolicy_and_mapping.sha256",
1129 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
1130 relative_install_path: "selinux",
1131 system_ext_specific: true,
1132}
1133
1134genrule {
1135 name: "product_sepolicy_and_mapping.sha256_gen",
1136 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
1137 out: ["product_sepolicy_and_mapping.sha256"],
1138 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1139}
1140
1141prebuilt_etc {
1142 name: "product_sepolicy_and_mapping.sha256",
1143 filename: "product_sepolicy_and_mapping.sha256",
1144 src: ":product_sepolicy_and_mapping.sha256_gen",
1145 relative_install_path: "selinux",
1146 product_specific: true,
1147}
1148
Inseob Kim1c056b12021-04-30 00:11:43 +09001149sepolicy_vers {
1150 name: "plat_sepolicy_vers.txt",
1151 version: "vendor",
1152 vendor: true,
1153}
1154
Inseob Kim731182a2021-05-06 11:44:37 +00001155soong_config_module_type {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001156 name: "precompiled_sepolicy_prebuilts_defaults",
Inseob Kim731182a2021-05-06 11:44:37 +00001157 module_type: "prebuilt_defaults",
1158 config_namespace: "ANDROID",
1159 bool_variables: ["BOARD_USES_ODMIMAGE"],
1160 properties: ["vendor", "device_specific"],
1161}
1162
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001163precompiled_sepolicy_prebuilts_defaults {
1164 name: "precompiled_sepolicy_prebuilts",
Inseob Kim731182a2021-05-06 11:44:37 +00001165 soong_config_variables: {
1166 BOARD_USES_ODMIMAGE: {
1167 device_specific: true,
1168 conditions_default: {
1169 vendor: true,
1170 },
1171 },
1172 },
1173}
1174
1175//////////////////////////////////
1176// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
1177// which precompiled_policy was built.
1178//////////////////////////////////
1179prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001180 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001181 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1182 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1183 src: ":plat_sepolicy_and_mapping.sha256_gen",
1184 relative_install_path: "selinux",
1185}
1186
1187//////////////////////////////////
1188// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
1189// which precompiled_policy was built.
1190//////////////////////////////////
1191prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001192 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001193 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1194 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1195 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
1196 relative_install_path: "selinux",
1197}
1198
1199//////////////////////////////////
1200// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
1201// which precompiled_policy was built.
1202//////////////////////////////////
1203prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001204 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001205 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1206 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1207 src: ":product_sepolicy_and_mapping.sha256_gen",
1208 relative_install_path: "selinux",
1209}
1210
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001211soong_config_module_type {
1212 name: "precompiled_se_policy_binary",
1213 module_type: "se_policy_binary",
1214 config_namespace: "ANDROID",
1215 bool_variables: ["BOARD_USES_ODMIMAGE", "IS_TARGET_MIXED_SEPOLICY"],
1216 value_variables: ["MIXED_SEPOLICY_VERSION"],
1217 properties: ["vendor", "device_specific", "srcs", "ignore_neverallow"],
1218}
1219
1220precompiled_se_policy_binary {
1221 name: "precompiled_sepolicy",
1222 srcs: [
1223 ":plat_sepolicy.cil",
1224 ":plat_pub_versioned.cil",
1225 ":system_ext_sepolicy.cil",
1226 ":product_sepolicy.cil",
1227 ":vendor_sepolicy.cil",
1228 ":odm_sepolicy.cil",
1229 ],
1230 soong_config_variables: {
1231 BOARD_USES_ODMIMAGE: {
1232 device_specific: true,
1233 conditions_default: {
1234 vendor: true,
1235 },
1236 },
1237 IS_TARGET_MIXED_SEPOLICY: {
1238 ignore_neverallow: true,
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001239 },
1240 MIXED_SEPOLICY_VERSION: {
1241 srcs: [
1242 ":plat_%s.cil",
1243 ":system_ext_%s.cil",
1244 ":product_%s.cil",
1245 ],
1246 conditions_default: {
1247 srcs: [
1248 ":plat_mapping_file",
1249 ":system_ext_mapping_file",
1250 ":product_mapping_file",
1251 ],
1252 },
1253 },
1254 },
1255}
Inseob Kim731182a2021-05-06 11:44:37 +00001256
Inseob Kima49e7242021-03-22 10:26:13 +09001257//////////////////////////////////
1258// SELinux policy embedded into CTS.
1259// CTS checks neverallow rules of this policy against the policy of the device under test.
1260//////////////////////////////////
1261se_policy_conf {
1262 name: "general_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001263 srcs: plat_public_policy +
1264 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +09001265 build_variant: "user",
1266 cts: true,
1267 exclude_build_test: true,
1268}
Inseob Kimd5816612021-09-15 03:01:05 +00001269
1270//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001271// Base system policy for treble sepolicy tests.
1272// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1273// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1274// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1275// See treble_sepolicy_tests_for_release.mk for more details.
1276//////////////////////////////////
1277se_policy_conf {
1278 name: "base_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001279 srcs: plat_public_policy +
1280 plat_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001281 build_variant: "user",
1282 installable: false,
1283}
1284
1285se_policy_cil {
1286 name: "base_plat_sepolicy.cil",
1287 src: ":base_plat_sepolicy.conf",
1288 additional_cil_files: ["private/technical_debt.cil"],
1289 installable: false,
1290 secilc_check: false, // done by se_policy_binary
1291}
1292
1293se_policy_binary {
1294 name: "base_plat_sepolicy",
1295 srcs: [":base_plat_sepolicy.cil"],
1296 installable: false,
1297}
1298
1299se_policy_conf {
1300 name: "base_system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001301 srcs: plat_public_policy +
1302 plat_private_policy +
1303 system_ext_public_policy +
1304 system_ext_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001305 build_variant: "user",
1306 installable: false,
1307}
1308
1309se_policy_cil {
1310 name: "base_system_ext_sepolicy.cil",
1311 src: ":base_system_ext_sepolicy.conf",
1312 additional_cil_files: ["private/technical_debt.cil"],
1313 system_ext_specific: true,
1314 installable: false,
1315 secilc_check: false, // done by se_policy_binary
1316}
1317
1318se_policy_binary {
1319 name: "base_system_ext_sepolicy",
1320 srcs: [":base_system_ext_sepolicy.cil"],
1321 system_ext_specific: true,
1322 installable: false,
1323}
1324
1325se_policy_conf {
1326 name: "base_product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001327 srcs: plat_public_policy +
1328 plat_private_policy +
1329 system_ext_public_policy +
1330 system_ext_private_policy +
1331 product_public_policy +
1332 product_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001333 build_variant: "user",
1334 installable: false,
1335}
1336
1337se_policy_cil {
1338 name: "base_product_sepolicy.cil",
1339 src: ":base_product_sepolicy.conf",
1340 additional_cil_files: ["private/technical_debt.cil"],
1341 product_specific: true,
1342 installable: false,
1343 secilc_check: false, // done by se_policy_binary
1344}
1345
1346se_policy_binary {
1347 name: "base_product_sepolicy",
1348 srcs: [":base_product_sepolicy.cil"],
1349 product_specific: true,
1350 installable: false,
1351}
1352
1353se_policy_conf {
1354 name: "base_plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001355 srcs: plat_public_policy +
1356 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001357 build_variant: "user",
1358 installable: false,
1359}
1360
1361se_policy_cil {
1362 name: "base_plat_pub_policy.cil",
1363 src: ":base_plat_pub_policy.conf",
1364 filter_out: [":reqd_policy_mask.cil"],
1365 secilc_check: false,
1366 installable: false,
1367}
1368
1369se_policy_conf {
1370 name: "base_system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001371 srcs: plat_public_policy +
1372 system_ext_public_policy +
1373 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001374 build_variant: "user",
1375 installable: false,
1376}
1377
1378se_policy_cil {
1379 name: "base_system_ext_pub_policy.cil",
1380 src: ":base_system_ext_pub_policy.conf",
1381 filter_out: [":reqd_policy_mask.cil"],
1382 secilc_check: false,
1383 installable: false,
1384}
1385
1386se_policy_conf {
1387 name: "base_product_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001388 srcs: plat_public_policy +
1389 system_ext_public_policy +
1390 product_public_policy +
1391 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001392 build_variant: "user",
1393 installable: false,
1394}
1395
1396se_policy_cil {
1397 name: "base_product_pub_policy.cil",
1398 src: ":base_product_pub_policy.conf",
1399 filter_out: [":reqd_policy_mask.cil"],
1400 secilc_check: false,
1401 installable: false,
1402}
1403
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001404// bug_map - Bug tracking information for selinux denials loaded by auditd.
1405se_filegroup {
1406 name: "bug_map_files",
1407 srcs: ["bug_map"],
1408}
1409
1410se_bug_map {
1411 name: "plat_bug_map",
1412 srcs: [":bug_map_files"],
1413 stem: "bug_map",
1414}
1415
1416se_bug_map {
1417 name: "system_ext_bug_map",
1418 srcs: [":bug_map_files"],
1419 stem: "bug_map",
1420 system_ext_specific: true,
1421}
1422
1423se_bug_map {
1424 name: "vendor_bug_map",
1425 srcs: [":bug_map_files"],
1426 // Legacy file name of the vendor partition bug_map.
1427 stem: "selinux_denial_metadata",
1428 vendor: true,
1429}
1430
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001431//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001432// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1433// Additional directories can be specified via Makefile variables:
1434// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1435//////////////////////////////////
1436se_freeze_test {
1437 name: "sepolicy_freeze_test",
1438}
Yuntao Xu42e732c2021-11-18 22:33:02 +00001439
1440//////////////////////////////////
1441// Makefile rules temporary imported to Soong
1442// TODO(b/33691272): remove these after migrating seapp to Soong
1443//////////////////////////////////
1444makefile_goal {
1445 name: "plat_seapp_contexts_rule",
1446 product_out_path: "obj/ETC/plat_seapp_contexts_intermediates/plat_seapp_contexts",
1447}
1448
1449makefile_goal {
1450 name: "plat_seapp_neverallows_rule",
1451 product_out_path: "obj/ETC/plat_seapp_neverallows_intermediates/plat_seapp_neverallows",
1452}