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