blob: 69eea43b33a026b755e0c19882ad6238878b5e0c [file] [log] [blame]
# Copyright (c) 2017,2019-2021 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.
#Define Domain
type vendor_wifidisplayhalservice_qti, domain;
type vendor_wifidisplayhalservice_qti_exec, exec_type, vendor_file_type, file_type;
#Allow for transition from init domain to wifidisplayhalservice
init_daemon_domain(vendor_wifidisplayhalservice_qti)
#Inherit base network permissions from netd
net_domain(vendor_wifidisplayhalservice_qti)
#Allow wifidisplayhalservice to use Vendor Binder IPC
vndbinder_use(vendor_wifidisplayhalservice)
hal_server_domain_bypass(vendor_wifidisplayhalservice_qti,vendor_wifidisplayhalservice)
# Allow hwbinder call from hal client to server
binder_call(vendor_wifidisplayhalservice_client, vendor_wifidisplayhalservice_server)
binder_call(vendor_wifidisplayhalservice_server, vendor_wifidisplayhalservice_client)
# Add hwservice related rules
hal_attribute_hwservice(vendor_wifidisplayhalservice, vendor_wifidisplayhalservice_hwservice)
#Direct streaming native service
add_service(vendor_wifidisplayhalservice_qti, vendor_wfdnativemm_service)
#Allow access to firmware files for HDCP session
r_dir_file(vendor_wifidisplayhalservice_qti, firmware_file)
#Allow access to tee/ion device and tcp socket for HDCP sessions
allow vendor_wifidisplayhalservice_qti tee_device:chr_file rw_file_perms;
#Allow access to PCM sound card
allow vendor_wifidisplayhalservice_qti audio_device:chr_file rw_file_perms;
allow vendor_wifidisplayhalservice_qti audio_device:dir r_dir_perms;
#Allow access for audio hal
hal_client_domain(vendor_wifidisplayhalservice_qti, hal_audio)
#Allow access to /dev/video/* devices for encoding/decoding
allow vendor_wifidisplayhalservice_qti video_device:chr_file rw_file_perms;
#Allow binder call to mediacodec from wifidisplayhalservice
binder_call(vendor_wifidisplayhalservice_qti, mediacodec);
#Allow udp socket ioctl
allow vendor_wifidisplayhalservice_qti self:udp_socket create_socket_perms;
# ioctlcmd=8bff,8912
allowxperm vendor_wifidisplayhalservice_qti self:udp_socket ioctl priv_sock_ioctls;
#Allow access to proc/net/arp
allow vendor_wifidisplayhalservice_qti proc_net:file r_file_perms;
# Add the rule for wfd to access /proc/asound/pcm file
r_dir_file(vendor_wifidisplayhalservice_qti, proc_asound)
# Add the rule for wfd to access /proc/asound/card0/state file
r_dir_file(vendor_wifidisplayhalservice_qti, vendor_proc_audiod)
#Allow hal graphics allocator permissions
hal_client_domain(vendor_wifidisplayhalservice_qti, hal_graphics_allocator);
#Allow hal graphics mapper permissions
hal_client_domain(vendor_wifidisplayhalservice_qti, hal_graphics_composer);
#Allow vendor_wifidisplayhalservice_qti to query interface name of network (p2p etc.)
allow vendor_wifidisplayhalservice_qti self:netlink_generic_socket create_socket_perms_no_ioctl;
#Allow communication with init over property server
unix_socket_connect(vendor_wifidisplayhalservice_qti, property, init);
#Allow ion device access
allow vendor_wifidisplayhalservice_qti ion_device:chr_file r_file_perms;
#Allow /dev/dma_heap file access
allow vendor_wifidisplayhalservice_qti vendor_dmabuf_system_heap_device:chr_file r_file_perms;
allow vendor_wifidisplayhalservice_qti vendor_dmabuf_qseecom_heap_device:chr_file r_file_perms;
allow vendor_wifidisplayhalservice_qti vendor_dmabuf_display_heap_device:chr_file r_file_perms;
allow vendor_wifidisplayhalservice_qti vendor_dmabuf_qseecom_ta_heap_device:chr_file r_file_perms;
allow vendor_wifidisplayhalservice_qti vendor_vm_cp_bitstream_device:chr_file r_file_perms;
allow vendor_wifidisplayhalservice_qti vendor_membuf_dev:chr_file r_file_perms;
#Allow /dev/qce file access
allow vendor_wifidisplayhalservice_qti vendor_qce_device:chr_file rw_file_perms;
userdebug_or_eng(`
#Allow for property access
get_prop(vendor_wifidisplayhalservice_qti,vendor_wfd_vendor_debug_prop)
#Allow to dump in /data/vendor/media/
allow vendor_wifidisplayhalservice_qti vendor_media_data_file:dir w_dir_perms;
allow vendor_wifidisplayhalservice_qti vendor_media_data_file:file create_file_perms;
#Allow to access logmask file in /data/vendor
allow vendor_wifidisplayhalservice_qti vendor_data_file:file r_file_perms;
')
#Allow source to access video SKU and UBWC property(for encoder config)
get_prop(vendor_wifidisplayhalservice_qti, vendor_video_prop)
#Allow access to uhid driver for HID event injection
allow vendor_wifidisplayhalservice_qti uhid_device:chr_file rw_file_perms;
#Fallback for seccomp
crash_dump_fallback(vendor_wifidisplayhalservice_qti)