summaryrefslogtreecommitdiff
path: root/generic/vendor/common/init_shell.te
blob: 02e0d0085b88de41a0a689279187e65a92019520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Copyright (c) 2018-2020, 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.
# Restricted domain for shell processes spawned by init.
# Normally these are shell commands or scripts invoked via sh
# from an init*.rc file.  No service should ever run in this domain.
type vendor_qti_init_shell, domain;
type vendor_qti_init_shell_exec, exec_type, vendor_file_type,file_type;

init_daemon_domain(vendor_qti_init_shell)

domain_auto_trans(init, vendor_shell_exec, vendor_qti_init_shell)

# For executing init shell scripts (init.qcom.early_boot.sh)
allow vendor_qti_init_shell vendor_qti_init_shell_exec:file { rx_file_perms entrypoint };
#execute init scripts
allow vendor_qti_init_shell vendor_shell_exec:file {rx_file_perms entrypoint };
allow vendor_qti_init_shell vendor_toolbox_exec:file  rx_file_perms;

# For getting idle_time value
# this is needed for dynamic_fps and bw_mode_bitmap
allow vendor_qti_init_shell vendor_sysfs_graphics:file {rw_file_perms setattr};

allow vendor_qti_init_shell mnt_vendor_file:dir w_dir_perms;
allow vendor_qti_init_shell mnt_vendor_file:file create_file_perms;
allow vendor_qti_init_shell vendor_smd_device:chr_file rw_file_perms;

# Run helpers from / or /system without changing domain.
allow vendor_qti_init_shell { rootfs vendor_shell_exec }:file execute_no_trans;

allow vendor_qti_init_shell gpu_device:chr_file getattr;

allow vendor_qti_init_shell vendor_sysfs_cpu_boost:dir r_dir_perms;
allow vendor_qti_init_shell vendor_sysfs_cpu_boost:file rw_file_perms;

# for insmod of iris ko, this is needed.
# fowner and fsetid are needed for chmod display nodes.
allow vendor_qti_init_shell self:capability {
    sys_module
    net_admin
    chown
    fowner
    fsetid
    sys_admin
};

set_prop(vendor_qti_init_shell, vendor_ctl_netmgrd_prop)
set_prop(vendor_qti_init_shell, vendor_ctl_port-bridge_prop)
set_prop(vendor_qti_init_shell, vendor_ctl_rild_prop)
set_prop(vendor_qti_init_shell, vendor_ctl_qcrild_prop)
set_prop(vendor_qti_init_shell, vendor_ipacm-diag_prop)
set_prop(vendor_qti_init_shell, vendor_ipacm_prop)
set_prop(vendor_qti_init_shell, vendor_msm_irqbalance_prop)
set_prop(vendor_qti_init_shell, vendor_dataqti_prop)
set_prop(vendor_qti_init_shell, vendor_display_prop)
set_prop(vendor_qti_init_shell, vendor_alarm_boot_prop)
set_prop(vendor_qti_init_shell, vendor_gralloc_prop)
set_prop(vendor_qti_init_shell, vendor_usb_prop)
set_prop(vendor_qti_init_shell, vendor_system_prop)
set_prop(vendor_qti_init_shell, vendor_mpctl_prop)
set_prop(vendor_qti_init_shell, vendor_radio_prop)
set_prop(vendor_qti_init_shell, vendor_audio_prop)
get_prop(vendor_qti_init_shell, exported3_radio_prop)
set_prop(vendor_qti_init_shell, vendor_gpu_prop)
set_prop(vendor_qti_init_shell, vendor_sensors_prop)
set_prop(vendor_qti_init_shell, vendor_adsprpc_prop)
set_prop(vendor_qti_init_shell, vendor_opengles_prop)

allow vendor_qti_init_shell {
    sysfs_devices_system_cpu
    sysfs_lowmemorykiller
    vendor_sysfs_mmc_host
    vendor_sysfs_process_reclaim
}:file w_file_perms;

r_dir_file(vendor_qti_init_shell, sysfs_type)
r_dir_file(vendor_qti_init_shell, vendor_sysfs_devfreq)
allow vendor_qti_init_shell vendor_sysfs_devfreq:file w_file_perms;
allow vendor_qti_init_shell vendor_sysfs_soc:file write;
allow vendor_qti_init_shell sysfs:{ dir file lnk_file } relabelfrom;
allow vendor_qti_init_shell sysfs_devices_system_cpu: { dir file lnk_file } relabelto;

