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