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