blob: aab69b04af7b8eba0c33ba69b45f0257aa3fcc23 [file] [log] [blame]
Biswajit Paul28439f92015-07-15 13:28:27 -07001# Copyright (c) 2015, 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# RIDL
Biswajit Paul6786a922017-03-16 11:53:53 -070029type RIDL, domain;
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +053030type RIDL_exec, exec_type, vendor_file_type, file_type;
Biswajit Paul28439f92015-07-15 13:28:27 -070031
Biswajit Paul28439f92015-07-15 13:28:27 -070032allow RIDL RIDL_socket:sock_file create_file_perms;
33allow RIDL RIDL_socket:dir create_dir_perms;
34
35# make transition from init to its domain
36init_daemon_domain(RIDL)
37
38# allow socket connections to us
39net_domain(RIDL)
40
41allow RIDL RIDL_data_file:dir create_dir_perms;
42allow RIDL RIDL_data_file:file create_file_perms;
43allow RIDL RIDL_data_file:lnk_file { create read unlink };
Biswajit Paul9d2dd042017-02-01 12:38:16 -080044userdebug_or_eng(`
Ravi Kumar Siddojigari92eed182017-06-27 00:25:03 +053045allow RIDL qti_debugfs:file read;
Biswajit Paul9d2dd042017-02-01 12:38:16 -080046')
Biswajit Paul28439f92015-07-15 13:28:27 -070047
48# ver_info.txt
49r_dir_file(RIDL, firmware_file)
50
51# sdcard0/1
52allow RIDL fuse:dir create_dir_perms;
53allow RIDL fuse:file create_file_perms;
54
55# dmesg
56allow RIDL kernel:system syslog_read;
57
58# QMUX
59qmux_socket(RIDL)
60
61# ramdumps
62allow RIDL ramdump_device:chr_file rw_file_perms;
63
64# logcat
65unix_socket_connect(RIDL, logdr, logd)
66
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +053067#binder_use(RIDL)
68allow RIDL vendor_shell_exec:file { rx_file_perms };
Biswajit Paul28439f92015-07-15 13:28:27 -070069allow RIDL sysfs:file write;
70allow RIDL system_file:file x_file_perms;
71binder_call(RIDL, system_server)
Shruthi Krishnaa24dd282015-09-16 14:17:07 -070072
73# recovery
74allow RIDL cache_file:dir create_dir_perms;
75allow RIDL cache_file:file create_file_perms;
Clarence Wongd79aea32016-10-07 14:41:04 -070076allow RIDL cache_recovery_file:dir rw_dir_perms;
77allow RIDL cache_recovery_file:file create_file_perms;
Shruthi Krishnaa24dd282015-09-16 14:17:07 -070078
79# reboot recovery
sahil madekaa3608c92017-05-12 15:41:40 -070080set_prop(RIDL, powerctl_prop)
Shruthi Krishnaa24dd282015-09-16 14:17:07 -070081
Divya Sharma8fa27ad2015-11-03 15:10:41 -080082# ANR
83allow RIDL anr_data_file:dir r_dir_perms;
84allow RIDL anr_data_file:file r_file_perms;
85
86# detect /data/anr directory is created
87allow RIDL system_data_file:dir read;
88
Shruthi Krishnaa24dd282015-09-16 14:17:07 -070089userdebug_or_eng(`
Panwar Viveka7b60ec2015-09-10 13:50:31 +053090 # Access to ANR/segfaults
Shruthi Krishnaa24dd282015-09-16 14:17:07 -070091 allow RIDL tombstone_data_file:dir rw_dir_perms;
92 allow RIDL tombstone_data_file:file { unlink rw_file_perms };
Manish Kumar8519d712015-11-04 11:12:08 +053093 allow RIDL anr_data_file:dir rw_dir_perms;
94 allow RIDL anr_data_file:file { unlink rw_file_perms };
Panwar Viveka7b60ec2015-09-10 13:50:31 +053095
96 # tcpdump
Biswajit Paul2d35d982017-02-01 17:40:10 -080097 allow RIDL self:packet_socket create_socket_perms_no_ioctl;
Panwar Viveka7b60ec2015-09-10 13:50:31 +053098 allow RIDL self:capability net_raw;
Clarence Wong9fdb1452016-10-04 11:28:34 -070099 diag_use( RIDL )
Clarence Wongb5b68d92015-11-24 13:03:37 -0800100
101 # allow location
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +0530102 #allow RIDL app_api_service:service_manager find;
Shruthi Krishnaa24dd282015-09-16 14:17:07 -0700103')
Panwar Viveka7b60ec2015-09-10 13:50:31 +0530104
105# drop root caps
106allow RIDL self:capability { setuid setgid };
107
108# access to /proc/kmsg
109allow RIDL self:capability2 syslog;
110allow RIDL kernel:system syslog_mod;
Manish Kumar6cbbdc72015-11-04 11:12:58 +0530111
112# allow access to /storage/ for sdcard
113allow RIDL storage_file:dir r_dir_perms;
114
115# allow logcat access
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +0530116#read_logd( RIDL );
Clarence Wongb5b68d92015-11-24 13:03:37 -0800117
118# allow netstats
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +0530119#allow RIDL system_api_service:service_manager find;
Clarence Wong94ec5642016-07-28 14:09:58 -0700120
121# allow toybox execution for getprop on OS 24 and later
Ravi Kumar Siddojigaric7def122017-06-13 00:49:19 +0530122allow RIDL vendor_toolbox_exec:file rx_file_perms;