Ravi Kumar Siddojigari | 125f548 | 2017-12-01 12:51:48 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
| 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions are |
| 5 | # met: |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of The Linux Foundation nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | type hal-server, domain; |
| 29 | type hal-server_exec, exec_type, vendor_file_type, file_type; |
| 30 | |
| 31 | # need to hw_service |
| 32 | typeattribute hal-server hal_audio_server; |
| 33 | typeattribute hal-server hal_sensors_server; |
| 34 | typeattribute hal-server hal_broadcastradio_server; |
| 35 | typeattribute hal-server hal_drm_server; |
Mahesh Lanka | d7a0f1d | 2017-12-05 18:55:08 +0530 | [diff] [blame] | 36 | typeattribute hal-serverĀ hal_drm; |
Ravi Kumar Siddojigari | 125f548 | 2017-12-01 12:51:48 +0530 | [diff] [blame] | 37 | typeattribute hal-server hal_configstore_client; |
| 38 | |
| 39 | init_daemon_domain(hal-server) |
| 40 | |
| 41 | ############################ |
| 42 | # Common section which is generic |
| 43 | # needed by most of the domains/services |
| 44 | # |
| 45 | vndbinder_use(hal-server) |
| 46 | use_per_mgr(hal-server) |
| 47 | hwbinder_use(hal-server) |
| 48 | |
| 49 | get_prop(hal-server, hwservicemanager_prop) |
| 50 | |
| 51 | #DRM/Audio need this |
| 52 | r_dir_file(hal-server, firmware_file) |
| 53 | |
| 54 | #reading of system_file and execute is already provided via domain.te |
| 55 | allow hal-server system_file:lnk_file r_file_perms; |
| 56 | |
| 57 | # Read access to pseudo filesystems |
| 58 | allow hal-server cgroup:dir create_dir_perms; |
| 59 | allow hal-server cgroup:file rw_file_perms; |
| 60 | r_dir_file(hal-server, system_file) |
| 61 | |
| 62 | ########################## |
| 63 | # Audio services |
| 64 | # |
| 65 | |
| 66 | # Allow hal-server to read soundcard state under /proc/asound |
| 67 | r_dir_file(hal-server, proc_audiod) |
| 68 | |
| 69 | # Need this for reading of /proc/asound/cards |
| 70 | # hal_audio (/system/sepolicy has this) looks like this |
| 71 | # is genric node . |
| 72 | r_dir_file(hal-server, proc) |
| 73 | |
| 74 | allow hal-server audio_data_file:dir rw_dir_perms; |
| 75 | allow hal-server audio_data_file:file create_file_perms; |
| 76 | |
| 77 | #r_dir_file(hal_audio, proc) |
| 78 | allow hal-server audio_device:dir r_dir_perms; |
| 79 | allow hal-server audio_device:chr_file rw_file_perms; |
| 80 | |
| 81 | #Set scheduling info for apps ( picked for system_server public file) |
| 82 | allow system_server hal-server:process { getsched setsched }; |
| 83 | |
| 84 | # Allow hal_audio_default to read sysfs_thermal dir/files for speaker protection |
| 85 | r_dir_file(hal-server, sysfs_thermal) |
| 86 | |
| 87 | #Allow hal audio to use Binder IPC |
| 88 | |
| 89 | userdebug_or_eng(` |
| 90 | diag_use(hal-server) |
| 91 | #Allow access to debug fs |
| 92 | allow hal-server debugfs:dir r_dir_perms; |
| 93 | allow hal-server qti_debugfs:dir r_dir_perms; |
| 94 | allow hal-server qti_debugfs:file rw_file_perms; |
| 95 | ') |
| 96 | |
| 97 | #Split A2dp specific |
| 98 | binder_call(hal-server,bluetooth) |
| 99 | |
| 100 | #for perf hal call |
| 101 | hal_client_domain(hal-server, hal_perf) |
| 102 | #allow acess to wcd_cpe |
| 103 | allow hal-server sysfs_audio:file rw_file_perms; |
| 104 | allow hal-server sysfs_audio:dir r_dir_perms; |
Ramjee Singh | 5e92146 | 2017-12-12 20:35:23 +0530 | [diff] [blame] | 105 | #allow access to adsp boot for peripheral manager |
| 106 | allow hal-server sysfs_boot:file w_file_perms ; |
Ravi Kumar Siddojigari | 125f548 | 2017-12-01 12:51:48 +0530 | [diff] [blame] | 107 | |
| 108 | ########################## |
| 109 | # sensors services |
| 110 | # |
| 111 | allow hal-server hidl_base_hwservice:hwservice_manager add; |
| 112 | allow hal-server sysfs_sensors:dir r_dir_perms; |
| 113 | allow hal-server sysfs_sensors:file rw_file_perms; |
| 114 | allow hal-server sysfs_sensors:lnk_file read; |
| 115 | allow hal-server input_device:dir r_dir_perms; |
| 116 | allow hal-server input_device:chr_file r_file_perms; |
| 117 | allow hal-server persist_file:dir search; |
| 118 | |
| 119 | ########################## |
| 120 | # DRM services |
| 121 | # |
| 122 | # Required by Widevine DRM (b/22990512) |
| 123 | allow hal-server self:process execmem; |
| 124 | |
| 125 | # Read files already opened under /data |
| 126 | allow hal-server system_data_file:dir { search getattr }; |
| 127 | allow hal-server system_data_file:file { getattr read }; |
| 128 | allow hal-server system_data_file:lnk_file r_file_perms; |
| 129 | |
| 130 | # Allow access to ion memory allocation device |
| 131 | allow hal-server ion_device:chr_file rw_file_perms; |
| 132 | allow hal-server hal_graphics_allocator:fd use; |
Divya Narayanan Poojary | 22ce170 | 2017-12-28 14:43:39 +0530 | [diff] [blame] | 133 | allow hal-server hal_allocator:fd use; |
Ravi Kumar Siddojigari | 125f548 | 2017-12-01 12:51:48 +0530 | [diff] [blame] | 134 | |
| 135 | # Allow access to fds allocated by mediaserver |
| 136 | allow hal-server mediaserver:fd use; |
| 137 | |
| 138 | # Allow access to app_data and media_data_files |
| 139 | allow hal-server media_data_file:dir create_dir_perms; |
| 140 | allow hal-server media_data_file:file create_file_perms; |
| 141 | |
| 142 | allow hal-server sysfs:file r_file_perms; |
| 143 | |
Mahesh Lanka | d7a0f1d | 2017-12-05 18:55:08 +0530 | [diff] [blame] | 144 | allow hal-server serialno_prop:file read; |
| 145 | allow hal-server untrusted_app_25:fd use; |
| 146 | |
Ravi Kumar Siddojigari | 125f548 | 2017-12-01 12:51:48 +0530 | [diff] [blame] | 147 | ########################## |
| 148 | # Config Store |
| 149 | # |
| 150 | #TODO: Need to clean this up later |
| 151 | allow hal_graphics_composer_default sysfs:file r_file_perms; |
| 152 | |
| 153 | binder_call(hal_configstore_server, hal-server) |
| 154 | binder_call(hal_sensors_server, hal-server) |
| 155 | binder_call(hal_drm_default, hal-server) |
| 156 | binder_call(hal_audio_server, hal-server) |
| 157 | binder_call(hal-server, hal_audio_server) |
| 158 | |
| 159 | ############## |
| 160 | # for add_hwservice replacement |
| 161 | # |
| 162 | allow hal-server hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find; |
| 163 | allow hal-server hal_sensors_hwservice:hwservice_manager find; |
| 164 | allow hal-server hal_audio_hwservice:hwservice_manager find; |
| 165 | allow hal-server hal_drm_hwservice:hwservice_manager find; |
| 166 | allow hal_sensors_default hidl_base_hwservice:hwservice_manager add; |