Deepak Kushwah | fb797d9 | 2017-06-30 18:53:23 +0530 | [diff] [blame] | 1 | # Copyright (c) 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 | typeattribute wfdservice coredomain; |
Pawan Chilka | 300b38c | 2017-07-12 18:49:55 +0530 | [diff] [blame] | 29 | |
| 30 | #Allow for transition from init domain to wfdservice |
| 31 | init_daemon_domain(wfdservice) |
| 32 | |
| 33 | #Inherit base socket permissions from netd domain |
| 34 | net_domain(wfdservice) |
| 35 | |
| 36 | #Allow wfdservice to use Binder IPC |
| 37 | binder_use(wfdservice) |
| 38 | |
| 39 | #Allow for interaction with Display HAL |
| 40 | binder_call(wfdservice, surfaceflinger) |
| 41 | binder_call(surfaceflinger, wfdservice) |
| 42 | |
| 43 | #Allow apps to interact with wfdservice |
| 44 | binder_call(wfdservice, platform_app) |
| 45 | binder_call(platform_app, wfdservice) |
| 46 | binder_call(wfdservice, system_app) |
| 47 | binder_call(system_app, wfdservice) |
| 48 | |
| 49 | #Allow access to Audio Flinger APIs |
| 50 | binder_call(wfdservice, audioserver) |
| 51 | |
| 52 | #Allow access to Permission Controller in System Server |
| 53 | binder_call(wfdservice, system_server) |
| 54 | |
| 55 | # Mark wfdservice as a Binder service domain |
| 56 | binder_service(wfdservice) |
| 57 | |
| 58 | #Allow wfdservice to be registered with service manager |
| 59 | allow wfdservice wfdservice_service:service_manager add; |
| 60 | |
| 61 | #Allow access to PCM sound card |
| 62 | allow wfdservice audio_device:chr_file rw_file_perms; |
| 63 | allow wfdservice audio_device:dir r_dir_perms; |
| 64 | |
| 65 | #Allow access to /dev/graphics/fb* for screen capture |
| 66 | allow wfdservice graphics_device:chr_file rw_file_perms; |
| 67 | |
| 68 | #Allow access to encoder for YUV statistics |
| 69 | allow wfdservice gpu_device:chr_file rw_file_perms; |
| 70 | |
Pawan Chilka | 300b38c | 2017-07-12 18:49:55 +0530 | [diff] [blame] | 71 | #Allow access to /dev/video/* devices for encoding/decoding |
| 72 | allow wfdservice video_device:chr_file rw_file_perms; |
| 73 | allow wfdservice video_device:dir r_dir_perms; |
| 74 | |
| 75 | #Allow access to tee device for HDCP sessions |
| 76 | allow wfdservice tee_device:chr_file rw_file_perms; |
| 77 | |
| 78 | #Allow access to uhid driver for HID event injection |
| 79 | allow wfdservice uhid_device:chr_file rw_file_perms; |
| 80 | |
| 81 | #Allow PROT_EXEC for 3rd party library loaded by wfdservice |
| 82 | allow wfdservice self:process execmem; |
| 83 | |
| 84 | userdebug_or_eng(` |
| 85 | #Allow access to read mmosal_logmask file in /data partition |
| 86 | allow wfdservice system_data_file:file r_file_perms; |
| 87 | #Allow access to dump encoder/decoder dumps in /data/misc/media |
| 88 | allow wfdservice media_data_file:dir w_dir_perms; |
| 89 | allow wfdservice media_data_file:file create_file_perms; |
| 90 | ') |
| 91 | |
| 92 | #Allow access to /data/media for dumping |
| 93 | allow wfdservice media_rw_data_file:dir create_dir_perms; |
| 94 | allow wfdservice media_rw_data_file:file create_file_perms; |
| 95 | |
| 96 | allow wfdservice self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; |
| 97 | |
| 98 | # Allow access to input_device for touch input detection |
| 99 | allow wfdservice input_device:dir r_dir_perms; |
| 100 | allow wfdservice input_device:chr_file r_file_perms; |
| 101 | |
| 102 | # Allow access to mediaserver, surfaceflinger and permissionmanager |
| 103 | # for interaction of wfdservice |
| 104 | allow wfdservice {audioserver_service permission_service surfaceflinger_service wfdservice_service}: service_manager find; |
| 105 | |
| 106 | #Allow setting of net_admin capability so that libnl API's can be used |
| 107 | allow wfdservice self:capability net_admin; |
| 108 | |
| 109 | #allow binder call to mediacodec from wfdservice |
| 110 | binder_call(wfdservice, mediacodec); |
| 111 | |
| 112 | #Allow wfdservice to query interface name of network (p2p etc.) |
| 113 | allow wfdservice self:netlink_socket create_socket_perms_no_ioctl; |
Amit Kumar | 036eab7 | 2017-12-05 15:52:50 +0530 | [diff] [blame] | 114 | allow wfdservice self:netlink_generic_socket create_socket_perms_no_ioctl; |
Pawan Chilka | 300b38c | 2017-07-12 18:49:55 +0530 | [diff] [blame] | 115 | |
| 116 | #Allow ion device access |
| 117 | allow wfdservice ion_device:chr_file r_file_perms; |
| 118 | |
| 119 | #Allow udp socket ioctl |
| 120 | allow wfdservice self:udp_socket ioctl; |
| 121 | |
| 122 | # ioctlcmd=8bff |
| 123 | allowxperm wfdservice self:udp_socket ioctl priv_sock_ioctls; |
| 124 | |
| 125 | #Allow access to proc/net/arp |
| 126 | allow wfdservice proc_net:file r_file_perms; |