| # Copyright (c) 2018, The Linux Foundation. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| # met: |
| # * Redistributions of source code must retain the above copyright |
| # notice, this list of conditions and the following disclaimer. |
| # * Redistributions in binary form must reproduce the above |
| # copyright notice, this list of conditions and the following |
| # disclaimer in the documentation and/or other materials provided |
| # with the distribution. |
| # * Neither the name of The Linux Foundation nor the names of its |
| # contributors may be used to endorse or promote products derived |
| # from this software without specific prior written permission. |
| # |
| # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| typeattribute mirrorlink coredomain; |
| type mirrorlink_exec, exec_type, system_file_type, file_type; |
| |
| # Allow for transition from init to mirrorlink domain upon executing binary. |
| init_daemon_domain(mirrorlink) |
| |
| # Inherit a base set of permissions required for network access. |
| net_domain(mirrorlink) |
| |
| # Allow socket permissions on netlink_kobject_uevent_socket. |
| allow mirrorlink self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; |
| |
| # Allow socket permissions on udp_socket. |
| allowxperm mirrorlink self:udp_socket ioctl { SIOCGIFFLAGS SIOCSIFFLAGS SIOCGIFCONF SIOCGIFADDR SIOCGIFMTU }; |
| |
| # Allow access to mirrorlink_data_file (/data/misc/mirrorlinkserver) |
| allow mirrorlink mirrorlink_data_file:file create_file_perms; |
| allow mirrorlink mirrorlink_data_file:dir create_dir_perms; |
| # Allow read-write permissions to mirrorlink sockets under dev/socket/. |
| allow mirrorlink mirrorlink_socket:sock_file { read write }; |
| |
| # Allow local socket connection from mirrorlink domain to netd domain via netd_socket. |
| unix_socket_connect(mirrorlink, netd, netd); |
| |
| # Allow read-write access to proc net device. |
| allow mirrorlink proc_net:file rw_file_perms; |
| |
| # Allow read-write access to uhid device for HID event injection. |
| allow mirrorlink uhid_device:chr_file rw_file_perms; |
| |
| # Allow binder IPC with surfaceflinger, audioserver, mediametrics and system_app services. |
| allow mirrorlink audioserver_service:service_manager find; |
| allow mirrorlink surfaceflinger_service:service_manager find; |
| allow mirrorlink mediametrics_service:service_manager find; |
| binder_use(mirrorlink); |
| binder_call(mirrorlink, surfaceflinger); |
| binder_call(mirrorlink, audioserver); |
| binder_call(mirrorlink, system_app); |
| |
| # Allow access to PCM sound card. |
| allow mirrorlink audio_device:chr_file rw_file_perms; |
| allow mirrorlink audio_device:dir r_dir_perms; |
| |
| # Allow access to /proc/asound/pcm file |
| r_dir_file(mirrorlink, proc_asound) |
| |
| # Allow a base set of permissions for mirrorlinkserver to be a client of graphics composer HAL. |
| hal_client_domain(mirrorlink, hal_graphics_composer); |
| |
| # Allow a base set of permissions for mirrorlinkserver to be a client of graphics allocator HAL. |
| hal_client_domain(mirrorlink, hal_graphics_allocator); |
| |
| # Allow RW access to USB properties. |
| set_prop(mirrorlink, exported_system_radio_prop); |
| get_prop(mirrorlink, system_prop); |
| |
| # Allow access to usb ncm state from net |
| allow mirrorlink sysfs_net:dir r_dir_perms; |
| allow mirrorlink sysfs_net:file r_file_perms; |
| |
| # Allow read access to EGL lib |
| allow mirrorlink system_file:dir r_dir_perms; |
| |
| # Allow read-write access to gpu device. |
| allow mirrorlink gpu_device:chr_file rw_file_perms; |
| |
| # Allow access to video encoder device. |
| allow mirrorlink video_device:chr_file rw_file_perms; |
| |
| # Allow read access to mirrorlink specific property type. |
| get_prop(mirrorlink, vendor_mirrorlink_prop); |