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 | e41e95e | 2024-02-13 02:19:24 +0000 | [diff] [blame^] | 340 | // HACK to support vendor blobs using 1000000.0 |
| 341 | // TODO(b/314010177): remove after new ToT (202404) fully propagates |
| 342 | se_versioned_policy { |
| 343 | name: "plat_mapping_file_1000000.0", |
| 344 | base: ":plat_pub_policy.cil", |
| 345 | mapping: true, |
| 346 | version: "1000000.0", |
| 347 | relative_install_path: "mapping", // install to /system/etc/selinux/mapping |
| 348 | } |
| 349 | |
| 350 | se_versioned_policy { |
| 351 | name: "system_ext_mapping_file_1000000.0", |
| 352 | base: ":system_ext_pub_policy.cil", |
| 353 | mapping: true, |
| 354 | version: "1000000.0", |
| 355 | filter_out: [":plat_mapping_file"], |
| 356 | relative_install_path: "mapping", // install to /system_ext/etc/selinux/mapping |
| 357 | system_ext_specific: true, |
| 358 | } |
| 359 | |
| 360 | se_versioned_policy { |
| 361 | name: "product_mapping_file_1000000.0", |
| 362 | base: ":pub_policy.cil", |
| 363 | mapping: true, |
| 364 | version: "1000000.0", |
| 365 | filter_out: [":plat_mapping_file", ":system_ext_mapping_file"], |
| 366 | relative_install_path: "mapping", // install to /product/etc/selinux/mapping |
| 367 | product_specific: true, |
| 368 | } |
| 369 | |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 370 | ////////////////////////////////// |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 371 | // vendor/odm sepolicy |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 372 | ////////////////////////////////// |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 373 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 374 | // plat_pub_versioned.cil - the exported platform policy associated with the version |
| 375 | // that non-platform policy targets. |
| 376 | se_versioned_policy { |
| 377 | name: "plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 378 | base: ":pub_policy.cil", |
| 379 | target_policy: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 380 | version: "vendor", |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 381 | vendor: true, |
| 382 | } |
| 383 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 384 | // vendor_policy.cil - the vendor sepolicy. This needs attributization and to be combined |
| 385 | // with the platform-provided policy. It makes use of the reqd_policy_mask files from private |
| 386 | // policy and the platform public policy files in order to use checkpolicy. |
| 387 | se_policy_conf { |
| 388 | name: "vendor_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 389 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 390 | srcs: plat_public_policy + |
| 391 | system_ext_public_policy + |
| 392 | product_public_policy + |
| 393 | reqd_mask_policy + [ |
| 394 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 395 | ":se_build_files{.vendor}", |
| 396 | ], |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 397 | vendor: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 398 | installable: false, |
| 399 | } |
| 400 | |
| 401 | se_policy_cil { |
| 402 | name: "vendor_sepolicy.cil.raw", |
| 403 | src: ":vendor_sepolicy.conf", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 404 | filter_out: [":reqd_policy_mask.cil"], |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 405 | secilc_check: false, // will be done in se_versioned_policy module |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 406 | vendor: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 407 | installable: false, |
| 408 | } |
| 409 | |
| 410 | se_versioned_policy { |
| 411 | name: "vendor_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 412 | base: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 413 | target_policy: ":vendor_sepolicy.cil.raw", |
| 414 | version: "vendor", |
| 415 | dependent_cils: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 416 | ":plat_sepolicy.cil", |
| 417 | ":system_ext_sepolicy.cil", |
| 418 | ":product_sepolicy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 419 | ":plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 420 | ":plat_mapping_file", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 421 | ], |
| 422 | filter_out: [":plat_pub_versioned.cil"], |
| 423 | vendor: true, |
| 424 | } |
| 425 | |
| 426 | // odm_policy.cil - the odl sepolicy. This needs attributization and to be combined |
| 427 | // with the platform-provided policy. It makes use of the reqd_policy_mask files from private |
| 428 | // policy and the platform public policy files in order to use checkpolicy. |
| 429 | se_policy_conf { |
| 430 | name: "odm_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 431 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 432 | srcs: plat_public_policy + |
| 433 | system_ext_public_policy + |
| 434 | product_public_policy + |
| 435 | reqd_mask_policy + [ |
| 436 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 437 | ":se_build_files{.vendor}", |
| 438 | ":se_build_files{.odm}", |
| 439 | ], |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 440 | device_specific: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 441 | installable: false, |
| 442 | } |
| 443 | |
| 444 | se_policy_cil { |
| 445 | name: "odm_sepolicy.cil.raw", |
| 446 | src: ":odm_sepolicy.conf", |
| 447 | filter_out: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 448 | ":reqd_policy_mask.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 449 | ":vendor_sepolicy.cil", |
| 450 | ], |
| 451 | secilc_check: false, // will be done in se_versioned_policy module |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 452 | device_specific: true, |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 453 | installable: false, |
| 454 | } |
| 455 | |
| 456 | se_versioned_policy { |
| 457 | name: "odm_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 458 | base: ":pub_policy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 459 | target_policy: ":odm_sepolicy.cil.raw", |
| 460 | version: "vendor", |
| 461 | dependent_cils: [ |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 462 | ":plat_sepolicy.cil", |
| 463 | ":system_ext_sepolicy.cil", |
| 464 | ":product_sepolicy.cil", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 465 | ":plat_pub_versioned.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 466 | ":plat_mapping_file", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 467 | ":vendor_sepolicy.cil", |
| 468 | ], |
| 469 | filter_out: [":plat_pub_versioned.cil", ":vendor_sepolicy.cil"], |
| 470 | device_specific: true, |
| 471 | } |
| 472 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 473 | ////////////////////////////////// |
| 474 | // Precompiled sepolicy is loaded if and only if: |
| 475 | // - plat_sepolicy_and_mapping.sha256 equals |
| 476 | // precompiled_sepolicy.plat_sepolicy_and_mapping.sha256 |
| 477 | // AND |
| 478 | // - system_ext_sepolicy_and_mapping.sha256 equals |
| 479 | // precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256 |
| 480 | // AND |
| 481 | // - product_sepolicy_and_mapping.sha256 equals |
| 482 | // precompiled_sepolicy.product_sepolicy_and_mapping.sha256 |
| 483 | // See system/core/init/selinux.cpp for details. |
| 484 | ////////////////////////////////// |
| 485 | genrule { |
| 486 | name: "plat_sepolicy_and_mapping.sha256_gen", |
| 487 | srcs: [":plat_sepolicy.cil", ":plat_mapping_file"], |
| 488 | out: ["plat_sepolicy_and_mapping.sha256"], |
| 489 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 490 | } |
| 491 | |
| 492 | prebuilt_etc { |
| 493 | name: "plat_sepolicy_and_mapping.sha256", |
| 494 | filename: "plat_sepolicy_and_mapping.sha256", |
| 495 | src: ":plat_sepolicy_and_mapping.sha256_gen", |
| 496 | relative_install_path: "selinux", |
| 497 | } |
| 498 | |
| 499 | genrule { |
| 500 | name: "system_ext_sepolicy_and_mapping.sha256_gen", |
| 501 | srcs: [":system_ext_sepolicy.cil", ":system_ext_mapping_file"], |
| 502 | out: ["system_ext_sepolicy_and_mapping.sha256"], |
| 503 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 504 | } |
| 505 | |
| 506 | prebuilt_etc { |
| 507 | name: "system_ext_sepolicy_and_mapping.sha256", |
| 508 | filename: "system_ext_sepolicy_and_mapping.sha256", |
| 509 | src: ":system_ext_sepolicy_and_mapping.sha256_gen", |
| 510 | relative_install_path: "selinux", |
| 511 | system_ext_specific: true, |
| 512 | } |
| 513 | |
| 514 | genrule { |
| 515 | name: "product_sepolicy_and_mapping.sha256_gen", |
| 516 | srcs: [":product_sepolicy.cil", ":product_mapping_file"], |
| 517 | out: ["product_sepolicy_and_mapping.sha256"], |
| 518 | cmd: "cat $(in) | sha256sum | cut -d' ' -f1 > $(out)", |
| 519 | } |
| 520 | |
| 521 | prebuilt_etc { |
| 522 | name: "product_sepolicy_and_mapping.sha256", |
| 523 | filename: "product_sepolicy_and_mapping.sha256", |
| 524 | src: ":product_sepolicy_and_mapping.sha256_gen", |
| 525 | relative_install_path: "selinux", |
| 526 | product_specific: true, |
| 527 | } |
| 528 | |
Inseob Kim | 1c056b1 | 2021-04-30 00:11:43 +0900 | [diff] [blame] | 529 | sepolicy_vers { |
| 530 | name: "plat_sepolicy_vers.txt", |
| 531 | version: "vendor", |
| 532 | vendor: true, |
| 533 | } |
| 534 | |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 535 | soong_config_module_type { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 536 | name: "precompiled_sepolicy_prebuilts_defaults", |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 537 | module_type: "prebuilt_defaults", |
| 538 | config_namespace: "ANDROID", |
| 539 | bool_variables: ["BOARD_USES_ODMIMAGE"], |
| 540 | properties: ["vendor", "device_specific"], |
| 541 | } |
| 542 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 543 | precompiled_sepolicy_prebuilts_defaults { |
| 544 | name: "precompiled_sepolicy_prebuilts", |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 545 | soong_config_variables: { |
| 546 | BOARD_USES_ODMIMAGE: { |
| 547 | device_specific: true, |
| 548 | conditions_default: { |
| 549 | vendor: true, |
| 550 | }, |
| 551 | }, |
| 552 | }, |
| 553 | } |
| 554 | |
| 555 | ////////////////////////////////// |
| 556 | // SHA-256 digest of the plat_sepolicy.cil and plat_mapping_file against |
| 557 | // which precompiled_policy was built. |
| 558 | ////////////////////////////////// |
| 559 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 560 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 561 | name: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256", |
| 562 | filename: "precompiled_sepolicy.plat_sepolicy_and_mapping.sha256", |
| 563 | src: ":plat_sepolicy_and_mapping.sha256_gen", |
| 564 | relative_install_path: "selinux", |
| 565 | } |
| 566 | |
| 567 | ////////////////////////////////// |
| 568 | // SHA-256 digest of the system_ext_sepolicy.cil and system_ext_mapping_file against |
| 569 | // which precompiled_policy was built. |
| 570 | ////////////////////////////////// |
| 571 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 572 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 573 | name: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256", |
| 574 | filename: "precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256", |
| 575 | src: ":system_ext_sepolicy_and_mapping.sha256_gen", |
| 576 | relative_install_path: "selinux", |
| 577 | } |
| 578 | |
| 579 | ////////////////////////////////// |
| 580 | // SHA-256 digest of the product_sepolicy.cil and product_mapping_file against |
| 581 | // which precompiled_policy was built. |
| 582 | ////////////////////////////////// |
| 583 | prebuilt_etc { |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 584 | defaults: ["precompiled_sepolicy_prebuilts"], |
Inseob Kim | 731182a | 2021-05-06 11:44:37 +0000 | [diff] [blame] | 585 | name: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256", |
| 586 | filename: "precompiled_sepolicy.product_sepolicy_and_mapping.sha256", |
| 587 | src: ":product_sepolicy_and_mapping.sha256_gen", |
| 588 | relative_install_path: "selinux", |
| 589 | } |
| 590 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 591 | soong_config_module_type { |
| 592 | name: "precompiled_se_policy_binary", |
| 593 | module_type: "se_policy_binary", |
| 594 | config_namespace: "ANDROID", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 595 | bool_variables: ["BOARD_USES_ODMIMAGE"], |
| 596 | properties: ["vendor", "device_specific"], |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 597 | } |
| 598 | |
Garfield Tan | d8c51f2 | 2023-10-02 14:17:04 -0700 | [diff] [blame] | 599 | filegroup { |
| 600 | name: "precompiled_sepolicy_srcs", |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 601 | srcs: [ |
| 602 | ":plat_sepolicy.cil", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 603 | ":plat_pub_versioned.cil", |
| 604 | ":system_ext_sepolicy.cil", |
| 605 | ":product_sepolicy.cil", |
| 606 | ":vendor_sepolicy.cil", |
| 607 | ":odm_sepolicy.cil", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 608 | ":plat_mapping_file", |
| 609 | ":system_ext_mapping_file", |
| 610 | ":product_mapping_file", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 611 | ], |
Garfield Tan | d8c51f2 | 2023-10-02 14:17:04 -0700 | [diff] [blame] | 612 | // Make precompiled_sepolicy_srcs as public so that OEMs have access to them. |
| 613 | // Useful when some partitions need to be bind mounted across VM boundaries. |
| 614 | visibility: ["//visibility:public"], |
| 615 | } |
| 616 | |
| 617 | precompiled_se_policy_binary { |
| 618 | name: "precompiled_sepolicy", |
| 619 | srcs: [ |
| 620 | ":precompiled_sepolicy_srcs", |
| 621 | ], |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 622 | soong_config_variables: { |
| 623 | BOARD_USES_ODMIMAGE: { |
| 624 | device_specific: true, |
| 625 | conditions_default: { |
| 626 | vendor: true, |
| 627 | }, |
| 628 | }, |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 629 | }, |
| 630 | required: [ |
| 631 | "sepolicy_neverallows", |
Sandro | 143988d | 2022-08-05 11:38:56 +0000 | [diff] [blame] | 632 | ], |
| 633 | dist: { |
| 634 | targets: ["base-sepolicy-files-for-mapping"], |
| 635 | }, |
| 636 | } |
| 637 | |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 638 | // policy for recovery |
| 639 | se_policy_conf { |
| 640 | name: "recovery_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 641 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 642 | srcs: plat_public_policy + |
| 643 | plat_private_policy + |
| 644 | system_ext_public_policy + |
| 645 | system_ext_private_policy + |
| 646 | product_public_policy + |
| 647 | product_private_policy + [ |
| 648 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 649 | ":se_build_files{.vendor}", |
| 650 | ":se_build_files{.odm}", |
| 651 | ], |
| 652 | target_recovery: true, |
| 653 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 654 | recovery: true, |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | se_policy_cil { |
| 658 | name: "recovery_sepolicy.cil", |
| 659 | src: ":recovery_sepolicy.conf", |
| 660 | secilc_check: false, // will be done in se_policy_binary module |
| 661 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 662 | recovery: true, |
Inseob Kim | 5bbcd68 | 2021-12-28 14:57:03 +0900 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | se_policy_binary { |
| 666 | name: "sepolicy.recovery", |
| 667 | srcs: [":recovery_sepolicy.cil"], |
| 668 | stem: "sepolicy", |
| 669 | recovery: true, |
| 670 | } |
| 671 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 672 | ////////////////////////////////// |
| 673 | // SELinux policy embedded into CTS. |
| 674 | // CTS checks neverallow rules of this policy against the policy of the device under test. |
| 675 | ////////////////////////////////// |
| 676 | se_policy_conf { |
| 677 | name: "general_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 678 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 679 | srcs: plat_public_policy + |
| 680 | plat_private_policy, |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 681 | build_variant: "user", |
| 682 | cts: true, |
| 683 | exclude_build_test: true, |
| 684 | } |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 685 | |
| 686 | ////////////////////////////////// |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 687 | // Base system policy for treble sepolicy tests. |
| 688 | // If system sepolicy is extended (e.g. by SoC vendors), their plat_pub_versioned.cil may differ |
| 689 | // with system/sepolicy/prebuilts/api/{version}/plat_pub_versioned.cil. In that case, |
| 690 | // BOARD_PLAT_PUB_VERSIONED_POLICY can be used to specify extended plat_pub_versioned.cil. |
| 691 | // See treble_sepolicy_tests_for_release.mk for more details. |
| 692 | ////////////////////////////////// |
| 693 | se_policy_conf { |
| 694 | name: "base_plat_sepolicy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 695 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 696 | srcs: plat_public_policy + |
| 697 | plat_private_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 698 | build_variant: "user", |
| 699 | installable: false, |
| 700 | } |
| 701 | |
| 702 | se_policy_cil { |
| 703 | name: "base_plat_sepolicy.cil", |
| 704 | src: ":base_plat_sepolicy.conf", |
| 705 | additional_cil_files: ["private/technical_debt.cil"], |
| 706 | installable: false, |
| 707 | secilc_check: false, // done by se_policy_binary |
| 708 | } |
| 709 | |
| 710 | se_policy_binary { |
| 711 | name: "base_plat_sepolicy", |
| 712 | srcs: [":base_plat_sepolicy.cil"], |
| 713 | installable: false, |
Inseob Kim | eec3919 | 2022-01-21 11:47:54 +0900 | [diff] [blame] | 714 | dist: { |
| 715 | targets: ["base-sepolicy-files-for-mapping"], |
| 716 | }, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 717 | } |
| 718 | |
| 719 | se_policy_conf { |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 720 | name: "base_product_sepolicy.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 | plat_private_policy + |
| 724 | system_ext_public_policy + |
| 725 | system_ext_private_policy + |
| 726 | product_public_policy + |
| 727 | product_private_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 728 | build_variant: "user", |
| 729 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 730 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | se_policy_cil { |
| 734 | name: "base_product_sepolicy.cil", |
| 735 | src: ":base_product_sepolicy.conf", |
| 736 | additional_cil_files: ["private/technical_debt.cil"], |
| 737 | product_specific: true, |
| 738 | installable: false, |
| 739 | secilc_check: false, // done by se_policy_binary |
| 740 | } |
| 741 | |
| 742 | se_policy_binary { |
| 743 | name: "base_product_sepolicy", |
| 744 | srcs: [":base_product_sepolicy.cil"], |
| 745 | product_specific: true, |
| 746 | installable: false, |
| 747 | } |
| 748 | |
| 749 | se_policy_conf { |
| 750 | name: "base_plat_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 751 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 752 | srcs: plat_public_policy + |
| 753 | reqd_mask_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 754 | build_variant: "user", |
| 755 | installable: false, |
| 756 | } |
| 757 | |
| 758 | se_policy_cil { |
| 759 | name: "base_plat_pub_policy.cil", |
| 760 | src: ":base_plat_pub_policy.conf", |
| 761 | filter_out: [":reqd_policy_mask.cil"], |
| 762 | secilc_check: false, |
| 763 | installable: false, |
Inseob Kim | eec3919 | 2022-01-21 11:47:54 +0900 | [diff] [blame] | 764 | dist: { |
| 765 | targets: ["base-sepolicy-files-for-mapping"], |
| 766 | }, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 767 | } |
| 768 | |
| 769 | se_policy_conf { |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 770 | name: "base_product_pub_policy.conf", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 771 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0a707fa | 2021-12-09 23:35:11 +0900 | [diff] [blame] | 772 | srcs: plat_public_policy + |
| 773 | system_ext_public_policy + |
| 774 | product_public_policy + |
| 775 | reqd_mask_policy, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 776 | build_variant: "user", |
| 777 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 778 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | se_policy_cil { |
| 782 | name: "base_product_pub_policy.cil", |
| 783 | src: ":base_product_pub_policy.conf", |
| 784 | filter_out: [":reqd_policy_mask.cil"], |
| 785 | secilc_check: false, |
| 786 | installable: false, |
Inseob Kim | 6c6f53b | 2023-04-26 11:03:35 +0900 | [diff] [blame] | 787 | product_specific: true, |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 788 | } |
| 789 | |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 790 | // bug_map - Bug tracking information for selinux denials loaded by auditd. |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 791 | se_build_files { |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 792 | name: "bug_map_files", |
| 793 | srcs: ["bug_map"], |
| 794 | } |
| 795 | |
| 796 | se_bug_map { |
| 797 | name: "plat_bug_map", |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 798 | srcs: [":bug_map_files{.plat_private}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 799 | stem: "bug_map", |
| 800 | } |
| 801 | |
| 802 | se_bug_map { |
| 803 | name: "system_ext_bug_map", |
Inseob Kim | 4196403 | 2022-04-22 07:50:22 +0900 | [diff] [blame] | 804 | srcs: [":bug_map_files{.system_ext_private}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 805 | stem: "bug_map", |
| 806 | system_ext_specific: true, |
| 807 | } |
| 808 | |
| 809 | se_bug_map { |
| 810 | name: "vendor_bug_map", |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 811 | srcs: [":bug_map_files{.vendor}", ":bug_map_files{.plat_vendor}"], |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 812 | // Legacy file name of the vendor partition bug_map. |
| 813 | stem: "selinux_denial_metadata", |
| 814 | vendor: true, |
| 815 | } |
| 816 | |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 817 | se_neverallow_test { |
| 818 | name: "sepolicy_neverallows", |
Inseob Kim | 085f22f | 2023-11-09 11:13:01 +0900 | [diff] [blame] | 819 | defaults: ["se_policy_conf_flags_defaults"], |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 820 | srcs: plat_public_policy + |
| 821 | plat_private_policy + |
| 822 | system_ext_public_policy + |
| 823 | system_ext_private_policy + |
| 824 | product_public_policy + |
Inseob Kim | 6c6aa01 | 2023-08-31 16:47:38 +0900 | [diff] [blame] | 825 | product_private_policy + [ |
| 826 | ":se_build_files{.plat_vendor}", |
Inseob Kim | 0de7fcc | 2021-12-22 23:06:53 +0900 | [diff] [blame] | 827 | ":se_build_files{.vendor}", |
| 828 | ":se_build_files{.odm}", |
| 829 | ], |
| 830 | } |
| 831 | |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 832 | ////////////////////////////////// |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 833 | // se_freeze_test compares the plat sepolicy with the prebuilt sepolicy |
| 834 | // Additional directories can be specified via Makefile variables: |
| 835 | // SEPOLICY_FREEZE_TEST_EXTRA_DIRS and SEPOLICY_FREEZE_TEST_EXTRA_PREBUILT_DIRS. |
| 836 | ////////////////////////////////// |
| 837 | se_freeze_test { |
Inseob Kim | 36d9d39 | 2023-09-04 17:40:03 +0900 | [diff] [blame] | 838 | name: "se_freeze_test", |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 839 | } |
Inseob Kim | 61257ca | 2022-02-25 11:26:16 +0900 | [diff] [blame] | 840 | |
| 841 | ////////////////////////////////// |
| 842 | // sepolicy_test checks various types of violations, which can't be easily done |
| 843 | // by CIL itself. Refer tests/sepolicy_tests.py for more detail. |
| 844 | ////////////////////////////////// |
| 845 | genrule { |
| 846 | name: "sepolicy_test", |
| 847 | srcs: [ |
| 848 | ":plat_file_contexts", |
| 849 | ":vendor_file_contexts", |
| 850 | ":system_ext_file_contexts", |
| 851 | ":product_file_contexts", |
| 852 | ":odm_file_contexts", |
| 853 | ":precompiled_sepolicy", |
| 854 | ], |
| 855 | tools: ["sepolicy_tests"], |
| 856 | out: ["sepolicy_test"], |
| 857 | cmd: "$(location sepolicy_tests) " + |
| 858 | "-f $(location :plat_file_contexts) " + |
| 859 | "-f $(location :vendor_file_contexts) " + |
| 860 | "-f $(location :system_ext_file_contexts) " + |
| 861 | "-f $(location :product_file_contexts) " + |
| 862 | "-f $(location :odm_file_contexts) " + |
| 863 | "-p $(location :precompiled_sepolicy) && " + |
| 864 | "touch $(out)", |
| 865 | } |
Inseob Kim | 3a9d91c | 2023-09-27 17:39:07 +0900 | [diff] [blame] | 866 | |
| 867 | ////////////////////////////////// |
| 868 | // TestDevTypeViolations can't run on old devices (V or before) |
| 869 | ////////////////////////////////// |
| 870 | |
| 871 | soong_config_module_type { |
| 872 | name: "dev_type_test_genrule", |
| 873 | module_type: "genrule", |
| 874 | config_namespace: "ANDROID", |
| 875 | bool_variables: ["CHECK_DEV_TYPE_VIOLATIONS"], |
| 876 | properties: ["cmd"], |
| 877 | } |
| 878 | |
| 879 | dev_type_test_genrule { |
| 880 | name: "sepolicy_dev_type_test", |
| 881 | srcs: [ |
| 882 | ":plat_file_contexts", |
| 883 | ":vendor_file_contexts", |
| 884 | ":system_ext_file_contexts", |
| 885 | ":product_file_contexts", |
| 886 | ":odm_file_contexts", |
| 887 | ":precompiled_sepolicy", |
| 888 | ], |
| 889 | tools: ["sepolicy_tests"], |
| 890 | out: ["sepolicy_dev_type_test"], |
| 891 | soong_config_variables: { |
| 892 | CHECK_DEV_TYPE_VIOLATIONS: { |
| 893 | cmd: "$(location sepolicy_tests) " + |
| 894 | "-f $(location :plat_file_contexts) " + |
| 895 | "-f $(location :vendor_file_contexts) " + |
| 896 | "-f $(location :system_ext_file_contexts) " + |
| 897 | "-f $(location :product_file_contexts) " + |
| 898 | "-f $(location :odm_file_contexts) " + |
| 899 | "-p $(location :precompiled_sepolicy) " + |
| 900 | "-t TestDevTypeViolations && " + |
| 901 | "touch $(out)", |
| 902 | conditions_default: { |
| 903 | cmd: "touch $(out)", |
| 904 | }, |
| 905 | }, |
| 906 | }, |
| 907 | } |