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 | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 106 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 107 | srcs: reqd_mask_policy, |
Inseob Kim | e35b49b | 2021-02-18 19:15:41 +0900 | [diff] [blame] | 108 | installable: false, |
| 109 | } |
| 110 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 111 | se_policy_cil { |
| 112 | name: "reqd_policy_mask.cil", |
| 113 | src: ":reqd_policy_mask.conf", |
| 114 | secilc_check: false, |
| 115 | installable: false, |
Inseob Kim | e35b49b | 2021-02-18 19:15:41 +0900 | [diff] [blame] | 116 | } |
| 117 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 118 | // pub_policy - policy that will be exported to be a part of non-platform |
| 119 | // policy corresponding to this platform version. |
| 120 | // |
| 121 | // This is a limited subset of policy that would not compile in checkpolicy on |
| 122 | // its own. |
| 123 | // |
| 124 | // To get around this limitation, add only the required files from private |
| 125 | // policy, which will generate CIL policy that will then be filtered out by the |
| 126 | // reqd_policy_mask. |
| 127 | // |
| 128 | // There are three pub_policy.cil files below: |
| 129 | // - pub_policy.cil: exported 'product', 'system_ext' and 'system' policy. |
| 130 | // - system_ext_pub_policy.cil: exported 'system_ext' and 'system' policy. |
| 131 | // - plat_pub_policy.cil: exported 'system' policy. |
| 132 | // |
| 133 | // Those above files will in turn be used to generate the following versioned cil files: |
| 134 | // - product_mapping_file: the versioned, exported 'product' policy in product partition. |
| 135 | // - system_ext_mapping_file: the versioned, exported 'system_ext' policy in system_ext partition. |
| 136 | // - plat_mapping_file: the versioned, exported 'system' policy in system partition. |
| 137 | // - plat_pub_versioned.cil: the versioned, exported 'product', 'system_ext' and 'system' policy |
| 138 | // in vendor partition. |
| 139 | // |
| 140 | se_policy_conf { |
| 141 | name: "pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 142 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 143 | srcs: plat_public_policy + |
| 144 | system_ext_public_policy + |
| 145 | product_public_policy + |
| 146 | reqd_mask_policy, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 147 | vendor: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 148 | installable: false, |
| 149 | } |
| 150 | |
| 151 | se_policy_cil { |
| 152 | name: "pub_policy.cil", |
| 153 | src: ":pub_policy.conf", |
| 154 | filter_out: [":reqd_policy_mask.cil"], |
| 155 | secilc_check: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 156 | vendor: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 157 | installable: false, |
| 158 | } |
| 159 | |
| 160 | se_policy_conf { |
| 161 | name: "system_ext_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 162 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 163 | srcs: plat_public_policy + |
| 164 | system_ext_public_policy + |
| 165 | reqd_mask_policy, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 166 | system_ext_specific: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 167 | installable: false, |
| 168 | } |
| 169 | |
| 170 | se_policy_cil { |
| 171 | name: "system_ext_pub_policy.cil", |
| 172 | src: ":system_ext_pub_policy.conf", |
| 173 | filter_out: [":reqd_policy_mask.cil"], |
| 174 | secilc_check: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 175 | system_ext_specific: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 176 | installable: false, |
| 177 | } |
| 178 | |
| 179 | se_policy_conf { |
| 180 | name: "plat_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 181 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 182 | srcs: plat_public_policy + |
| 183 | reqd_mask_policy, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 184 | installable: false, |
| 185 | } |
| 186 | |
| 187 | se_policy_cil { |
| 188 | name: "plat_pub_policy.cil", |
| 189 | src: ":plat_pub_policy.conf", |
| 190 | filter_out: [":reqd_policy_mask.cil"], |
| 191 | secilc_check: false, |
| 192 | installable: false, |
| 193 | } |
| 194 | |
| 195 | // plat_policy.conf - A combination of the private and public platform policy |
| 196 | // which will ship with the device. |
| 197 | // |
| 198 | // The platform will always reflect the most recent platform version and is not |
| 199 | // currently being attributized. |
| 200 | se_policy_conf { |
| 201 | name: "plat_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 202 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 203 | srcs: plat_public_policy + |
| 204 | plat_private_policy, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 205 | installable: false, |
| 206 | } |
| 207 | |
| 208 | se_policy_cil { |
| 209 | name: "plat_sepolicy.cil", |
| 210 | src: ":plat_sepolicy.conf", |
Inseob Kim | 7cb2081 | 2021-12-16 16:52:14 +0900 | [diff] [blame] | 211 | additional_cil_files: [":sepolicy_technical_debt{.plat_private}"], |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 212 | } |
| 213 | |
Lokesh Gidra | 1269a17 | 2022-08-01 17:20:38 +0000 | [diff] [blame] | 214 | |
Inseob Kim | 6cc75f4 | 2021-04-29 13:53:20 +0000 | [diff] [blame] | 215 | // userdebug_plat_policy.conf - the userdebug version plat_sepolicy.cil |
| 216 | se_policy_conf { |
| 217 | name: "userdebug_plat_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 218 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 219 | srcs: plat_public_policy + |
| 220 | plat_private_policy, |
Inseob Kim | 6cc75f4 | 2021-04-29 13:53:20 +0000 | [diff] [blame] | 221 | build_variant: "userdebug", |
| 222 | installable: false, |
| 223 | } |
| 224 | |
| 225 | se_policy_cil { |
| 226 | name: "userdebug_plat_sepolicy.cil", |
| 227 | src: ":userdebug_plat_sepolicy.conf", |
Inseob Kim | 7cb2081 | 2021-12-16 16:52:14 +0900 | [diff] [blame] | 228 | additional_cil_files: [":sepolicy_technical_debt{.plat_private}"], |
Inseob Kim | 6cc75f4 | 2021-04-29 13:53:20 +0000 | [diff] [blame] | 229 | debug_ramdisk: true, |
Yi-Yo Chiang | 68478b1 | 2021-10-16 03:23:05 +0800 | [diff] [blame] | 230 | dist: { |
| 231 | targets: ["droidcore"], |
| 232 | }, |
Inseob Kim | 6cc75f4 | 2021-04-29 13:53:20 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Yi-Yo Chiang | 857ffc4 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 235 | // A copy of the userdebug_plat_policy in GSI. |
| 236 | soong_config_module_type { |
| 237 | name: "gsi_se_policy_cil", |
| 238 | module_type: "se_policy_cil", |
| 239 | config_namespace: "ANDROID", |
| 240 | bool_variables: [ |
| 241 | "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT", |
| 242 | ], |
| 243 | properties: [ |
| 244 | "enabled", |
| 245 | "installable", |
| 246 | ], |
| 247 | } |
| 248 | |
| 249 | gsi_se_policy_cil { |
| 250 | name: "system_ext_userdebug_plat_sepolicy.cil", |
| 251 | stem: "userdebug_plat_sepolicy.cil", |
| 252 | src: ":userdebug_plat_sepolicy.conf", |
Inseob Kim | 7cb2081 | 2021-12-16 16:52:14 +0900 | [diff] [blame] | 253 | additional_cil_files: [":sepolicy_technical_debt{.plat_private}"], |
Yi-Yo Chiang | 857ffc4 | 2021-09-23 14:14:16 +0000 | [diff] [blame] | 254 | system_ext_specific: true, |
| 255 | enabled: false, |
| 256 | installable: false, |
| 257 | soong_config_variables: { |
| 258 | PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: { |
| 259 | enabled: true, |
| 260 | installable: true, |
| 261 | }, |
| 262 | }, |
| 263 | } |
| 264 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 265 | // system_ext_policy.conf - A combination of the private and public system_ext |
| 266 | // policy which will ship with the device. System_ext policy is not attributized |
| 267 | se_policy_conf { |
| 268 | name: "system_ext_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 269 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 270 | srcs: plat_public_policy + |
| 271 | plat_private_policy + |
| 272 | system_ext_public_policy + |
| 273 | system_ext_private_policy, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 274 | system_ext_specific: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 275 | installable: false, |
| 276 | } |
| 277 | |
| 278 | se_policy_cil { |
| 279 | name: "system_ext_sepolicy.cil", |
| 280 | src: ":system_ext_sepolicy.conf", |
| 281 | system_ext_specific: true, |
| 282 | filter_out: [":plat_sepolicy.cil"], |
| 283 | remove_line_marker: true, |
| 284 | } |
| 285 | |
| 286 | // product_policy.conf - A combination of the private and public product policy |
| 287 | // which will ship with the device. Product policy is not attributized |
| 288 | se_policy_conf { |
| 289 | name: "product_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 290 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 291 | srcs: plat_public_policy + |
| 292 | plat_private_policy + |
| 293 | system_ext_public_policy + |
| 294 | system_ext_private_policy + |
| 295 | product_public_policy + |
| 296 | product_private_policy, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 297 | product_specific: true, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 298 | installable: false, |
| 299 | } |
| 300 | |
| 301 | se_policy_cil { |
| 302 | name: "product_sepolicy.cil", |
| 303 | src: ":product_sepolicy.conf", |
| 304 | product_specific: true, |
| 305 | filter_out: [":plat_sepolicy.cil", ":system_ext_sepolicy.cil"], |
| 306 | remove_line_marker: true, |
| 307 | } |
| 308 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 309 | // policy mapping files |
| 310 | // auto-generate the mapping file for current platform policy, since it needs to |
| 311 | // track platform policy development |
| 312 | se_versioned_policy { |
| 313 | name: "plat_mapping_file", |
| 314 | base: ":plat_pub_policy.cil", |
| 315 | mapping: true, |
| 316 | version: "current", |
| 317 | relative_install_path: "mapping", // install to /system/etc/selinux/mapping |
| 318 | } |
| 319 | |
| 320 | se_versioned_policy { |
| 321 | name: "system_ext_mapping_file", |
| 322 | base: ":system_ext_pub_policy.cil", |
| 323 | mapping: true, |
| 324 | version: "current", |
| 325 | filter_out: [":plat_mapping_file"], |
| 326 | relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping |
| 327 | system_ext_specific: true, |
| 328 | } |
| 329 | |
| 330 | se_versioned_policy { |
| 331 | name: "product_mapping_file", |
| 332 | base: ":pub_policy.cil", |
| 333 | mapping: true, |
| 334 | version: "current", |
| 335 | filter_out: [":plat_mapping_file", ":system_ext_mapping_file"], |
| 336 | relative_install_path: "mapping", // install to /product/etc/selinux/mapping |
| 337 | product_specific: true, |
| 338 | } |
| 339 | |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 340 | ////////////////////////////////// |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 341 | // vendor/odm sepolicy |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 342 | ////////////////////////////////// |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 343 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 344 | // plat_pub_versioned.cil - the exported platform policy associated with the version |
| 345 | // that non-platform policy targets. |
| 346 | se_versioned_policy { |
| 347 | name: "plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 348 | base: ":pub_policy.cil", |
| 349 | target_policy: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 350 | version: "vendor", |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 351 | vendor: true, |
| 352 | } |
| 353 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 354 | // vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined |
| 355 | // with the platform-provided policy. It makes use of the reqd_policy_mask files from private |
| 356 | // policy and the platform public policy files in order to use checkpolicy. |
| 357 | se_policy_conf { |
| 358 | name: "vendor_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 359 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 360 | srcs: plat_public_policy + |
| 361 | system_ext_public_policy + |
| 362 | product_public_policy + |
| 363 | reqd_mask_policy + [ |
| 364 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 365 | ":se_build_files{.vendor}", |
| 366 | ], |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 367 | vendor: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 368 | installable: false, |
| 369 | } |
| 370 | |
| 371 | se_policy_cil { |
| 372 | name: "vendor_sepolicy.cil.raw", |
| 373 | src: ":vendor_sepolicy.conf", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 374 | filter_out: [":reqd_policy_mask.cil"], |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 375 | secilc_check: false, // will be done in se_versioned_policy module |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 376 | vendor: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 377 | installable: false, |
| 378 | } |
| 379 | |
| 380 | se_versioned_policy { |
| 381 | name: "vendor_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 382 | base: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 383 | target_policy: ":vendor_sepolicy.cil.raw", |
| 384 | version: "vendor", |
| 385 | dependent_cils: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 386 | ":plat_sepolicy.cil", |
| 387 | ":system_ext_sepolicy.cil", |
| 388 | ":product_sepolicy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 389 | ":plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 390 | ":plat_mapping_file", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 391 | ], |
| 392 | filter_out: [":plat_pub_versioned.cil"], |
| 393 | vendor: true, |
| 394 | } |
| 395 | |
| 396 | // odm_policy.cil - the odl sepolicy. This needs attributization and to be combined |
| 397 | // with the platform-provided policy. It makes use of the reqd_policy_mask files from private |
| 398 | // policy and the platform public policy files in order to use checkpolicy. |
| 399 | se_policy_conf { |
| 400 | name: "odm_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 401 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 402 | srcs: plat_public_policy + |
| 403 | system_ext_public_policy + |
| 404 | product_public_policy + |
| 405 | reqd_mask_policy + [ |
| 406 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 407 | ":se_build_files{.vendor}", |
| 408 | ":se_build_files{.odm}", |
| 409 | ], |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 410 | device_specific: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 411 | installable: false, |
| 412 | } |
| 413 | |
| 414 | se_policy_cil { |
| 415 | name: "odm_sepolicy.cil.raw", |
| 416 | src: ":odm_sepolicy.conf", |
| 417 | filter_out: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 418 | ":reqd_policy_mask.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 419 | ":vendor_sepolicy.cil", |
| 420 | ], |
| 421 | secilc_check: false, // will be done in se_versioned_policy module |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 422 | device_specific: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 423 | installable: false, |
| 424 | } |
| 425 | |
| 426 | se_versioned_policy { |
| 427 | name: "odm_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 428 | base: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 429 | target_policy: ":odm_sepolicy.cil.raw", |
| 430 | version: "vendor", |
| 431 | dependent_cils: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 432 | ":plat_sepolicy.cil", |
| 433 | ":system_ext_sepolicy.cil", |
| 434 | ":product_sepolicy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 435 | ":plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 436 | ":plat_mapping_file", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 437 | ":vendor_sepolicy.cil", |
| 438 | ], |
| 439 | filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"], |
| 440 | device_specific: true, |
| 441 | } |
| 442 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 443 | ////////////////////////////////// |
| 444 | // Precompiled sepolicy is loaded if and only if: |
| 445 | // - plat_sepolicy_and_mapping.sha256 equals |
| 446 | // precompiled_sepolicy.plat_sepolicy_and_mapping.sha256 |
| 447 | // AND |
| 448 | // - system_ext_sepolicy_and_mapping.sha256 equals |
| 449 | // precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256 |
| 450 | // AND |
| 451 | // - product_sepolicy_and_mapping.sha256 equals |
| 452 | // precompiled_sepolicy.product_sepolicy_and_mapping.sha256 |
| 453 | // See system/core/init/selinux.cpp for details. |
| 454 | ////////////////////////////////// |
| 455 | genrule { |
| 456 | name: "plat_sepolicy_and_mapping.sha256_gen", |
| 457 | srcs: [":plat_sepolicy.cil", ":plat_mapping_file"], |
| 458 | out: ["plat_sepolicy_and_mapping.sha256"], |
| 459 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 460 | } |
| 461 | |
| 462 | prebuilt_etc { |
| 463 | name: "plat_sepolicy_and_mapping.sha256", |
| 464 | filename: "plat_sepolicy_and_mapping.sha256", |
| 465 | src: ":plat_sepolicy_and_mapping.sha256_gen", |
| 466 | relative_install_path: "selinux", |
| 467 | } |
| 468 | |
| 469 | genrule { |
| 470 | name: "system_ext_sepolicy_and_mapping.sha256_gen", |
| 471 | srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"], |
| 472 | out: ["system_ext_sepolicy_and_mapping.sha256"], |
| 473 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 474 | } |
| 475 | |
| 476 | prebuilt_etc { |
| 477 | name: "system_ext_sepolicy_and_mapping.sha256", |
| 478 | filename: "system_ext_sepolicy_and_mapping.sha256", |
| 479 | src: ":system_ext_sepolicy_and_mapping.sha256_gen", |
| 480 | relative_install_path: "selinux", |
| 481 | system_ext_specific: true, |
| 482 | } |
| 483 | |
| 484 | genrule { |
| 485 | name: "product_sepolicy_and_mapping.sha256_gen", |
| 486 | srcs: [":product_sepolicy.cil", ":product_mapping_file"], |
| 487 | out: ["product_sepolicy_and_mapping.sha256"], |
| 488 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 489 | } |
| 490 | |
| 491 | prebuilt_etc { |
| 492 | name: "product_sepolicy_and_mapping.sha256", |
| 493 | filename: "product_sepolicy_and_mapping.sha256", |
| 494 | src: ":product_sepolicy_and_mapping.sha256_gen", |
| 495 | relative_install_path: "selinux", |
| 496 | product_specific: true, |
| 497 | } |
| 498 | |
Inseob Kim | 1c056b1 | 2021-04-30 00:11:43 +0900 | [diff] [blame] | 499 | sepolicy_vers { |
| 500 | name: "plat_sepolicy_vers.txt", |
| 501 | version: "vendor", |
| 502 | vendor: true, |
| 503 | } |
| 504 | |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 505 | soong_config_module_type { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 506 | name: "precompiled_sepolicy_prebuilts_defaults", |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 507 | module_type: "prebuilt_defaults", |
| 508 | config_namespace: "ANDROID", |
| 509 | bool_variables: ["BOARD_USES_ODMIMAGE"], |
| 510 | properties: ["vendor", "device_specific"], |
| 511 | } |
| 512 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 513 | precompiled_sepolicy_prebuilts_defaults { |
| 514 | name: "precompiled_sepolicy_prebuilts", |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 515 | soong_config_variables: { |
| 516 | BOARD_USES_ODMIMAGE: { |
| 517 | device_specific: true, |
| 518 | conditions_default: { |
| 519 | vendor: true, |
| 520 | }, |
| 521 | }, |
| 522 | }, |
| 523 | } |
| 524 | |
| 525 | ////////////////////////////////// |
| 526 | // SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against |
| 527 | // which precompiled_policy was built. |
| 528 | ////////////////////////////////// |
| 529 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 530 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 531 | name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256", |
| 532 | filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256", |
| 533 | src: ":plat_sepolicy_and_mapping.sha256_gen", |
| 534 | relative_install_path: "selinux", |
| 535 | } |
| 536 | |
| 537 | ////////////////////////////////// |
| 538 | // SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against |
| 539 | // which precompiled_policy was built. |
| 540 | ////////////////////////////////// |
| 541 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 542 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 543 | name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256", |
| 544 | filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256", |
| 545 | src: ":system_ext_sepolicy_and_mapping.sha256_gen", |
| 546 | relative_install_path: "selinux", |
| 547 | } |
| 548 | |
| 549 | ////////////////////////////////// |
| 550 | // SHA-256 digest of the product_sepolicy.cil and product_mapping_file against |
| 551 | // which precompiled_policy was built. |
| 552 | ////////////////////////////////// |
| 553 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 554 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 555 | name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256", |
| 556 | filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256", |
| 557 | src: ":product_sepolicy_and_mapping.sha256_gen", |
| 558 | relative_install_path: "selinux", |
| 559 | } |
| 560 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 561 | soong_config_module_type { |
| 562 | name: "precompiled_se_policy_binary", |
| 563 | module_type: "se_policy_binary", |
| 564 | config_namespace: "ANDROID", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 565 | bool_variables: ["BOARD_USES_ODMIMAGE"], |
| 566 | properties: ["vendor", "device_specific"], |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 567 | } |
| 568 | |
Garfield Tan | d8c51f2 | 2023-10-02 14:17:04 -0700 | [diff] [blame] | 569 | filegroup { |
| 570 | name: "precompiled_sepolicy_srcs", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 571 | srcs: [ |
| 572 | ":plat_sepolicy.cil", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 573 | ":plat_pub_versioned.cil", |
| 574 | ":system_ext_sepolicy.cil", |
| 575 | ":product_sepolicy.cil", |
| 576 | ":vendor_sepolicy.cil", |
| 577 | ":odm_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 578 | ":plat_mapping_file", |
| 579 | ":system_ext_mapping_file", |
| 580 | ":product_mapping_file", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 581 | ], |
Garfield Tan | d8c51f2 | 2023-10-02 14:17:04 -0700 | [diff] [blame] | 582 | // Make precompiled_sepolicy_srcs as public so that OEMs have access to them. |
| 583 | // Useful when some partitions need to be bind mounted across VM boundaries. |
| 584 | visibility: ["//visibility:public"], |
| 585 | } |
| 586 | |
| 587 | precompiled_se_policy_binary { |
| 588 | name: "precompiled_sepolicy", |
| 589 | srcs: [ |
| 590 | ":precompiled_sepolicy_srcs", |
| 591 | ], |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 592 | soong_config_variables: { |
| 593 | BOARD_USES_ODMIMAGE: { |
| 594 | device_specific: true, |
| 595 | conditions_default: { |
| 596 | vendor: true, |
| 597 | }, |
| 598 | }, |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 599 | }, |
| 600 | required: [ |
| 601 | "sepolicy_neverallows", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 602 | ], |
| 603 | dist: { |
| 604 | targets: ["base-sepolicy-files-for-mapping"], |
| 605 | }, |
| 606 | } |
| 607 | |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 608 | // policy for recovery |
| 609 | se_policy_conf { |
| 610 | name: "recovery_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 611 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 612 | srcs: plat_public_policy + |
| 613 | plat_private_policy + |
| 614 | system_ext_public_policy + |
| 615 | system_ext_private_policy + |
| 616 | product_public_policy + |
| 617 | product_private_policy + [ |
| 618 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 619 | ":se_build_files{.vendor}", |
| 620 | ":se_build_files{.odm}", |
| 621 | ], |
| 622 | target_recovery: true, |
| 623 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 624 | recovery: true, |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | se_policy_cil { |
| 628 | name: "recovery_sepolicy.cil", |
| 629 | src: ":recovery_sepolicy.conf", |
| 630 | secilc_check: false, // will be done in se_policy_binary module |
| 631 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 632 | recovery: true, |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 633 | } |
| 634 | |
| 635 | se_policy_binary { |
| 636 | name: "sepolicy.recovery", |
| 637 | srcs: [":recovery_sepolicy.cil"], |
| 638 | stem: "sepolicy", |
| 639 | recovery: true, |
| 640 | } |
| 641 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 642 | ////////////////////////////////// |
| 643 | // SELinux policy embedded into CTS. |
| 644 | // CTS checks neverallow rules of this policy against the policy of the device under test. |
| 645 | ////////////////////////////////// |
| 646 | se_policy_conf { |
| 647 | name: "general_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 648 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 649 | srcs: plat_public_policy + |
| 650 | plat_private_policy, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 651 | build_variant: "user", |
| 652 | cts: true, |
| 653 | exclude_build_test: true, |
| 654 | } |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 655 | |
| 656 | ////////////////////////////////// |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 657 | // Base system policy for treble sepolicy tests. |
| 658 | // If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ |
| 659 | // with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case, |
| 660 | // BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil. |
| 661 | // See treble_sepolicy_tests_for_release.mk for more details. |
| 662 | ////////////////////////////////// |
| 663 | se_policy_conf { |
| 664 | name: "base_plat_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 665 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 666 | srcs: plat_public_policy + |
| 667 | plat_private_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 668 | build_variant: "user", |
| 669 | installable: false, |
| 670 | } |
| 671 | |
| 672 | se_policy_cil { |
| 673 | name: "base_plat_sepolicy.cil", |
| 674 | src: ":base_plat_sepolicy.conf", |
| 675 | additional_cil_files: ["private/technical_debt.cil"], |
| 676 | installable: false, |
| 677 | secilc_check: false, // done by se_policy_binary |
| 678 | } |
| 679 | |
| 680 | se_policy_binary { |
| 681 | name: "base_plat_sepolicy", |
| 682 | srcs: [":base_plat_sepolicy.cil"], |
| 683 | installable: false, |
Inseob Kim | eec3919 | 2022-01-21 11:47:54 +0900 | [diff] [blame] | 684 | dist: { |
| 685 | targets: ["base-sepolicy-files-for-mapping"], |
| 686 | }, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | se_policy_conf { |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 690 | name: "base_product_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 691 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 692 | srcs: plat_public_policy + |
| 693 | plat_private_policy + |
| 694 | system_ext_public_policy + |
| 695 | system_ext_private_policy + |
| 696 | product_public_policy + |
| 697 | product_private_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 698 | build_variant: "user", |
| 699 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 700 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | se_policy_cil { |
| 704 | name: "base_product_sepolicy.cil", |
| 705 | src: ":base_product_sepolicy.conf", |
| 706 | additional_cil_files: ["private/technical_debt.cil"], |
| 707 | product_specific: true, |
| 708 | installable: false, |
| 709 | secilc_check: false, // done by se_policy_binary |
| 710 | } |
| 711 | |
| 712 | se_policy_binary { |
| 713 | name: "base_product_sepolicy", |
| 714 | srcs: [":base_product_sepolicy.cil"], |
| 715 | product_specific: true, |
| 716 | installable: false, |
| 717 | } |
| 718 | |
| 719 | se_policy_conf { |
| 720 | name: "base_plat_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 721 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 722 | srcs: plat_public_policy + |
| 723 | reqd_mask_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 724 | build_variant: "user", |
| 725 | installable: false, |
| 726 | } |
| 727 | |
| 728 | se_policy_cil { |
| 729 | name: "base_plat_pub_policy.cil", |
| 730 | src: ":base_plat_pub_policy.conf", |
| 731 | filter_out: [":reqd_policy_mask.cil"], |
| 732 | secilc_check: false, |
| 733 | installable: false, |
Inseob Kim | eec3919 | 2022-01-21 11:47:54 +0900 | [diff] [blame] | 734 | dist: { |
| 735 | targets: ["base-sepolicy-files-for-mapping"], |
| 736 | }, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | se_policy_conf { |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 740 | name: "base_product_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 741 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 742 | srcs: plat_public_policy + |
| 743 | system_ext_public_policy + |
| 744 | product_public_policy + |
| 745 | reqd_mask_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 746 | build_variant: "user", |
| 747 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 748 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | se_policy_cil { |
| 752 | name: "base_product_pub_policy.cil", |
| 753 | src: ":base_product_pub_policy.conf", |
| 754 | filter_out: [":reqd_policy_mask.cil"], |
| 755 | secilc_check: false, |
| 756 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 757 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 758 | } |
| 759 | |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 760 | // bug_map - Bug tracking information for selinux denials loaded by auditd. |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 761 | se_build_files { |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 762 | name: "bug_map_files", |
| 763 | srcs: ["bug_map"], |
| 764 | } |
| 765 | |
| 766 | se_bug_map { |
| 767 | name: "plat_bug_map", |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 768 | srcs: [":bug_map_files{.plat_private}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 769 | stem: "bug_map", |
| 770 | } |
| 771 | |
| 772 | se_bug_map { |
| 773 | name: "system_ext_bug_map", |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 774 | srcs: [":bug_map_files{.system_ext_private}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 775 | stem: "bug_map", |
| 776 | system_ext_specific: true, |
| 777 | } |
| 778 | |
| 779 | se_bug_map { |
| 780 | name: "vendor_bug_map", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 781 | srcs: [":bug_map_files{.vendor}", ":bug_map_files{.plat_vendor}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 782 | // Legacy file name of the vendor partition bug_map. |
| 783 | stem: "selinux_denial_metadata", |
| 784 | vendor: true, |
| 785 | } |
| 786 | |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 787 | se_neverallow_test { |
| 788 | name: "sepolicy_neverallows", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 789 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 790 | srcs: plat_public_policy + |
| 791 | plat_private_policy + |
| 792 | system_ext_public_policy + |
| 793 | system_ext_private_policy + |
| 794 | product_public_policy + |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 795 | product_private_policy + [ |
| 796 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 797 | ":se_build_files{.vendor}", |
| 798 | ":se_build_files{.odm}", |
| 799 | ], |
| 800 | } |
| 801 | |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 802 | ////////////////////////////////// |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 803 | // se_freeze_test compares the plat sepolicy with the prebuilt sepolicy |
| 804 | // Additional directories can be specified via Makefile variables: |
| 805 | // SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS. |
| 806 | ////////////////////////////////// |
| 807 | se_freeze_test { |
Inseob Kim | 36d9d39 | 2023-09-04 17:40:03 +0900 | [diff] [blame] | 808 | name: "se_freeze_test", |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 809 | } |
Inseob Kim | 61257ca | 2022-02-25 11:26:16 +0900 | [diff] [blame] | 810 | |
| 811 | ////////////////////////////////// |
| 812 | // sepolicy_test checks various types of violations, which can't be easily done |
| 813 | // by CIL itself. Refer tests/sepolicy_tests.py for more detail. |
| 814 | ////////////////////////////////// |
| 815 | genrule { |
| 816 | name: "sepolicy_test", |
| 817 | srcs: [ |
| 818 | ":plat_file_contexts", |
| 819 | ":vendor_file_contexts", |
| 820 | ":system_ext_file_contexts", |
| 821 | ":product_file_contexts", |
| 822 | ":odm_file_contexts", |
| 823 | ":precompiled_sepolicy", |
| 824 | ], |
| 825 | tools: ["sepolicy_tests"], |
| 826 | out: ["sepolicy_test"], |
| 827 | cmd: "$(location sepolicy_tests) " + |
| 828 | "-f $(location :plat_file_contexts) " + |
| 829 | "-f $(location :vendor_file_contexts) " + |
| 830 | "-f $(location :system_ext_file_contexts) " + |
| 831 | "-f $(location :product_file_contexts) " + |
| 832 | "-f $(location :odm_file_contexts) " + |
| 833 | "-p $(location :precompiled_sepolicy) && " + |
| 834 | "touch $(out)", |
| 835 | } |