blob: 0e85944ca9afea911a739f8a94e86aa591854c8b [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 Kim6d3d5a62021-12-21 20:55:32 +0900399se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900400 name: "file_contexts_files",
401 srcs: ["file_contexts"],
402}
403
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900404se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900405 name: "file_contexts_asan_files",
406 srcs: ["file_contexts_asan"],
407}
408
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900409se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900410 name: "file_contexts_overlayfs_files",
411 srcs: ["file_contexts_overlayfs"],
412}
413
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900414se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900415 name: "hwservice_contexts_files",
416 srcs: ["hwservice_contexts"],
417}
418
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900419se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900420 name: "property_contexts_files",
421 srcs: ["property_contexts"],
422}
423
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900424se_build_files {
Inseob Kimb554e592019-04-15 20:10:46 +0900425 name: "service_contexts_files",
426 srcs: ["service_contexts"],
427}
428
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900429se_build_files {
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700430 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",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900436 srcs: [":file_contexts_files{.plat_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900437 product_variables: {
438 address_sanitize: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900439 srcs: [":file_contexts_asan_files{.plat_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900440 },
441 debuggable: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900442 srcs: [":file_contexts_overlayfs_files{.plat_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900443 },
444 },
445
446 flatten_apex: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900447 srcs: [":apex_file_contexts_files"],
Inseob Kimb554e592019-04-15 20:10:46 +0900448 },
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",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900453 srcs: [":file_contexts_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000454 stem: "plat_file_contexts",
455 product_variables: {
456 address_sanitize: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900457 srcs: [":file_contexts_asan_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000458 },
459 debuggable: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900460 srcs: [":file_contexts_overlayfs_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000461 },
462 },
463
464 flatten_apex: {
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900465 srcs: [":apex_file_contexts_files"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000466 },
467
468 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900469}
470
471file_contexts {
472 name: "vendor_file_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900473 srcs: [
474 ":file_contexts_files{.plat_vendor_for_vendor}",
475 ":file_contexts_files{.vendor}",
476 ],
Inseob Kimb554e592019-04-15 20:10:46 +0900477 soc_specific: true,
478 recovery_available: true,
479}
480
481file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800482 name: "system_ext_file_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900483 srcs: [":file_contexts_files{.system_ext_private}"],
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800484 system_ext_specific: true,
485 recovery_available: true,
486}
487
488file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900489 name: "product_file_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900490 srcs: [":file_contexts_files{.product_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900491 product_specific: true,
492 recovery_available: true,
493}
494
495file_contexts {
496 name: "odm_file_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900497 srcs: [":file_contexts_files{.odm}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900498 device_specific: true,
499 recovery_available: true,
500}
501
502hwservice_contexts {
503 name: "plat_hwservice_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900504 srcs: [":hwservice_contexts_files{.plat_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900505}
506
507hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800508 name: "system_ext_hwservice_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900509 srcs: [":hwservice_contexts_files{.system_ext_private}"],
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800510 system_ext_specific: true,
511}
512
513hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900514 name: "product_hwservice_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900515 srcs: [":hwservice_contexts_files{.product_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900516 product_specific: true,
517}
518
519hwservice_contexts {
520 name: "vendor_hwservice_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900521 srcs: [
522 ":hwservice_contexts_files{.plat_vendor_for_vendor}",
523 ":hwservice_contexts_files{.vendor}",
524 ":hwservice_contexts_files{.reqd_mask_for_vendor}",
525 ],
Inseob Kimb554e592019-04-15 20:10:46 +0900526 soc_specific: true,
527}
528
529hwservice_contexts {
530 name: "odm_hwservice_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900531 srcs: [":hwservice_contexts_files{.odm}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900532 device_specific: true,
533}
534
535property_contexts {
536 name: "plat_property_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900537 srcs: [":property_contexts_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000538}
539
540property_contexts {
541 name: "plat_property_contexts.recovery",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900542 srcs: [":property_contexts_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000543 stem: "plat_property_contexts",
544 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900545}
546
547property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800548 name: "system_ext_property_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900549 srcs: [":property_contexts_files{.system_ext_private}"],
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800550 system_ext_specific: true,
551 recovery_available: true,
552}
553
554property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900555 name: "product_property_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900556 srcs: [":property_contexts_files{.product_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900557 product_specific: true,
558 recovery_available: true,
559}
560
561property_contexts {
562 name: "vendor_property_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900563 srcs: [
564 ":property_contexts_files{.plat_vendor_for_vendor}",
565 ":property_contexts_files{.vendor}",
566 ":property_contexts_files{.reqd_mask_for_vendor}",
567 ],
Inseob Kimb554e592019-04-15 20:10:46 +0900568 soc_specific: true,
569 recovery_available: true,
570}
571
572property_contexts {
573 name: "odm_property_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900574 srcs: [":property_contexts_files{.odm}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900575 device_specific: true,
576 recovery_available: true,
577}
578
579service_contexts {
580 name: "plat_service_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900581 srcs: [":service_contexts_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000582}
583
584service_contexts {
585 name: "plat_service_contexts.recovery",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900586 srcs: [":service_contexts_files{.plat_private}"],
Yuntao Xu42e732c2021-11-18 22:33:02 +0000587 stem: "plat_service_contexts",
588 recovery: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900589}
590
591service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800592 name: "system_ext_service_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900593 srcs: [":service_contexts_files{.system_ext_private}"],
Bowgo Tsai98231162019-09-09 22:05:29 +0800594 system_ext_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800595 recovery_available: true,
Bowgo Tsai98231162019-09-09 22:05:29 +0800596}
597
598service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900599 name: "product_service_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900600 srcs: [":service_contexts_files{.product_private}"],
Inseob Kimb554e592019-04-15 20:10:46 +0900601 product_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800602 recovery_available: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900603}
604
605service_contexts {
606 name: "vendor_service_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900607 srcs: [
608 ":service_contexts_files{.plat_vendor_for_vendor}",
609 ":service_contexts_files{.vendor}",
610 ":service_contexts_files{.reqd_mask_for_vendor}",
611 ],
Inseob Kimb554e592019-04-15 20:10:46 +0900612 soc_specific: true,
Yifan Hongd6b29012021-11-13 00:22:01 -0800613 recovery_available: true,
Inseob Kimb554e592019-04-15 20:10:46 +0900614}
yangbill3e345372020-04-15 13:55:47 +0800615
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700616keystore2_key_contexts {
617 name: "plat_keystore2_key_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900618 srcs: [":keystore2_key_contexts_files{.plat_private}"],
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700619}
620
621keystore2_key_contexts {
622 name: "system_keystore2_key_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900623 srcs: [":keystore2_key_contexts_files{.system_ext_private}"],
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700624 system_ext_specific: true,
625}
626
627keystore2_key_contexts {
628 name: "product_keystore2_key_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900629 srcs: [":keystore2_key_contexts_files{.product_private}"],
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700630 product_specific: true,
631}
632
633keystore2_key_contexts {
634 name: "vendor_keystore2_key_contexts",
Inseob Kim6d3d5a62021-12-21 20:55:32 +0900635 srcs: [
636 ":keystore2_key_contexts_files{.plat_vendor_for_vendor}",
637 ":keystore2_key_contexts_files{.vendor}",
638 ":keystore2_key_contexts_files{.reqd_mask_for_vendor}",
639 ],
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700640 soc_specific: true,
641}
642
yangbill3e345372020-04-15 13:55:47 +0800643// For vts_treble_sys_prop_test
644filegroup {
645 name: "private_property_contexts",
646 srcs: ["private/property_contexts"],
647 visibility: [
648 "//test/vts-testcase/security/system_property",
649 ],
650}
Inseob Kime35b49b2021-02-18 19:15:41 +0900651
Inseob Kima49e7242021-03-22 10:26:13 +0900652se_build_files {
653 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900654 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900655 "security_classes",
656 "initial_sids",
657 "access_vectors",
658 "global_macros",
659 "neverallow_macros",
660 "mls_macros",
661 "mls_decl",
662 "mls",
663 "policy_capabilities",
664 "te_macros",
665 "attributes",
666 "ioctl_defines",
667 "ioctl_macros",
668 "*.te",
669 "roles_decl",
670 "roles",
671 "users",
672 "initial_sid_contexts",
673 "fs_use",
674 "genfs_contexts",
675 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900676 ],
677}
678
Inseob Kim7cb20812021-12-16 16:52:14 +0900679se_build_files {
680 name: "sepolicy_technical_debt",
681 srcs: ["technical_debt.cil"],
682}
683
Inseob Kim0a707fa2021-12-09 23:35:11 +0900684reqd_mask_policy = [":se_build_files{.reqd_mask}"]
685plat_public_policy = [":se_build_files{.plat_public}"]
686plat_private_policy = [":se_build_files{.plat_private}"]
687system_ext_public_policy = [":se_build_files{.system_ext_public}"]
688system_ext_private_policy = [":se_build_files{.system_ext_private}"]
689product_public_policy = [":se_build_files{.product_public}"]
690product_private_policy = [":se_build_files{.product_private}"]
691
Inseob Kima49e7242021-03-22 10:26:13 +0900692// reqd_policy_mask - a policy.conf file which contains only the bare minimum
693// policy necessary to use checkpolicy.
694//
695// This bare-minimum policy needs to be present in all policy.conf files, but
696// should not necessarily be exported as part of the public policy.
697//
698// The rules generated by reqd_policy_mask will allow the compilation of public
699// policy and subsequent removal of CIL policy that should not be exported.
700se_policy_conf {
701 name: "reqd_policy_mask.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900702 srcs: reqd_mask_policy,
Inseob Kime35b49b2021-02-18 19:15:41 +0900703 installable: false,
704}
705
Inseob Kima49e7242021-03-22 10:26:13 +0900706se_policy_cil {
707 name: "reqd_policy_mask.cil",
708 src: ":reqd_policy_mask.conf",
709 secilc_check: false,
710 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900711}
712
Inseob Kima49e7242021-03-22 10:26:13 +0900713// pub_policy - policy that will be exported to be a part of non-platform
714// policy corresponding to this platform version.
715//
716// This is a limited subset of policy that would not compile in checkpolicy on
717// its own.
718//
719// To get around this limitation, add only the required files from private
720// policy, which will generate CIL policy that will then be filtered out by the
721// reqd_policy_mask.
722//
723// There are three pub_policy.cil files below:
724// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
725// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
726// - plat_pub_policy.cil: exported 'system' policy.
727//
728// Those above files will in turn be used to generate the following versioned cil files:
729// - product_mapping_file: the versioned, exported 'product' policy in product partition.
730// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
731// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
732// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
733// in vendor partition.
734//
735se_policy_conf {
736 name: "pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900737 srcs: plat_public_policy +
738 system_ext_public_policy +
739 product_public_policy +
740 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900741 installable: false,
742}
743
744se_policy_cil {
745 name: "pub_policy.cil",
746 src: ":pub_policy.conf",
747 filter_out: [":reqd_policy_mask.cil"],
748 secilc_check: false,
749 installable: false,
750}
751
752se_policy_conf {
753 name: "system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900754 srcs: plat_public_policy +
755 system_ext_public_policy +
756 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900757 installable: false,
758}
759
760se_policy_cil {
761 name: "system_ext_pub_policy.cil",
762 src: ":system_ext_pub_policy.conf",
763 filter_out: [":reqd_policy_mask.cil"],
764 secilc_check: false,
765 installable: false,
766}
767
768se_policy_conf {
769 name: "plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900770 srcs: plat_public_policy +
771 reqd_mask_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900772 installable: false,
773}
774
775se_policy_cil {
776 name: "plat_pub_policy.cil",
777 src: ":plat_pub_policy.conf",
778 filter_out: [":reqd_policy_mask.cil"],
779 secilc_check: false,
780 installable: false,
781}
782
783// plat_policy.conf - A combination of the private and public platform policy
784// which will ship with the device.
785//
786// The platform will always reflect the most recent platform version and is not
787// currently being attributized.
788se_policy_conf {
789 name: "plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900790 srcs: plat_public_policy +
791 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900792 installable: false,
793}
794
795se_policy_cil {
796 name: "plat_sepolicy.cil",
797 src: ":plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900798 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kima49e7242021-03-22 10:26:13 +0900799}
800
Inseob Kim6cc75f42021-04-29 13:53:20 +0000801// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
802se_policy_conf {
803 name: "userdebug_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900804 srcs: plat_public_policy +
805 plat_private_policy,
Inseob Kim6cc75f42021-04-29 13:53:20 +0000806 build_variant: "userdebug",
807 installable: false,
808}
809
810se_policy_cil {
811 name: "userdebug_plat_sepolicy.cil",
812 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900813 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Inseob Kim6cc75f42021-04-29 13:53:20 +0000814 debug_ramdisk: true,
Yi-Yo Chiang68478b12021-10-16 03:23:05 +0800815 dist: {
816 targets: ["droidcore"],
817 },
Inseob Kim6cc75f42021-04-29 13:53:20 +0000818}
819
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000820// A copy of the userdebug_plat_policy in GSI.
821soong_config_module_type {
822 name: "gsi_se_policy_cil",
823 module_type: "se_policy_cil",
824 config_namespace: "ANDROID",
825 bool_variables: [
826 "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
827 ],
828 properties: [
829 "enabled",
830 "installable",
831 ],
832}
833
834gsi_se_policy_cil {
835 name: "system_ext_userdebug_plat_sepolicy.cil",
836 stem: "userdebug_plat_sepolicy.cil",
837 src: ":userdebug_plat_sepolicy.conf",
Inseob Kim7cb20812021-12-16 16:52:14 +0900838 additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
Yi-Yo Chiang857ffc42021-09-23 14:14:16 +0000839 system_ext_specific: true,
840 enabled: false,
841 installable: false,
842 soong_config_variables: {
843 PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
844 enabled: true,
845 installable: true,
846 },
847 },
848}
849
Inseob Kima49e7242021-03-22 10:26:13 +0900850// system_ext_policy.conf - A combination of the private and public system_ext
851// policy which will ship with the device. System_ext policy is not attributized
852se_policy_conf {
853 name: "system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900854 srcs: plat_public_policy +
855 plat_private_policy +
856 system_ext_public_policy +
857 system_ext_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900858 installable: false,
859}
860
861se_policy_cil {
862 name: "system_ext_sepolicy.cil",
863 src: ":system_ext_sepolicy.conf",
864 system_ext_specific: true,
865 filter_out: [":plat_sepolicy.cil"],
866 remove_line_marker: true,
867}
868
869// product_policy.conf - A combination of the private and public product policy
870// which will ship with the device. Product policy is not attributized
871se_policy_conf {
872 name: "product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +0900873 srcs: plat_public_policy +
874 plat_private_policy +
875 system_ext_public_policy +
876 system_ext_private_policy +
877 product_public_policy +
878 product_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +0900879 installable: false,
880}
881
882se_policy_cil {
883 name: "product_sepolicy.cil",
884 src: ":product_sepolicy.conf",
885 product_specific: true,
886 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
887 remove_line_marker: true,
888}
889
Inseob Kim039175b2021-03-25 15:37:34 +0900890// policy mapping files
891// auto-generate the mapping file for current platform policy, since it needs to
892// track platform policy development
893se_versioned_policy {
894 name: "plat_mapping_file",
895 base: ":plat_pub_policy.cil",
896 mapping: true,
897 version: "current",
898 relative_install_path: "mapping", // install to /system/etc/selinux/mapping
899}
900
901se_versioned_policy {
902 name: "system_ext_mapping_file",
903 base: ":system_ext_pub_policy.cil",
904 mapping: true,
905 version: "current",
906 filter_out: [":plat_mapping_file"],
907 relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
908 system_ext_specific: true,
909}
910
911se_versioned_policy {
912 name: "product_mapping_file",
913 base: ":pub_policy.cil",
914 mapping: true,
915 version: "current",
916 filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
917 relative_install_path: "mapping", // install to /product/etc/selinux/mapping
918 product_specific: true,
919}
920
Inseob Kim3ac62fe2021-12-16 19:00:03 +0900921// vendor/odm sepolicy
922//
923// If BOARD_SEPOLICY_VERS is set to a value other than PLATFORM_SEPOLICY_VERSION,
924// policy files of platform (system, system_ext, product) can't be mixed with
925// policy files of vendor (vendor, odm). If it's the case, platform policies and
926// vendor policies are separately built. More specifically,
927//
928// - Platform policy files needed to build vendor policies, such as plat_policy,
929// plat_mapping_cil, plat_pub_policy, reqd_policy_mask, are built from the
930// prebuilts (copy of platform policy files of version BOARD_SEPOLICY_VERS).
931//
932// - sepolicy_neverallows only checks platform policies, and a new module
933// sepolicy_neverallows_vendor checks vendor policies.
934//
935// - neverallow checks are turned off while compiling precompiled_sepolicy
936// module and sepolicy module.
937//
938// - Vendor policies are not checked on the compat test (compat.mk).
939//
940// In such scenario, we can grab platform policy files from the prebuilts/api
941// directory. But we need more than that: prebuilts of system_ext, product,
942// system/sepolicy/reqd_mask, and system/sepolicy/vendor. The following
943// variables are introduced to specify such prebuilts.
944//
945// - BOARD_REQD_MASK_POLICY (prebuilt of system/sepolicy/reqd_mask)
946// - BOARD_PLAT_VENDOR_POLICY (prebuilt of system/sepolicy/vendor)
947// - BOARD_SYSTEM_EXT_PUBLIC_PREBUILT_DIRS (prebuilt of system_ext public)
948// - BOARD_SYSTEM_EXT_PRIVATE_PREBUILT_DIRS (prebuilt of system_ext private)
949// - BOARD_PRODUCT_PUBLIC_PREBUILT_DIRS (prebuilt of product public)
950// - BOARD_PRODUCT_PRIVATE_PREBUILT_DIRS (prebuilt of product private)
951//
952// Vendors are responsible for copying policy files from the old version of the
953// source tree as prebuilts, and for setting BOARD_*_POLICY variables so they
954// can be used to build vendor policies.
955//
956// To support both mixed build and normal build, platform policy files are
957// indirectly referred as {.(partition)_(scope)_for_vendor}. They will be equal
958// to {.(partition)_scope)} if BOARD_SEPOLICY_VERS == PLATFORM_SEPOLICY_VERSION.
959// Otherwise, they will be equal to the Makefile variables above.
960
961plat_public_policies_for_vendor = [
962 ":se_build_files{.plat_public_for_vendor}",
963 ":se_build_files{.system_ext_public_for_vendor}",
964 ":se_build_files{.product_public_for_vendor}",
965 ":se_build_files{.reqd_mask_for_vendor}",
966]
967
968plat_policies_for_vendor = [
969 ":se_build_files{.plat_public_for_vendor}",
970 ":se_build_files{.plat_private_for_vendor}",
971 ":se_build_files{.system_ext_public_for_vendor}",
972 ":se_build_files{.system_ext_private_for_vendor}",
973 ":se_build_files{.product_public_for_vendor}",
974 ":se_build_files{.product_private_for_vendor}",
975]
976
977se_policy_conf {
978 name: "plat_policy_for_vendor.conf",
979 srcs: plat_policies_for_vendor,
980 installable: false,
981}
982
983se_policy_cil {
984 name: "plat_policy_for_vendor.cil",
985 src: ":plat_policy_for_vendor.conf",
986 additional_cil_files: [":sepolicy_technical_debt{.plat_private_for_vendor}"],
987 installable: false,
988}
989
990se_policy_conf {
991 name: "reqd_policy_mask_for_vendor.conf",
992 srcs: [":se_build_files{.reqd_mask_for_vendor}"],
993 installable: false,
994}
995
996se_policy_cil {
997 name: "reqd_policy_mask_for_vendor.cil",
998 src: ":reqd_policy_mask_for_vendor.conf",
999 secilc_check: false,
1000 installable: false,
1001}
1002
1003se_policy_conf {
1004 name: "pub_policy_for_vendor.conf",
1005 srcs: plat_public_policies_for_vendor,
1006 installable: false,
1007}
1008
1009se_policy_cil {
1010 name: "pub_policy_for_vendor.cil",
1011 src: ":pub_policy_for_vendor.conf",
1012 filter_out: [":reqd_policy_mask_for_vendor.cil"],
1013 secilc_check: false,
1014 installable: false,
1015}
1016
1017se_versioned_policy {
1018 name: "plat_mapping_file_for_vendor",
1019 base: ":pub_policy_for_vendor.cil",
1020 mapping: true,
1021 version: "vendor",
1022 installable: false,
1023}
1024
Inseob Kim039175b2021-03-25 15:37:34 +09001025// plat_pub_versioned.cil - the exported platform policy associated with the version
1026// that non-platform policy targets.
1027se_versioned_policy {
1028 name: "plat_pub_versioned.cil",
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001029 base: ":pub_policy_for_vendor.cil",
1030 target_policy: ":pub_policy_for_vendor.cil",
1031 version: "vendor",
Inseob Kim039175b2021-03-25 15:37:34 +09001032 vendor: true,
1033}
1034
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001035// vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
1036// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
1037// policy and the platform public policy files in order to use checkpolicy.
1038se_policy_conf {
1039 name: "vendor_sepolicy.conf",
1040 srcs: plat_public_policies_for_vendor + [
1041 ":se_build_files{.plat_vendor_for_vendor}",
1042 ":se_build_files{.vendor}",
1043 ],
1044 installable: false,
1045}
1046
1047se_policy_cil {
1048 name: "vendor_sepolicy.cil.raw",
1049 src: ":vendor_sepolicy.conf",
1050 filter_out: [":reqd_policy_mask_for_vendor.cil"],
1051 secilc_check: false, // will be done in se_versioned_policy module
1052 installable: false,
1053}
1054
1055se_versioned_policy {
1056 name: "vendor_sepolicy.cil",
1057 base: ":pub_policy_for_vendor.cil",
1058 target_policy: ":vendor_sepolicy.cil.raw",
1059 version: "vendor",
1060 dependent_cils: [
1061 ":plat_policy_for_vendor.cil",
1062 ":plat_pub_versioned.cil",
1063 ":plat_mapping_file_for_vendor",
1064 ],
1065 filter_out: [":plat_pub_versioned.cil"],
1066 vendor: true,
1067}
1068
1069// odm_policy.cil - the odl sepolicy. This needs attributization and to be combined
1070// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
1071// policy and the platform public policy files in order to use checkpolicy.
1072se_policy_conf {
1073 name: "odm_sepolicy.conf",
1074 srcs: plat_public_policies_for_vendor + [
1075 ":se_build_files{.plat_vendor_for_vendor}",
1076 ":se_build_files{.vendor}",
1077 ":se_build_files{.odm}",
1078 ],
1079 installable: false,
1080}
1081
1082se_policy_cil {
1083 name: "odm_sepolicy.cil.raw",
1084 src: ":odm_sepolicy.conf",
1085 filter_out: [
1086 ":reqd_policy_mask_for_vendor.cil",
1087 ":vendor_sepolicy.cil",
1088 ],
1089 secilc_check: false, // will be done in se_versioned_policy module
1090 installable: false,
1091}
1092
1093se_versioned_policy {
1094 name: "odm_sepolicy.cil",
1095 base: ":pub_policy_for_vendor.cil",
1096 target_policy: ":odm_sepolicy.cil.raw",
1097 version: "vendor",
1098 dependent_cils: [
1099 ":plat_policy_for_vendor.cil",
1100 ":plat_pub_versioned.cil",
1101 ":plat_mapping_file_for_vendor",
1102 ":vendor_sepolicy.cil",
1103 ],
1104 filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"],
1105 device_specific: true,
1106}
1107
Inseob Kim039175b2021-03-25 15:37:34 +09001108//////////////////////////////////
1109// Precompiled sepolicy is loaded if and only if:
1110// - plat_sepolicy_and_mapping.sha256 equals
1111// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
1112// AND
1113// - system_ext_sepolicy_and_mapping.sha256 equals
1114// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
1115// AND
1116// - product_sepolicy_and_mapping.sha256 equals
1117// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
1118// See system/core/init/selinux.cpp for details.
1119//////////////////////////////////
1120genrule {
1121 name: "plat_sepolicy_and_mapping.sha256_gen",
1122 srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
1123 out: ["plat_sepolicy_and_mapping.sha256"],
1124 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1125}
1126
1127prebuilt_etc {
1128 name: "plat_sepolicy_and_mapping.sha256",
1129 filename: "plat_sepolicy_and_mapping.sha256",
1130 src: ":plat_sepolicy_and_mapping.sha256_gen",
1131 relative_install_path: "selinux",
1132}
1133
1134genrule {
1135 name: "system_ext_sepolicy_and_mapping.sha256_gen",
1136 srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
1137 out: ["system_ext_sepolicy_and_mapping.sha256"],
1138 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1139}
1140
1141prebuilt_etc {
1142 name: "system_ext_sepolicy_and_mapping.sha256",
1143 filename: "system_ext_sepolicy_and_mapping.sha256",
1144 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
1145 relative_install_path: "selinux",
1146 system_ext_specific: true,
1147}
1148
1149genrule {
1150 name: "product_sepolicy_and_mapping.sha256_gen",
1151 srcs: [":product_sepolicy.cil", ":product_mapping_file"],
1152 out: ["product_sepolicy_and_mapping.sha256"],
1153 cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
1154}
1155
1156prebuilt_etc {
1157 name: "product_sepolicy_and_mapping.sha256",
1158 filename: "product_sepolicy_and_mapping.sha256",
1159 src: ":product_sepolicy_and_mapping.sha256_gen",
1160 relative_install_path: "selinux",
1161 product_specific: true,
1162}
1163
Inseob Kim1c056b12021-04-30 00:11:43 +09001164sepolicy_vers {
1165 name: "plat_sepolicy_vers.txt",
1166 version: "vendor",
1167 vendor: true,
1168}
1169
Inseob Kim731182a2021-05-06 11:44:37 +00001170soong_config_module_type {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001171 name: "precompiled_sepolicy_prebuilts_defaults",
Inseob Kim731182a2021-05-06 11:44:37 +00001172 module_type: "prebuilt_defaults",
1173 config_namespace: "ANDROID",
1174 bool_variables: ["BOARD_USES_ODMIMAGE"],
1175 properties: ["vendor", "device_specific"],
1176}
1177
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001178precompiled_sepolicy_prebuilts_defaults {
1179 name: "precompiled_sepolicy_prebuilts",
Inseob Kim731182a2021-05-06 11:44:37 +00001180 soong_config_variables: {
1181 BOARD_USES_ODMIMAGE: {
1182 device_specific: true,
1183 conditions_default: {
1184 vendor: true,
1185 },
1186 },
1187 },
1188}
1189
1190//////////////////////////////////
1191// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
1192// which precompiled_policy was built.
1193//////////////////////////////////
1194prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001195 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001196 name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1197 filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
1198 src: ":plat_sepolicy_and_mapping.sha256_gen",
1199 relative_install_path: "selinux",
1200}
1201
1202//////////////////////////////////
1203// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
1204// which precompiled_policy was built.
1205//////////////////////////////////
1206prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001207 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001208 name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1209 filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
1210 src: ":system_ext_sepolicy_and_mapping.sha256_gen",
1211 relative_install_path: "selinux",
1212}
1213
1214//////////////////////////////////
1215// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
1216// which precompiled_policy was built.
1217//////////////////////////////////
1218prebuilt_etc {
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001219 defaults: ["precompiled_sepolicy_prebuilts"],
Inseob Kim731182a2021-05-06 11:44:37 +00001220 name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1221 filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
1222 src: ":product_sepolicy_and_mapping.sha256_gen",
1223 relative_install_path: "selinux",
1224}
1225
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001226soong_config_module_type {
1227 name: "precompiled_se_policy_binary",
1228 module_type: "se_policy_binary",
1229 config_namespace: "ANDROID",
1230 bool_variables: ["BOARD_USES_ODMIMAGE", "IS_TARGET_MIXED_SEPOLICY"],
1231 value_variables: ["MIXED_SEPOLICY_VERSION"],
1232 properties: ["vendor", "device_specific", "srcs", "ignore_neverallow"],
1233}
1234
1235precompiled_se_policy_binary {
1236 name: "precompiled_sepolicy",
1237 srcs: [
1238 ":plat_sepolicy.cil",
1239 ":plat_pub_versioned.cil",
1240 ":system_ext_sepolicy.cil",
1241 ":product_sepolicy.cil",
1242 ":vendor_sepolicy.cil",
1243 ":odm_sepolicy.cil",
1244 ],
1245 soong_config_variables: {
1246 BOARD_USES_ODMIMAGE: {
1247 device_specific: true,
1248 conditions_default: {
1249 vendor: true,
1250 },
1251 },
1252 IS_TARGET_MIXED_SEPOLICY: {
1253 ignore_neverallow: true,
Inseob Kim3ac62fe2021-12-16 19:00:03 +09001254 },
1255 MIXED_SEPOLICY_VERSION: {
1256 srcs: [
1257 ":plat_%s.cil",
1258 ":system_ext_%s.cil",
1259 ":product_%s.cil",
1260 ],
1261 conditions_default: {
1262 srcs: [
1263 ":plat_mapping_file",
1264 ":system_ext_mapping_file",
1265 ":product_mapping_file",
1266 ],
1267 },
1268 },
1269 },
1270}
Inseob Kim731182a2021-05-06 11:44:37 +00001271
Inseob Kima49e7242021-03-22 10:26:13 +09001272//////////////////////////////////
1273// SELinux policy embedded into CTS.
1274// CTS checks neverallow rules of this policy against the policy of the device under test.
1275//////////////////////////////////
1276se_policy_conf {
1277 name: "general_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001278 srcs: plat_public_policy +
1279 plat_private_policy,
Inseob Kima49e7242021-03-22 10:26:13 +09001280 build_variant: "user",
1281 cts: true,
1282 exclude_build_test: true,
1283}
Inseob Kimd5816612021-09-15 03:01:05 +00001284
1285//////////////////////////////////
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001286// Base system policy for treble sepolicy tests.
1287// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
1288// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
1289// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
1290// See treble_sepolicy_tests_for_release.mk for more details.
1291//////////////////////////////////
1292se_policy_conf {
1293 name: "base_plat_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001294 srcs: plat_public_policy +
1295 plat_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001296 build_variant: "user",
1297 installable: false,
1298}
1299
1300se_policy_cil {
1301 name: "base_plat_sepolicy.cil",
1302 src: ":base_plat_sepolicy.conf",
1303 additional_cil_files: ["private/technical_debt.cil"],
1304 installable: false,
1305 secilc_check: false, // done by se_policy_binary
1306}
1307
1308se_policy_binary {
1309 name: "base_plat_sepolicy",
1310 srcs: [":base_plat_sepolicy.cil"],
1311 installable: false,
1312}
1313
1314se_policy_conf {
1315 name: "base_system_ext_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001316 srcs: plat_public_policy +
1317 plat_private_policy +
1318 system_ext_public_policy +
1319 system_ext_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001320 build_variant: "user",
1321 installable: false,
1322}
1323
1324se_policy_cil {
1325 name: "base_system_ext_sepolicy.cil",
1326 src: ":base_system_ext_sepolicy.conf",
1327 additional_cil_files: ["private/technical_debt.cil"],
1328 system_ext_specific: true,
1329 installable: false,
1330 secilc_check: false, // done by se_policy_binary
1331}
1332
1333se_policy_binary {
1334 name: "base_system_ext_sepolicy",
1335 srcs: [":base_system_ext_sepolicy.cil"],
1336 system_ext_specific: true,
1337 installable: false,
1338}
1339
1340se_policy_conf {
1341 name: "base_product_sepolicy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001342 srcs: plat_public_policy +
1343 plat_private_policy +
1344 system_ext_public_policy +
1345 system_ext_private_policy +
1346 product_public_policy +
1347 product_private_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001348 build_variant: "user",
1349 installable: false,
1350}
1351
1352se_policy_cil {
1353 name: "base_product_sepolicy.cil",
1354 src: ":base_product_sepolicy.conf",
1355 additional_cil_files: ["private/technical_debt.cil"],
1356 product_specific: true,
1357 installable: false,
1358 secilc_check: false, // done by se_policy_binary
1359}
1360
1361se_policy_binary {
1362 name: "base_product_sepolicy",
1363 srcs: [":base_product_sepolicy.cil"],
1364 product_specific: true,
1365 installable: false,
1366}
1367
1368se_policy_conf {
1369 name: "base_plat_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001370 srcs: plat_public_policy +
1371 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001372 build_variant: "user",
1373 installable: false,
1374}
1375
1376se_policy_cil {
1377 name: "base_plat_pub_policy.cil",
1378 src: ":base_plat_pub_policy.conf",
1379 filter_out: [":reqd_policy_mask.cil"],
1380 secilc_check: false,
1381 installable: false,
1382}
1383
1384se_policy_conf {
1385 name: "base_system_ext_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001386 srcs: plat_public_policy +
1387 system_ext_public_policy +
1388 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001389 build_variant: "user",
1390 installable: false,
1391}
1392
1393se_policy_cil {
1394 name: "base_system_ext_pub_policy.cil",
1395 src: ":base_system_ext_pub_policy.conf",
1396 filter_out: [":reqd_policy_mask.cil"],
1397 secilc_check: false,
1398 installable: false,
1399}
1400
1401se_policy_conf {
1402 name: "base_product_pub_policy.conf",
Inseob Kim0a707fa2021-12-09 23:35:11 +09001403 srcs: plat_public_policy +
1404 system_ext_public_policy +
1405 product_public_policy +
1406 reqd_mask_policy,
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001407 build_variant: "user",
1408 installable: false,
1409}
1410
1411se_policy_cil {
1412 name: "base_product_pub_policy.cil",
1413 src: ":base_product_pub_policy.conf",
1414 filter_out: [":reqd_policy_mask.cil"],
1415 secilc_check: false,
1416 installable: false,
1417}
1418
Yi-Yo Chiang2c189652021-11-08 19:30:04 +08001419// bug_map - Bug tracking information for selinux denials loaded by auditd.
1420se_filegroup {
1421 name: "bug_map_files",
1422 srcs: ["bug_map"],
1423}
1424
1425se_bug_map {
1426 name: "plat_bug_map",
1427 srcs: [":bug_map_files"],
1428 stem: "bug_map",
1429}
1430
1431se_bug_map {
1432 name: "system_ext_bug_map",
1433 srcs: [":bug_map_files"],
1434 stem: "bug_map",
1435 system_ext_specific: true,
1436}
1437
1438se_bug_map {
1439 name: "vendor_bug_map",
1440 srcs: [":bug_map_files"],
1441 // Legacy file name of the vendor partition bug_map.
1442 stem: "selinux_denial_metadata",
1443 vendor: true,
1444}
1445
Inseob Kim4d90b7e2021-09-27 13:43:01 +00001446//////////////////////////////////
Inseob Kimd5816612021-09-15 03:01:05 +00001447// se_freeze_test compares the plat sepolicy with the prebuilt sepolicy
1448// Additional directories can be specified via Makefile variables:
1449// SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS.
1450//////////////////////////////////
1451se_freeze_test {
1452 name: "sepolicy_freeze_test",
1453}
Yuntao Xu42e732c2021-11-18 22:33:02 +00001454
1455//////////////////////////////////
1456// Makefile rules temporary imported to Soong
1457// TODO(b/33691272): remove these after migrating seapp to Soong
1458//////////////////////////////////
1459makefile_goal {
1460 name: "plat_seapp_contexts_rule",
1461 product_out_path: "obj/ETC/plat_seapp_contexts_intermediates/plat_seapp_contexts",
1462}
1463
1464makefile_goal {
1465 name: "plat_seapp_neverallows_rule",
1466 product_out_path: "obj/ETC/plat_seapp_neverallows_intermediates/plat_seapp_neverallows",
1467}