blob: 0e9693a789a89f56cee5d964757d186ab1e7f2af [file] [log] [blame]
Tri Voa5cfd3e2018-03-22 11:35:02 -07001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badour601ebb42021-02-03 23:07:40 -080015package {
16 default_applicable_licenses: ["system_sepolicy_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'filegroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// http://go/android-license-faq
33license {
34 name: "system_sepolicy_license",
35 visibility: [":__subpackages__"],
36 license_kinds: [
37 "SPDX-license-identifier-Apache-2.0",
38 "legacy_unencumbered",
39 ],
40 license_text: [
41 "NOTICE",
42 ],
43}
44
Jeff Vander Stoepecd288f2019-02-15 12:18:15 -080045cc_defaults { name: "selinux_policy_version", cflags: ["-DSEPOLICY_VERSION=30"], }
46
Tri Vo84e247a2018-03-25 20:03:58 -070047se_filegroup {
48 name: "26.0.board.compat.map",
49 srcs: [
50 "compat/26.0/26.0.cil",
51 ],
52}
53
54se_filegroup {
55 name: "27.0.board.compat.map",
56 srcs: [
57 "compat/27.0/27.0.cil",
58 ],
59}
60
Jae Shin1fa96342018-07-11 18:30:44 +090061se_filegroup {
62 name: "28.0.board.compat.map",
63 srcs: [
64 "compat/28.0/28.0.cil",
65 ],
66}
67
Jinguang Donge0125692019-03-05 17:20:54 +080068se_filegroup {
Tri Vo50aa0292019-06-01 17:04:13 -070069 name: "29.0.board.compat.map",
70 srcs: [
71 "compat/29.0/29.0.cil",
72 ],
73}
74
75se_filegroup {
Inseob Kimace36ab2020-05-07 20:19:05 +090076 name: "30.0.board.compat.map",
77 srcs: [
78 "compat/30.0/30.0.cil",
79 ],
80}
81
82se_filegroup {
Jinguang Donge0125692019-03-05 17:20:54 +080083 name: "26.0.board.ignore.map",
84 srcs: [
85 "compat/26.0/26.0.ignore.cil",
86 ],
87}
88
89se_filegroup {
90 name: "27.0.board.ignore.map",
91 srcs: [
92 "compat/27.0/27.0.ignore.cil",
93 ],
94}
95
96se_filegroup {
97 name: "28.0.board.ignore.map",
98 srcs: [
99 "compat/28.0/28.0.ignore.cil",
100 ],
101}
102
Tri Vo50aa0292019-06-01 17:04:13 -0700103se_filegroup {
104 name: "29.0.board.ignore.map",
105 srcs: [
106 "compat/29.0/29.0.ignore.cil",
107 ],
108}
109
Inseob Kimace36ab2020-05-07 20:19:05 +0900110se_filegroup {
111 name: "30.0.board.ignore.map",
112 srcs: [
113 "compat/30.0/30.0.ignore.cil",
114 ],
115}
116
Tri Voa5cfd3e2018-03-22 11:35:02 -0700117se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700118 name: "plat_26.0.cil",
119 stem: "26.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700120 bottom_half: [":26.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700121 top_half: "plat_27.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700122}
123
124se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700125 name: "plat_27.0.cil",
126 stem: "27.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700127 bottom_half: [":27.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700128 top_half: "plat_28.0.cil",
Tri Voa5cfd3e2018-03-22 11:35:02 -0700129}
Jae Shin1fa96342018-07-11 18:30:44 +0900130
131se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700132 name: "plat_28.0.cil",
133 stem: "28.0.cil",
Tri Vo438684b2018-09-29 17:47:10 -0700134 bottom_half: [":28.0.board.compat.map"],
Tri Vo61178552019-10-10 16:29:40 -0700135 top_half: "plat_29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700136}
137
138se_cil_compat_map {
Tri Vo61178552019-10-10 16:29:40 -0700139 name: "plat_29.0.cil",
140 stem: "29.0.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700141 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900142 top_half: "plat_30.0.cil",
143}
144
145se_cil_compat_map {
146 name: "plat_30.0.cil",
147 stem: "30.0.cil",
148 bottom_half: [":30.0.board.compat.map"],
149 // top_half: "plat_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700150}
151
152se_cil_compat_map {
153 name: "system_ext_26.0.cil",
154 stem: "26.0.cil",
155 bottom_half: [":26.0.board.compat.map"],
156 top_half: "system_ext_27.0.cil",
157 system_ext_specific: true,
158}
159
160se_cil_compat_map {
161 name: "system_ext_27.0.cil",
162 stem: "27.0.cil",
163 bottom_half: [":27.0.board.compat.map"],
164 top_half: "system_ext_28.0.cil",
165 system_ext_specific: true,
166}
167
168se_cil_compat_map {
169 name: "system_ext_28.0.cil",
170 stem: "28.0.cil",
171 bottom_half: [":28.0.board.compat.map"],
172 top_half: "system_ext_29.0.cil",
173 system_ext_specific: true,
174}
175
176se_cil_compat_map {
177 name: "system_ext_29.0.cil",
178 stem: "29.0.cil",
179 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900180 top_half: "system_ext_30.0.cil",
181 system_ext_specific: true,
182}
183
184se_cil_compat_map {
185 name: "system_ext_30.0.cil",
186 stem: "30.0.cil",
187 bottom_half: [":30.0.board.compat.map"],
188 // top_half: "system_ext_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700189 system_ext_specific: true,
190}
191
192se_cil_compat_map {
193 name: "product_26.0.cil",
194 stem: "26.0.cil",
195 bottom_half: [":26.0.board.compat.map"],
196 top_half: "product_27.0.cil",
197 product_specific: true,
198}
199
200se_cil_compat_map {
201 name: "product_27.0.cil",
202 stem: "27.0.cil",
203 bottom_half: [":27.0.board.compat.map"],
204 top_half: "product_28.0.cil",
205 product_specific: true,
206}
207
208se_cil_compat_map {
209 name: "product_28.0.cil",
210 stem: "28.0.cil",
211 bottom_half: [":28.0.board.compat.map"],
212 top_half: "product_29.0.cil",
213 product_specific: true,
214}
215
216se_cil_compat_map {
217 name: "product_29.0.cil",
218 stem: "29.0.cil",
219 bottom_half: [":29.0.board.compat.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900220 top_half: "product_30.0.cil",
221 product_specific: true,
222}
223
224se_cil_compat_map {
225 name: "product_30.0.cil",
226 stem: "30.0.cil",
227 bottom_half: [":30.0.board.compat.map"],
228 // top_half: "product_31.0.cil",
Tri Vo61178552019-10-10 16:29:40 -0700229 product_specific: true,
Tri Vo438684b2018-09-29 17:47:10 -0700230}
231
232se_cil_compat_map {
233 name: "26.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800234 bottom_half: [":26.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700235 top_half: "27.0.ignore.cil",
236}
237
238se_cil_compat_map {
239 name: "27.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800240 bottom_half: [":27.0.board.ignore.map"],
Tri Vo438684b2018-09-29 17:47:10 -0700241 top_half: "28.0.ignore.cil",
242}
243
244se_cil_compat_map {
245 name: "28.0.ignore.cil",
Jinguang Donge0125692019-03-05 17:20:54 +0800246 bottom_half: [":28.0.board.ignore.map"],
Tri Voe381deb2019-06-12 15:52:30 -0700247 top_half: "29.0.ignore.cil",
Jae Shin1fa96342018-07-11 18:30:44 +0900248}
Inseob Kimb554e592019-04-15 20:10:46 +0900249
Tri Vo50aa0292019-06-01 17:04:13 -0700250se_cil_compat_map {
251 name: "29.0.ignore.cil",
252 bottom_half: [":29.0.board.ignore.map"],
Inseob Kimace36ab2020-05-07 20:19:05 +0900253 top_half: "30.0.ignore.cil",
254}
255
256se_cil_compat_map {
257 name: "30.0.ignore.cil",
258 bottom_half: [":30.0.board.ignore.map"],
259 // top_half: "31.0.ignore.cil",
Tri Vo50aa0292019-06-01 17:04:13 -0700260}
261
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700262prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700263 name: "26.0.compat.cil",
264 src: "private/compat/26.0/26.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700265 sub_dir: "selinux/mapping",
266}
267
268prebuilt_etc {
269 name: "27.0.compat.cil",
270 src: "private/compat/27.0/27.0.compat.cil",
271 sub_dir: "selinux/mapping",
272}
273
274prebuilt_etc {
Tri Vo50aa0292019-06-01 17:04:13 -0700275 name: "28.0.compat.cil",
276 src: "private/compat/28.0/28.0.compat.cil",
277 sub_dir: "selinux/mapping",
278}
279
280prebuilt_etc {
281 name: "29.0.compat.cil",
282 src: "private/compat/29.0/29.0.compat.cil",
Jeff Vander Stoep564e2922019-05-02 13:48:44 -0700283 sub_dir: "selinux/mapping",
284}
285
Inseob Kimace36ab2020-05-07 20:19:05 +0900286prebuilt_etc {
287 name: "30.0.compat.cil",
288 src: "private/compat/30.0/30.0.compat.cil",
289 sub_dir: "selinux/mapping",
290}
291
Inseob Kimb554e592019-04-15 20:10:46 +0900292se_filegroup {
293 name: "file_contexts_files",
294 srcs: ["file_contexts"],
295}
296
297se_filegroup {
298 name: "file_contexts_asan_files",
299 srcs: ["file_contexts_asan"],
300}
301
302se_filegroup {
303 name: "file_contexts_overlayfs_files",
304 srcs: ["file_contexts_overlayfs"],
305}
306
307se_filegroup {
308 name: "hwservice_contexts_files",
309 srcs: ["hwservice_contexts"],
310}
311
312se_filegroup {
313 name: "property_contexts_files",
314 srcs: ["property_contexts"],
315}
316
317se_filegroup {
318 name: "service_contexts_files",
319 srcs: ["service_contexts"],
320}
321
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700322se_filegroup {
323 name: "keystore2_key_contexts_files",
324 srcs: ["keystore2_key_contexts"],
325}
326
Inseob Kimb554e592019-04-15 20:10:46 +0900327file_contexts {
328 name: "plat_file_contexts",
329 srcs: [":file_contexts_files"],
330 product_variables: {
331 address_sanitize: {
332 srcs: [":file_contexts_asan_files"],
333 },
334 debuggable: {
335 srcs: [":file_contexts_overlayfs_files"],
336 },
337 },
338
339 flatten_apex: {
340 srcs: ["apex/*-file_contexts"],
341 },
342
343 recovery_available: true,
344}
345
346file_contexts {
347 name: "vendor_file_contexts",
348 srcs: [":file_contexts_files"],
349 soc_specific: true,
350 recovery_available: true,
351}
352
353file_contexts {
Bowgo Tsai86a048d2019-09-09 22:04:06 +0800354 name: "system_ext_file_contexts",
355 srcs: [":file_contexts_files"],
356 system_ext_specific: true,
357 recovery_available: true,
358}
359
360file_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900361 name: "product_file_contexts",
362 srcs: [":file_contexts_files"],
363 product_specific: true,
364 recovery_available: true,
365}
366
367file_contexts {
368 name: "odm_file_contexts",
369 srcs: [":file_contexts_files"],
370 device_specific: true,
371 recovery_available: true,
372}
373
374hwservice_contexts {
375 name: "plat_hwservice_contexts",
376 srcs: [":hwservice_contexts_files"],
377}
378
379hwservice_contexts {
Bowgo Tsai241d36e2019-09-09 22:05:10 +0800380 name: "system_ext_hwservice_contexts",
381 srcs: [":hwservice_contexts_files"],
382 system_ext_specific: true,
383}
384
385hwservice_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900386 name: "product_hwservice_contexts",
387 srcs: [":hwservice_contexts_files"],
388 product_specific: true,
389}
390
391hwservice_contexts {
392 name: "vendor_hwservice_contexts",
393 srcs: [":hwservice_contexts_files"],
394 reqd_mask: true,
395 soc_specific: true,
396}
397
398hwservice_contexts {
399 name: "odm_hwservice_contexts",
400 srcs: [":hwservice_contexts_files"],
401 device_specific: true,
402}
403
404property_contexts {
405 name: "plat_property_contexts",
406 srcs: [":property_contexts_files"],
407 recovery_available: true,
408}
409
410property_contexts {
Bowgo Tsai1864cd02019-09-09 18:09:22 +0800411 name: "system_ext_property_contexts",
412 srcs: [":property_contexts_files"],
413 system_ext_specific: true,
414 recovery_available: true,
415}
416
417property_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900418 name: "product_property_contexts",
419 srcs: [":property_contexts_files"],
420 product_specific: true,
421 recovery_available: true,
422}
423
424property_contexts {
425 name: "vendor_property_contexts",
426 srcs: [":property_contexts_files"],
427 reqd_mask: true,
428 soc_specific: true,
429 recovery_available: true,
430}
431
432property_contexts {
433 name: "odm_property_contexts",
434 srcs: [":property_contexts_files"],
435 device_specific: true,
436 recovery_available: true,
437}
438
439service_contexts {
440 name: "plat_service_contexts",
441 srcs: [":service_contexts_files"],
442}
443
444service_contexts {
Bowgo Tsai98231162019-09-09 22:05:29 +0800445 name: "system_ext_service_contexts",
446 srcs: [":service_contexts_files"],
447 system_ext_specific: true,
448}
449
450service_contexts {
Inseob Kimb554e592019-04-15 20:10:46 +0900451 name: "product_service_contexts",
452 srcs: [":service_contexts_files"],
453 product_specific: true,
454}
455
456service_contexts {
457 name: "vendor_service_contexts",
458 srcs: [":service_contexts_files"],
459 reqd_mask: true,
460 soc_specific: true,
461}
yangbill3e345372020-04-15 13:55:47 +0800462
Janis Danisevskisc40681f2020-07-25 13:02:29 -0700463keystore2_key_contexts {
464 name: "plat_keystore2_key_contexts",
465 srcs: [":keystore2_key_contexts_files"],
466}
467
468keystore2_key_contexts {
469 name: "system_keystore2_key_contexts",
470 srcs: [":keystore2_key_contexts_files"],
471 system_ext_specific: true,
472}
473
474keystore2_key_contexts {
475 name: "product_keystore2_key_contexts",
476 srcs: [":keystore2_key_contexts_files"],
477 product_specific: true,
478}
479
480keystore2_key_contexts {
481 name: "vendor_keystore2_key_contexts",
482 srcs: [":keystore2_key_contexts_files"],
483 reqd_mask: true,
484 soc_specific: true,
485}
486
yangbill3e345372020-04-15 13:55:47 +0800487// For vts_treble_sys_prop_test
488filegroup {
489 name: "private_property_contexts",
490 srcs: ["private/property_contexts"],
491 visibility: [
492 "//test/vts-testcase/security/system_property",
493 ],
494}
Inseob Kime35b49b2021-02-18 19:15:41 +0900495
Inseob Kima49e7242021-03-22 10:26:13 +0900496se_build_files {
497 name: "se_build_files",
Inseob Kime35b49b2021-02-18 19:15:41 +0900498 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900499 "security_classes",
500 "initial_sids",
501 "access_vectors",
502 "global_macros",
503 "neverallow_macros",
504 "mls_macros",
505 "mls_decl",
506 "mls",
507 "policy_capabilities",
508 "te_macros",
509 "attributes",
510 "ioctl_defines",
511 "ioctl_macros",
512 "*.te",
513 "roles_decl",
514 "roles",
515 "users",
516 "initial_sid_contexts",
517 "fs_use",
518 "genfs_contexts",
519 "port_contexts",
Inseob Kime35b49b2021-02-18 19:15:41 +0900520 ],
521}
522
Inseob Kima49e7242021-03-22 10:26:13 +0900523// reqd_policy_mask - a policy.conf file which contains only the bare minimum
524// policy necessary to use checkpolicy.
525//
526// This bare-minimum policy needs to be present in all policy.conf files, but
527// should not necessarily be exported as part of the public policy.
528//
529// The rules generated by reqd_policy_mask will allow the compilation of public
530// policy and subsequent removal of CIL policy that should not be exported.
531se_policy_conf {
532 name: "reqd_policy_mask.conf",
533 srcs: [":se_build_files{.reqd_mask}"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900534 installable: false,
535}
536
Inseob Kima49e7242021-03-22 10:26:13 +0900537se_policy_cil {
538 name: "reqd_policy_mask.cil",
539 src: ":reqd_policy_mask.conf",
540 secilc_check: false,
541 installable: false,
Inseob Kime35b49b2021-02-18 19:15:41 +0900542}
543
Inseob Kima49e7242021-03-22 10:26:13 +0900544// pub_policy - policy that will be exported to be a part of non-platform
545// policy corresponding to this platform version.
546//
547// This is a limited subset of policy that would not compile in checkpolicy on
548// its own.
549//
550// To get around this limitation, add only the required files from private
551// policy, which will generate CIL policy that will then be filtered out by the
552// reqd_policy_mask.
553//
554// There are three pub_policy.cil files below:
555// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
556// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
557// - plat_pub_policy.cil: exported 'system' policy.
558//
559// Those above files will in turn be used to generate the following versioned cil files:
560// - product_mapping_file: the versioned, exported 'product' policy in product partition.
561// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
562// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
563// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
564// in vendor partition.
565//
566se_policy_conf {
567 name: "pub_policy.conf",
568 srcs: [":se_build_files{.product_public}"], // product_ includes system and system_ext
569 installable: false,
570}
571
572se_policy_cil {
573 name: "pub_policy.cil",
574 src: ":pub_policy.conf",
575 filter_out: [":reqd_policy_mask.cil"],
576 secilc_check: false,
577 installable: false,
578}
579
580se_policy_conf {
581 name: "system_ext_pub_policy.conf",
582 srcs: [":se_build_files{.system_ext_public}"], // system_ext_public includes system
583 installable: false,
584}
585
586se_policy_cil {
587 name: "system_ext_pub_policy.cil",
588 src: ":system_ext_pub_policy.conf",
589 filter_out: [":reqd_policy_mask.cil"],
590 secilc_check: false,
591 installable: false,
592}
593
594se_policy_conf {
595 name: "plat_pub_policy.conf",
596 srcs: [":se_build_files{.plat_public}"],
597 installable: false,
598}
599
600se_policy_cil {
601 name: "plat_pub_policy.cil",
602 src: ":plat_pub_policy.conf",
603 filter_out: [":reqd_policy_mask.cil"],
604 secilc_check: false,
605 installable: false,
606}
607
608// plat_policy.conf - A combination of the private and public platform policy
609// which will ship with the device.
610//
611// The platform will always reflect the most recent platform version and is not
612// currently being attributized.
613se_policy_conf {
614 name: "plat_sepolicy.conf",
615 srcs: [":se_build_files{.plat}"],
616 installable: false,
617}
618
619se_policy_cil {
620 name: "plat_sepolicy.cil",
621 src: ":plat_sepolicy.conf",
622 additional_cil_files: ["private/technical_debt.cil"],
623}
624
625// system_ext_policy.conf - A combination of the private and public system_ext
626// policy which will ship with the device. System_ext policy is not attributized
627se_policy_conf {
628 name: "system_ext_sepolicy.conf",
629 srcs: [":se_build_files{.system_ext}"],
630 installable: false,
631}
632
633se_policy_cil {
634 name: "system_ext_sepolicy.cil",
635 src: ":system_ext_sepolicy.conf",
636 system_ext_specific: true,
637 filter_out: [":plat_sepolicy.cil"],
638 remove_line_marker: true,
639}
640
641// product_policy.conf - A combination of the private and public product policy
642// which will ship with the device. Product policy is not attributized
643se_policy_conf {
644 name: "product_sepolicy.conf",
645 srcs: [":se_build_files{.product}"],
646 installable: false,
647}
648
649se_policy_cil {
650 name: "product_sepolicy.cil",
651 src: ":product_sepolicy.conf",
652 product_specific: true,
653 filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
654 remove_line_marker: true,
655}
656
657//////////////////////////////////
658// SELinux policy embedded into CTS.
659// CTS checks neverallow rules of this policy against the policy of the device under test.
660//////////////////////////////////
661se_policy_conf {
662 name: "general_sepolicy.conf",
663 srcs: [":se_build_files{.plat}"],
664 build_variant: "user",
665 cts: true,
666 exclude_build_test: true,
667}
668
669//////////////////////////////////
670// modules for microdroid
Inseob Kim002d9262021-03-24 17:10:15 +0900671// TODO(b/33691272): migrate Android.mk to Android.bp and remove workarounds
Inseob Kima49e7242021-03-22 10:26:13 +0900672//////////////////////////////////
Inseob Kime35b49b2021-02-18 19:15:41 +0900673genrule {
674 name: "microdroid_plat_mapping_file_gen",
Inseob Kima49e7242021-03-22 10:26:13 +0900675 srcs: [":plat_pub_policy.cil"],
676 tools: ["version_policy"],
Inseob Kime35b49b2021-02-18 19:15:41 +0900677 out: ["10000.0.cil"],
Inseob Kima49e7242021-03-22 10:26:13 +0900678 cmd: "$(location version_policy) -b $(location :plat_pub_policy.cil) -m -n 10000.0 -o $(out)",
Inseob Kime35b49b2021-02-18 19:15:41 +0900679 visibility: ["//visibility:private"],
680}
681
682prebuilt_etc {
683 name: "microdroid_plat_mapping_file",
684 src: ":microdroid_plat_mapping_file_gen",
685 filename: "10000.0.cil",
686 relative_install_path: "selinux/mapping",
687 installable: false,
688}
Jiyong Parkd89564e2021-03-03 14:56:43 +0000689
Inseob Kima49e7242021-03-22 10:26:13 +0900690// Normally plat_pub_versioned.cil is built from pub_policy.cil (including system_ext and product).
691// But microdroid only has system, so its plat_pub_versioned.cil uses plat_pub_policy.cil.
Inseob Kimd869d022021-03-19 07:04:51 +0000692genrule {
693 name: "microdroid_plat_pub_versioned.cil_gen",
Inseob Kima49e7242021-03-22 10:26:13 +0900694 srcs: [":plat_pub_policy.cil"],
Inseob Kimd869d022021-03-19 07:04:51 +0000695 tools: ["version_policy"],
696 out: ["plat_pub_versioned.cil"],
697 cmd: "$(location version_policy) " +
Inseob Kima49e7242021-03-22 10:26:13 +0900698 "-b $(location :plat_pub_policy.cil) " +
699 "-t $(location :plat_pub_policy.cil) " +
Inseob Kimd869d022021-03-19 07:04:51 +0000700 "-n 10000.0 " +
701 "-o $(out)",
702 visibility: ["//visibility:private"],
Inseob Kim7629e862021-03-17 19:07:15 +0900703}
704
Inseob Kima49e7242021-03-22 10:26:13 +0900705prebuilt_etc {
706 name: "microdroid_plat_pub_versioned.cil",
707 src: ":microdroid_plat_pub_versioned.cil_gen",
708 filename: "plat_pub_versioned.cil",
709 relative_install_path: "selinux",
710 installable: false,
711}
712
713// policy files for microdroid vendor
714// This contains a minimal set of policy files for microdroid vendor.
Inseob Kim002d9262021-03-24 17:10:15 +0900715// TODO(b/33691272): update se_build_files to cover this
Jiyong Parkd89564e2021-03-03 14:56:43 +0000716filegroup {
717 name: "microdroid_vendor_sepolicy_build_files",
718 srcs: [
719 "reqd_mask/security_classes",
720 "reqd_mask/initial_sids",
721 "reqd_mask/access_vectors",
722 "public/global_macros",
723 "public/neverallow_macros",
724 "reqd_mask/mls_macros",
725 "reqd_mask/mls_decl",
726 "reqd_mask/mls",
727 "public/te_macros",
728 "public/attributes",
729 "public/ioctl_defines",
730 "public/ioctl_macros",
731 "public/*.te",
732 "reqd_mask/*.te",
733 "vendor/*.te",
734 "reqd_mask/roles_decl",
735 "public/roles",
736 "reqd_mask/roles",
737 "reqd_mask/users",
738 "reqd_mask/initial_sid_contexts",
739 ],
740}
741
Inseob Kima49e7242021-03-22 10:26:13 +0900742se_policy_conf {
743 name: "microdroid_vendor_sepolicy.conf",
744 srcs: [":microdroid_vendor_sepolicy_build_files"],
745 installable: false,
746}
747
Jiyong Parkd89564e2021-03-03 14:56:43 +0000748genrule {
749 name: "microdroid_vendor_sepolicy.cil_gen",
750 srcs: [
Inseob Kima49e7242021-03-22 10:26:13 +0900751 ":microdroid_vendor_sepolicy.conf",
Jiyong Parkd89564e2021-03-03 14:56:43 +0000752 ":microdroid_plat_pub_versioned.cil_gen",
Inseob Kima49e7242021-03-22 10:26:13 +0900753 ":plat_pub_policy.cil",
754 ":reqd_policy_mask.cil",
Jiyong Parkd89564e2021-03-03 14:56:43 +0000755 ],
Jiyong Parkcc9a0992021-03-03 23:36:42 +0900756 tools: [
Jiyong Parkcc9a0992021-03-03 23:36:42 +0900757 "build_sepolicy",
758 "checkpolicy",
759 "secilc",
760 "version_policy",
761 ],
Jiyong Parkd89564e2021-03-03 14:56:43 +0000762 out: ["vendor_sepolicy.cil"],
Inseob Kima49e7242021-03-22 10:26:13 +0900763 cmd: "$(location build_sepolicy) " +
Jiyong Parkcc9a0992021-03-03 23:36:42 +0900764 "--android_host_path $$(dirname $(location build_sepolicy)) " +
Jiyong Parkd89564e2021-03-03 14:56:43 +0000765 "build_cil " +
Inseob Kima49e7242021-03-22 10:26:13 +0900766 "--input_policy_conf $(location :microdroid_vendor_sepolicy.conf) " +
Jiyong Parkd89564e2021-03-03 14:56:43 +0000767 "--checkpolicy_env ASAN_OPTIONS=detect_leaks=0 " +
Inseob Kima49e7242021-03-22 10:26:13 +0900768 "--base_policy $(location :plat_pub_policy.cil) " +
Jiyong Parkd89564e2021-03-03 14:56:43 +0000769 "--filter_out_files $(location :microdroid_plat_pub_versioned.cil_gen) " +
Inseob Kima49e7242021-03-22 10:26:13 +0900770 "--reqd_mask $(location :reqd_policy_mask.cil) " +
Jiyong Parkd89564e2021-03-03 14:56:43 +0000771 "--treble_sepolicy_vers 10000.0 " +
772 "--policy_vers 30 " +
773 "--output_cil $(out)",
774 visibility: ["//visibility:private"],
775}
776
777prebuilt_etc {
778 name: "microdroid_vendor_sepolicy.cil",
779 src: ":microdroid_vendor_sepolicy.cil_gen",
780 filename: "vendor_sepolicy.cil",
781 relative_install_path: "selinux",
782 installable: false,
783}