blob: 0ea67a74d7c6a3d24fa66b1e0d58f03f6cac6f6a [file] [log] [blame]
Alan Stokes7bde36e2022-03-09 16:41:06 +00001typeattribute shell coredomain;
Inseob Kime1389972021-07-19 07:48:34 +00002
Inseob Kim9bad60c2024-03-28 15:23:18 +09003# Root fs.
4allow shell rootfs:dir r_dir_perms;
5
6# Access /data/local/tmp.
7allow shell shell_data_file:dir create_dir_perms;
8allow shell shell_data_file:file create_file_perms;
9allow shell shell_data_file:file rx_file_perms;
10allow shell shell_data_file:lnk_file create_file_perms;
11
12allow shell devpts:chr_file rw_file_perms;
13allow shell tty_device:chr_file rw_file_perms;
14allow shell console_device:chr_file rw_file_perms;
15
16r_dir_file(shell, system_file)
17allow shell system_file:file x_file_perms;
18allow shell toolbox_exec:file rx_file_perms;
19allow shell shell_exec:file rx_file_perms;
20
21# allow shell to look through /proc/ for lsmod, ps, top, netstat, vmstat.
22r_dir_file(shell, proc_net_type)
23
24allow shell {
25 proc_asound
26 proc_filesystems
27 proc_interrupts
28 proc_loadavg # b/124024827
29 proc_meminfo
30 proc_modules
31 proc_pid_max
32 proc_slabinfo
33 proc_stat
34 proc_timer
35 proc_uptime
36 proc_version
37 proc_vmstat
38 proc_zoneinfo
39}:file r_file_perms;
40
41# allow listing network interfaces under /sys/class/net.
42allow shell sysfs_net:dir r_dir_perms;
43
44r_dir_file(shell, cgroup)
45allow shell cgroup_desc_file:file r_file_perms;
46allow shell cgroup_desc_api_file:file r_file_perms;
47r_dir_file(shell, cgroup_v2)
48allow shell domain:dir { search open read getattr };
49allow shell domain:{ file lnk_file } { open read getattr };
50
51# statvfs() of /proc and other labeled filesystems
52# (yaffs2, jffs2, ext2, ext3, ext4, xfs, btrfs, f2fs, squashfs, overlay)
53allow shell { proc labeledfs }:filesystem getattr;
54
55# stat() of /dev
56allow shell device:dir getattr;
57
58# allow shell to read /proc/pid/attr/current for ps -Z
59allow shell domain:process getattr;
60
61# Allow pulling the SELinux policy for CTS purposes
62allow shell selinuxfs:dir r_dir_perms;
63allow shell selinuxfs:file r_file_perms;
64
65# /dev/fd is a symlink
66allow shell proc:lnk_file getattr;
67
68# read selinux policy files
69allow shell file_contexts_file:file r_file_perms;
70allow shell property_contexts_file:file r_file_perms;
71allow shell service_contexts_file:file r_file_perms;
72allow shell sepolicy_file:file r_file_perms;
73
Inseob Kime1389972021-07-19 07:48:34 +000074# Perform SELinux access checks, needed for CTS
75selinux_check_access(shell)
76selinux_check_context(shell)
77
78# Allow shell to run adb shell cmd stats commands. Needed for CTS.
79binder_call(shell, statsd);
80
Inseob Kime1389972021-07-19 07:48:34 +000081# Connect to adbd and use a socket transferred from it.
82# This is used for e.g. adb backup/restore.
83allow shell adbd:unix_stream_socket connectto;
84allow shell adbd:fd use;
85allow shell adbd:unix_stream_socket { getattr getopt ioctl read write shutdown };
86
87# filesystem test for insecure chr_file's is done
88# via a host side test
89allow shell dev_type:dir r_dir_perms;
90allow shell dev_type:chr_file getattr;
91
92# filesystem test for insucre blk_file's is done
93# via hostside test
94allow shell dev_type:blk_file getattr;
Inseob Kim76876002021-08-05 02:05:16 +000095
96# Test tool automatically tries to access /sys/class/power_supply.
97# Suppressing it as we don't need power_supply in microdroid.
98dontaudit shell sysfs:dir r_dir_perms;
Inseob Kim5ee61a72021-09-17 19:31:45 +090099
100# Test tool tries to read various service status properties.
Victor Hsieha62b3ff2022-05-02 09:47:11 -0700101get_prop(shell, boot_status_prop)
Inseob Kim5ee61a72021-09-17 19:31:45 +0900102get_prop(shell, init_service_status_prop)
103get_prop(shell, init_service_status_private_prop)
104
105set_prop(shell, log_tag_prop)