forked from LineageOS/android_system_sepolicy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Android.bp
1136 lines (1020 loc) · 31.8 KB
/
Android.bp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["system_sepolicy_license"],
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'filegroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// http://go/android-license-faq
license {
name: "system_sepolicy_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"legacy_unencumbered",
],
license_text: [
"NOTICE",
],
}
cc_defaults { name: "selinux_policy_version", cflags: ["-DSEPOLICY_VERSION=30"], }
se_filegroup {
name: "28.0.board.compat.map",
srcs: [
"compat/28.0/28.0.cil",
],
}
se_filegroup {
name: "29.0.board.compat.map",
srcs: [
"compat/29.0/29.0.cil",
],
}
se_filegroup {
name: "30.0.board.compat.map",
srcs: [
"compat/30.0/30.0.cil",
],
}
se_filegroup {
name: "31.0.board.compat.map",
srcs: [
"compat/31.0/31.0.cil",
],
}
se_filegroup {
name: "32.0.board.compat.map",
srcs: [
"compat/32.0/32.0.cil",
],
}
se_filegroup {
name: "28.0.board.compat.cil",
srcs: [
"compat/28.0/28.0.compat.cil",
],
}
se_filegroup {
name: "29.0.board.compat.cil",
srcs: [
"compat/29.0/29.0.compat.cil",
],
}
se_filegroup {
name: "30.0.board.compat.cil",
srcs: [
"compat/30.0/30.0.compat.cil",
],
}
se_filegroup {
name: "31.0.board.compat.cil",
srcs: [
"compat/31.0/31.0.compat.cil",
],
}
se_filegroup {
name: "32.0.board.compat.cil",
srcs: [
"compat/32.0/32.0.compat.cil",
],
}
se_filegroup {
name: "28.0.board.ignore.map",
srcs: [
"compat/28.0/28.0.ignore.cil",
],
}
se_filegroup {
name: "29.0.board.ignore.map",
srcs: [
"compat/29.0/29.0.ignore.cil",
],
}
se_filegroup {
name: "30.0.board.ignore.map",
srcs: [
"compat/30.0/30.0.ignore.cil",
],
}
se_filegroup {
name: "31.0.board.ignore.map",
srcs: [
"compat/31.0/31.0.ignore.cil",
],
}
se_filegroup {
name: "32.0.board.ignore.map",
srcs: [
"compat/32.0/32.0.ignore.cil",
],
}
se_build_files {
name: "file_contexts_files",
srcs: ["file_contexts"],
}
se_build_files {
name: "file_contexts_asan_files",
srcs: ["file_contexts_asan"],
}
se_build_files {
name: "file_contexts_overlayfs_files",
srcs: ["file_contexts_overlayfs"],
}
se_build_files {
name: "hwservice_contexts_files",
srcs: ["hwservice_contexts"],
}
se_build_files {
name: "property_contexts_files",
srcs: ["property_contexts"],
}
se_build_files {
name: "service_contexts_files",
srcs: ["service_contexts"],
}
se_build_files {
name: "keystore2_key_contexts_files",
srcs: ["keystore2_key_contexts"],
}
se_build_files {
name: "seapp_contexts_files",
srcs: ["seapp_contexts"],
}
se_build_files {
name: "vndservice_contexts_files",
srcs: ["vndservice_contexts"],
}
// For vts_treble_sys_prop_test
filegroup {
name: "private_property_contexts",
srcs: ["private/property_contexts"],
visibility: [
"//test/vts-testcase/security/system_property",
],
}
se_build_files {
name: "se_build_files",
srcs: [
"security_classes",
"initial_sids",
"access_vectors",
"global_macros",
"neverallow_macros",
"mls_macros",
"mls_decl",
"mls",
"policy_capabilities",
"te_macros",
"attributes",
"ioctl_defines",
"ioctl_macros",
"*.te",
"roles_decl",
"roles",
"users",
"initial_sid_contexts",
"fs_use",
"genfs_contexts",
"port_contexts",
],
}
se_build_files {
name: "sepolicy_technical_debt",
srcs: ["technical_debt.cil"],
}
reqd_mask_policy = [":se_build_files{.reqd_mask}"]
plat_public_policy = [":se_build_files{.plat_public}"]
plat_private_policy = [":se_build_files{.plat_private}"]
system_ext_public_policy = [":se_build_files{.system_ext_public}"]
system_ext_private_policy = [":se_build_files{.system_ext_private}"]
product_public_policy = [":se_build_files{.product_public}"]
product_private_policy = [":se_build_files{.product_private}"]
// reqd_policy_mask - a policy.conf file which contains only the bare minimum
// policy necessary to use checkpolicy.
//
// This bare-minimum policy needs to be present in all policy.conf files, but
// should not necessarily be exported as part of the public policy.
//
// The rules generated by reqd_policy_mask will allow the compilation of public
// policy and subsequent removal of CIL policy that should not be exported.
se_policy_conf {
name: "reqd_policy_mask.conf",
srcs: reqd_mask_policy,
installable: false,
}
se_policy_cil {
name: "reqd_policy_mask.cil",
src: ":reqd_policy_mask.conf",
secilc_check: false,
installable: false,
}
// pub_policy - policy that will be exported to be a part of non-platform
// policy corresponding to this platform version.
//
// This is a limited subset of policy that would not compile in checkpolicy on
// its own.
//
// To get around this limitation, add only the required files from private
// policy, which will generate CIL policy that will then be filtered out by the
// reqd_policy_mask.
//
// There are three pub_policy.cil files below:
// - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy.
// - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy.
// - plat_pub_policy.cil: exported 'system' policy.
//
// Those above files will in turn be used to generate the following versioned cil files:
// - product_mapping_file: the versioned, exported 'product' policy in product partition.
// - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition.
// - plat_mapping_file: the versioned, exported 'system' policy in system partition.
// - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy
// in vendor partition.
//
se_policy_conf {
name: "pub_policy.conf",
srcs: plat_public_policy +
system_ext_public_policy +
product_public_policy +
reqd_mask_policy,
installable: false,
}
se_policy_cil {
name: "pub_policy.cil",
src: ":pub_policy.conf",
filter_out: [":reqd_policy_mask.cil"],
secilc_check: false,
installable: false,
}
se_policy_conf {
name: "system_ext_pub_policy.conf",
srcs: plat_public_policy +
system_ext_public_policy +
reqd_mask_policy,
installable: false,
}
se_policy_cil {
name: "system_ext_pub_policy.cil",
src: ":system_ext_pub_policy.conf",
filter_out: [":reqd_policy_mask.cil"],
secilc_check: false,
installable: false,
}
se_policy_conf {
name: "plat_pub_policy.conf",
srcs: plat_public_policy +
reqd_mask_policy,
installable: false,
}
se_policy_cil {
name: "plat_pub_policy.cil",
src: ":plat_pub_policy.conf",
filter_out: [":reqd_policy_mask.cil"],
secilc_check: false,
installable: false,
}
// plat_policy.conf - A combination of the private and public platform policy
// which will ship with the device.
//
// The platform will always reflect the most recent platform version and is not
// currently being attributized.
se_policy_conf {
name: "plat_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy,
installable: false,
}
se_policy_cil {
name: "plat_sepolicy.cil",
src: ":plat_sepolicy.conf",
additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
}
se_policy_conf {
name: "apex_sepolicy-33.conf",
srcs: plat_public_policy + plat_private_policy + ["com.android.sepolicy/33/*.te"],
installable: false,
}
se_policy_cil {
name: "apex_sepolicy-33.cil",
src: ":apex_sepolicy-33.conf",
filter_out: [":plat_sepolicy.cil"],
installable: false,
stem: "apex_sepolicy.cil",
}
// userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil
se_policy_conf {
name: "userdebug_plat_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy,
build_variant: "userdebug",
installable: false,
}
se_policy_cil {
name: "userdebug_plat_sepolicy.cil",
src: ":userdebug_plat_sepolicy.conf",
additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
debug_ramdisk: true,
dist: {
targets: ["droidcore"],
},
}
// A copy of the userdebug_plat_policy in GSI.
soong_config_module_type {
name: "gsi_se_policy_cil",
module_type: "se_policy_cil",
config_namespace: "ANDROID",
bool_variables: [
"PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
],
properties: [
"enabled",
"installable",
],
}
gsi_se_policy_cil {
name: "system_ext_userdebug_plat_sepolicy.cil",
stem: "userdebug_plat_sepolicy.cil",
src: ":userdebug_plat_sepolicy.conf",
additional_cil_files: [":sepolicy_technical_debt{.plat_private}"],
system_ext_specific: true,
enabled: false,
installable: false,
soong_config_variables: {
PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
enabled: true,
installable: true,
},
},
}
// system_ext_policy.conf - A combination of the private and public system_ext
// policy which will ship with the device. System_ext policy is not attributized
se_policy_conf {
name: "system_ext_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy +
system_ext_public_policy +
system_ext_private_policy,
installable: false,
}
se_policy_cil {
name: "system_ext_sepolicy.cil",
src: ":system_ext_sepolicy.conf",
system_ext_specific: true,
filter_out: [":plat_sepolicy.cil"],
remove_line_marker: true,
}
// product_policy.conf - A combination of the private and public product policy
// which will ship with the device. Product policy is not attributized
se_policy_conf {
name: "product_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy +
system_ext_public_policy +
system_ext_private_policy +
product_public_policy +
product_private_policy,
installable: false,
}
se_policy_cil {
name: "product_sepolicy.cil",
src: ":product_sepolicy.conf",
product_specific: true,
filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"],
remove_line_marker: true,
}
// policy mapping files
// auto-generate the mapping file for current platform policy, since it needs to
// track platform policy development
se_versioned_policy {
name: "plat_mapping_file",
base: ":plat_pub_policy.cil",
mapping: true,
version: "current",
relative_install_path: "mapping", // install to /system/etc/selinux/mapping
}
se_versioned_policy {
name: "system_ext_mapping_file",
base: ":system_ext_pub_policy.cil",
mapping: true,
version: "current",
filter_out: [":plat_mapping_file"],
relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping
system_ext_specific: true,
}
se_versioned_policy {
name: "product_mapping_file",
base: ":pub_policy.cil",
mapping: true,
version: "current",
filter_out: [":plat_mapping_file", ":system_ext_mapping_file"],
relative_install_path: "mapping", // install to /product/etc/selinux/mapping
product_specific: true,
}
// vendor/odm sepolicy
//
// If BOARD_SEPOLICY_VERS is set to a value other than PLATFORM_SEPOLICY_VERSION,
// policy files of platform (system, system_ext, product) can't be mixed with
// policy files of vendor (vendor, odm). If it's the case, platform policies and
// vendor policies are separately built. More specifically,
//
// - Platform policy files needed to build vendor policies, such as plat_policy,
// plat_mapping_cil, plat_pub_policy, reqd_policy_mask, are built from the
// prebuilts (copy of platform policy files of version BOARD_SEPOLICY_VERS).
//
// - sepolicy_neverallows only checks platform policies, and a new module
// sepolicy_neverallows_vendor checks vendor policies.
//
// - neverallow checks are turned off while compiling precompiled_sepolicy
// module and sepolicy module.
//
// - Vendor policies are not checked on the compat test (compat.mk).
//
// In such scenario, we can grab platform policy files from the prebuilts/api
// directory. But we need more than that: prebuilts of system_ext, product,
// system/sepolicy/reqd_mask, and system/sepolicy/vendor. The following
// variables are introduced to specify such prebuilts.
//
// - BOARD_REQD_MASK_POLICY (prebuilt of system/sepolicy/reqd_mask)
// - BOARD_PLAT_VENDOR_POLICY (prebuilt of system/sepolicy/vendor)
// - BOARD_SYSTEM_EXT_PUBLIC_PREBUILT_DIRS (prebuilt of system_ext public)
// - BOARD_SYSTEM_EXT_PRIVATE_PREBUILT_DIRS (prebuilt of system_ext private)
// - BOARD_PRODUCT_PUBLIC_PREBUILT_DIRS (prebuilt of product public)
// - BOARD_PRODUCT_PRIVATE_PREBUILT_DIRS (prebuilt of product private)
//
// Vendors are responsible for copying policy files from the old version of the
// source tree as prebuilts, and for setting BOARD_*_POLICY variables so they
// can be used to build vendor policies.
//
// To support both mixed build and normal build, platform policy files are
// indirectly referred as {.(partition)_(scope)_for_vendor}. They will be equal
// to {.(partition)_scope)} if BOARD_SEPOLICY_VERS == PLATFORM_SEPOLICY_VERSION.
// Otherwise, they will be equal to the Makefile variables above.
plat_public_policies_for_vendor = [
":se_build_files{.plat_public_for_vendor}",
":se_build_files{.system_ext_public_for_vendor}",
":se_build_files{.product_public_for_vendor}",
":se_build_files{.reqd_mask_for_vendor}",
]
plat_policies_for_vendor = [
":se_build_files{.plat_public_for_vendor}",
":se_build_files{.plat_private_for_vendor}",
":se_build_files{.system_ext_public_for_vendor}",
":se_build_files{.system_ext_private_for_vendor}",
":se_build_files{.product_public_for_vendor}",
":se_build_files{.product_private_for_vendor}",
]
se_policy_conf {
name: "plat_policy_for_vendor.conf",
srcs: plat_policies_for_vendor,
installable: false,
}
se_policy_cil {
name: "plat_policy_for_vendor.cil",
src: ":plat_policy_for_vendor.conf",
additional_cil_files: [":sepolicy_technical_debt{.plat_private_for_vendor}"],
installable: false,
}
se_policy_conf {
name: "reqd_policy_mask_for_vendor.conf",
srcs: [":se_build_files{.reqd_mask_for_vendor}"],
installable: false,
}
se_policy_cil {
name: "reqd_policy_mask_for_vendor.cil",
src: ":reqd_policy_mask_for_vendor.conf",
secilc_check: false,
installable: false,
}
se_policy_conf {
name: "pub_policy_for_vendor.conf",
srcs: plat_public_policies_for_vendor,
installable: false,
}
se_policy_cil {
name: "pub_policy_for_vendor.cil",
src: ":pub_policy_for_vendor.conf",
filter_out: [":reqd_policy_mask_for_vendor.cil"],
secilc_check: false,
installable: false,
}
se_versioned_policy {
name: "plat_mapping_file_for_vendor",
base: ":pub_policy_for_vendor.cil",
mapping: true,
version: "vendor",
installable: false,
}
// plat_pub_versioned.cil - the exported platform policy associated with the version
// that non-platform policy targets.
se_versioned_policy {
name: "plat_pub_versioned.cil",
base: ":pub_policy_for_vendor.cil",
target_policy: ":pub_policy_for_vendor.cil",
version: "vendor",
vendor: true,
}
// vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined
// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
// policy and the platform public policy files in order to use checkpolicy.
se_policy_conf {
name: "vendor_sepolicy.conf",
srcs: plat_public_policies_for_vendor + [
":se_build_files{.plat_vendor_for_vendor}",
":se_build_files{.vendor}",
],
installable: false,
}
se_policy_cil {
name: "vendor_sepolicy.cil.raw",
src: ":vendor_sepolicy.conf",
filter_out: [":reqd_policy_mask_for_vendor.cil"],
secilc_check: false, // will be done in se_versioned_policy module
installable: false,
}
se_versioned_policy {
name: "vendor_sepolicy.cil",
base: ":pub_policy_for_vendor.cil",
target_policy: ":vendor_sepolicy.cil.raw",
version: "vendor",
dependent_cils: [
":plat_policy_for_vendor.cil",
":plat_pub_versioned.cil",
":plat_mapping_file_for_vendor",
],
filter_out: [":plat_pub_versioned.cil"],
vendor: true,
}
// odm_policy.cil - the odl sepolicy. This needs attributization and to be combined
// with the platform-provided policy. It makes use of the reqd_policy_mask files from private
// policy and the platform public policy files in order to use checkpolicy.
se_policy_conf {
name: "odm_sepolicy.conf",
srcs: plat_public_policies_for_vendor + [
":se_build_files{.plat_vendor_for_vendor}",
":se_build_files{.vendor}",
":se_build_files{.odm}",
],
installable: false,
}
se_policy_cil {
name: "odm_sepolicy.cil.raw",
src: ":odm_sepolicy.conf",
filter_out: [
":reqd_policy_mask_for_vendor.cil",
":vendor_sepolicy.cil",
],
secilc_check: false, // will be done in se_versioned_policy module
installable: false,
}
se_versioned_policy {
name: "odm_sepolicy.cil",
base: ":pub_policy_for_vendor.cil",
target_policy: ":odm_sepolicy.cil.raw",
version: "vendor",
dependent_cils: [
":plat_policy_for_vendor.cil",
":plat_pub_versioned.cil",
":plat_mapping_file_for_vendor",
":vendor_sepolicy.cil",
],
filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"],
device_specific: true,
}
//////////////////////////////////
// Precompiled sepolicy is loaded if and only if:
// - plat_sepolicy_and_mapping.sha256 equals
// precompiled_sepolicy.plat_sepolicy_and_mapping.sha256
// AND
// - system_ext_sepolicy_and_mapping.sha256 equals
// precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256
// AND
// - product_sepolicy_and_mapping.sha256 equals
// precompiled_sepolicy.product_sepolicy_and_mapping.sha256
// AND
// - apex_sepolicy.sha256 equals
// precompiled_sepolicy.apex_sepolicy.sha256
// See system/core/init/selinux.cpp for details.
//////////////////////////////////
genrule {
name: "plat_sepolicy_and_mapping.sha256_gen",
srcs: [":plat_sepolicy.cil", ":plat_mapping_file"],
out: ["plat_sepolicy_and_mapping.sha256"],
cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
}
prebuilt_etc {
name: "plat_sepolicy_and_mapping.sha256",
filename: "plat_sepolicy_and_mapping.sha256",
src: ":plat_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
}
genrule {
name: "apex_sepolicy.sha256_gen",
srcs: [":apex_sepolicy-33.cil"],
out: ["apex_sepolicy.sha256"],
cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
}
prebuilt_etc {
name: "apex_sepolicy.sha256",
filename: "apex_sepolicy.sha256",
src: ":apex_sepolicy.sha256_gen",
installable: false,
}
genrule {
name: "system_ext_sepolicy_and_mapping.sha256_gen",
srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"],
out: ["system_ext_sepolicy_and_mapping.sha256"],
cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
}
prebuilt_etc {
name: "system_ext_sepolicy_and_mapping.sha256",
filename: "system_ext_sepolicy_and_mapping.sha256",
src: ":system_ext_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
system_ext_specific: true,
}
genrule {
name: "product_sepolicy_and_mapping.sha256_gen",
srcs: [":product_sepolicy.cil", ":product_mapping_file"],
out: ["product_sepolicy_and_mapping.sha256"],
cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)",
}
prebuilt_etc {
name: "product_sepolicy_and_mapping.sha256",
filename: "product_sepolicy_and_mapping.sha256",
src: ":product_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
product_specific: true,
}
sepolicy_vers {
name: "plat_sepolicy_vers.txt",
version: "vendor",
vendor: true,
}
soong_config_module_type {
name: "precompiled_sepolicy_prebuilts_defaults",
module_type: "prebuilt_defaults",
config_namespace: "ANDROID",
bool_variables: ["BOARD_USES_ODMIMAGE"],
properties: ["vendor", "device_specific"],
}
precompiled_sepolicy_prebuilts_defaults {
name: "precompiled_sepolicy_prebuilts",
soong_config_variables: {
BOARD_USES_ODMIMAGE: {
device_specific: true,
conditions_default: {
vendor: true,
},
},
},
}
//////////////////////////////////
// SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against
// which precompiled_policy was built.
//////////////////////////////////
prebuilt_etc {
defaults: ["precompiled_sepolicy_prebuilts"],
name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256",
src: ":plat_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
}
//////////////////////////////////
// SHA-256 digest of the apex_sepolicy.cil against which precompiled_policy
// was built.
//////////////////////////////////
prebuilt_etc {
defaults: ["precompiled_sepolicy_prebuilts"],
name: "precompiled_sepolicy.apex_sepolicy.sha256",
filename: "precompiled_sepolicy.apex_sepolicy.sha256",
src: ":apex_sepolicy.sha256_gen",
relative_install_path: "selinux",
}
//////////////////////////////////
// SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against
// which precompiled_policy was built.
//////////////////////////////////
prebuilt_etc {
defaults: ["precompiled_sepolicy_prebuilts"],
name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256",
src: ":system_ext_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
}
//////////////////////////////////
// SHA-256 digest of the product_sepolicy.cil and product_mapping_file against
// which precompiled_policy was built.
//////////////////////////////////
prebuilt_etc {
defaults: ["precompiled_sepolicy_prebuilts"],
name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256",
src: ":product_sepolicy_and_mapping.sha256_gen",
relative_install_path: "selinux",
}
soong_config_module_type {
name: "precompiled_se_policy_binary",
module_type: "se_policy_binary",
config_namespace: "ANDROID",
bool_variables: ["BOARD_USES_ODMIMAGE", "IS_TARGET_MIXED_SEPOLICY"],
value_variables: ["MIXED_SEPOLICY_VERSION"],
properties: ["vendor", "device_specific", "srcs", "ignore_neverallow"],
}
precompiled_se_policy_binary {
name: "precompiled_sepolicy",
srcs: [
":plat_sepolicy.cil",
":apex_sepolicy-33.cil",
":plat_pub_versioned.cil",
":system_ext_sepolicy.cil",
":product_sepolicy.cil",
":vendor_sepolicy.cil",
":odm_sepolicy.cil",
],
soong_config_variables: {
BOARD_USES_ODMIMAGE: {
device_specific: true,
conditions_default: {
vendor: true,
},
},
IS_TARGET_MIXED_SEPOLICY: {
ignore_neverallow: true,
},
MIXED_SEPOLICY_VERSION: {
srcs: [
":plat_%s.cil",
":system_ext_%s.cil",
":product_%s.cil",
],
conditions_default: {
srcs: [
":plat_mapping_file",
":system_ext_mapping_file",
":product_mapping_file",
],
},
},
},
required: [
"sepolicy_neverallows",
"sepolicy_neverallows_vendor",
],
dist: {
targets: ["base-sepolicy-files-for-mapping"],
},
}
// policy for recovery
se_policy_conf {
name: "recovery_sepolicy.conf",
srcs: plat_policies_for_vendor + [
":se_build_files{.plat_vendor_for_vendor}",
":se_build_files{.vendor}",
":se_build_files{.odm}",
],
target_recovery: true,
installable: false,
}
se_policy_cil {
name: "recovery_sepolicy.cil",
src: ":recovery_sepolicy.conf",
secilc_check: false, // will be done in se_policy_binary module
installable: false,
}
se_policy_binary {
name: "sepolicy.recovery",
srcs: [":recovery_sepolicy.cil"],
stem: "sepolicy",
recovery: true,
}
//////////////////////////////////
// SELinux policy embedded into CTS.
// CTS checks neverallow rules of this policy against the policy of the device under test.
//////////////////////////////////
se_policy_conf {
name: "general_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy,
build_variant: "user",
cts: true,
exclude_build_test: true,
}
//////////////////////////////////
// Base system policy for treble sepolicy tests.
// If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ
// with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case,
// BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil.
// See treble_sepolicy_tests_for_release.mk for more details.
//////////////////////////////////
se_policy_conf {
name: "base_plat_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy,
build_variant: "user",
installable: false,
}
se_policy_cil {
name: "base_plat_sepolicy.cil",
src: ":base_plat_sepolicy.conf",
additional_cil_files: ["private/technical_debt.cil"],
installable: false,
secilc_check: false, // done by se_policy_binary
}
se_policy_binary {
name: "base_plat_sepolicy",
srcs: [":base_plat_sepolicy.cil"],
installable: false,
dist: {
targets: ["base-sepolicy-files-for-mapping"],
},
}
se_policy_conf {
name: "base_system_ext_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy +
system_ext_public_policy +
system_ext_private_policy,
build_variant: "user",
installable: false,
}
se_policy_cil {
name: "base_system_ext_sepolicy.cil",
src: ":base_system_ext_sepolicy.conf",
additional_cil_files: ["private/technical_debt.cil"],
system_ext_specific: true,
installable: false,
secilc_check: false, // done by se_policy_binary
}
se_policy_binary {
name: "base_system_ext_sepolicy",
srcs: [":base_system_ext_sepolicy.cil"],
system_ext_specific: true,
installable: false,
}
se_policy_conf {
name: "base_product_sepolicy.conf",
srcs: plat_public_policy +
plat_private_policy +
system_ext_public_policy +
system_ext_private_policy +
product_public_policy +
product_private_policy,
build_variant: "user",
installable: false,
}
se_policy_cil {
name: "base_product_sepolicy.cil",
src: ":base_product_sepolicy.conf",
additional_cil_files: ["private/technical_debt.cil"],
product_specific: true,
installable: false,
secilc_check: false, // done by se_policy_binary
}
se_policy_binary {
name: "base_product_sepolicy",
srcs: [":base_product_sepolicy.cil"],
product_specific: true,
installable: false,