# To start sensors for DSPS enabled platforms
r_dir_file(vendor_qti_init_shell, mnt_vendor_file)
r_dir_file(vendor_qti_init_shell, vendor_persist_bluetooth_file)

allow vendor_qti_init_shell { proc proc_net}:file write;
allow vendor_qti_init_shell proc_net:file r_file_perms;

allow vendor_qti_init_shell graphics_device:dir create_dir_perms;
allow vendor_qti_init_shell graphics_device:lnk_file create_file_perms;

#insmod of ko from scripts need kernel key search
allow vendor_qti_init_shell kernel:key search;

allow vendor_qti_init_shell cgroup:dir add_name;

# To allow copy for mbn files
r_dir_file(vendor_qti_init_shell, firmware_file)

# /dev/block/zram0
allow vendor_qti_init_shell block_device:dir r_dir_perms;
allow vendor_qti_init_shell swap_block_device:blk_file rw_file_perms;

#For configfs permission
allow vendor_qti_init_shell configfs:dir r_dir_perms;
allow vendor_qti_init_shell configfs:file rw_file_perms;

#Allow /sys access to write zram disksize
allow vendor_qti_init_shell sysfs_zram:dir r_dir_perms;
allow vendor_qti_init_shell sysfs_zram:file rw_file_perms;

# To get GPU frequencies  and set attributes
allow vendor_qti_init_shell vendor_sysfs_kgsl:file { r_file_perms setattr };

allow vendor_qti_init_shell proc:file r_file_perms;
allow vendor_qti_init_shell rootfs:file r_file_perms;

allow vendor_qti_init_shell vendor_radio_vendor_data_file:dir create_dir_perms;
allow vendor_qti_init_shell vendor_radio_vendor_data_file:file create_file_perms;

allow vendor_qti_init_shell vendor_mbn_data_file:dir create_dir_perms;
allow vendor_qti_init_shell vendor_mbn_data_file:file create_file_perms;

set_prop(vendor_qti_init_shell, vendor_ctl_vendor_hbtp_prop)

# rules for vm_bms
allow vendor_qti_init_shell {
    vendor_sysfs_battery_supply
    vendor_sysfs_usb_supply
    vendor_sysfs_usbpd_device
}:dir r_dir_perms;

allow vendor_qti_init_shell {
    vendor_sysfs_battery_supply
    vendor_sysfs_usb_supply
    vendor_sysfs_usbpd_device
}:file rw_file_perms;

allow vendor_qti_init_shell vendor_sysfs_battery_supply:file setattr;
allow vendor_qti_init_shell vendor_sysfs_usb_supply:file setattr;
allow vendor_qti_init_shell vendor_sysfs_usbpd_device:file setattr;

allow vendor_qti_init_shell sysfs_devices_system_cpu:file w_file_perms;

allow vendor_qti_init_shell vendor_sysfs_msm_power:file rw_file_perms;

allow vendor_qti_init_shell vendor_msm_irqbalanced_exec:file getattr;

set_prop(vendor_qti_init_shell, vendor_alarm_boot_prop)

set_prop(vendor_qti_init_shell, vendor_wifi_prop)

# To read /proc/meminfo
allow vendor_qti_init_shell proc_meminfo:file r_file_perms;

allow vendor_qti_init_shell vendor_sysfs_suspend:file w_file_perms;

# Set ro.vendor.qti.soc_id to soc_id in QCV init script
set_prop(vendor_qti_init_shell, vendor_soc_id_prop);
# Set ro.vendor.qti.soc_name to soc_name in QCV init script
set_prop(vendor_qti_init_shell, vendor_soc_name_prop);
# Set ro.vendor.qti.soc_model to soc_model in QCV init script
set_prop(vendor_qti_init_shell, vendor_soc_model_prop);

# Get persist.vendor.console.silent.config for kernel console log level
get_prop(vendor_qti_init_shell, vendor_console_log_level_prop)

set_prop(vendor_qti_init_shell,vendor_dcvs_prop)