1# storaged daemon
2type storaged, domain, coredomain, mlstrustedsubject;
3type storaged_exec, system_file_type, exec_type, file_type;
4
5init_daemon_domain(storaged)
6
7# Read access to pseudo filesystems
8r_dir_file(storaged, domain)
9
10# Read /proc/uid_io/stats
11allow storaged proc_uid_io_stats:file r_file_perms;
12
13# Read /data/system/packages.list
14allow storaged system_data_file:file r_file_perms;
15allow storaged packages_list_file:file r_file_perms;
16
17# Store storaged proto file
18allow storaged storaged_data_file:dir rw_dir_perms;
19allow storaged storaged_data_file:file create_file_perms;
20
21userdebug_or_eng(`
22  # Read access to debugfs
23  allow storaged debugfs_mmc:dir search;
24  allow storaged debugfs_mmc:file r_file_perms;
25')
26
27# Needed to provide debug dump output via dumpsys pipes.
28allow storaged shell:fd use;
29allow storaged shell:fifo_file write;
30
31# Needed for GMScore to call dumpsys storaged
32allow storaged priv_app:fd use;
33# b/142672293: No other priv-app should need this allow rule now that GMS core runs in its own domain.
34# Remove after no logs are seen for this rule.
35userdebug_or_eng(`
36  auditallow storaged priv_app:fd use;
37')
38allow storaged gmscore_app:fd use;
39allow storaged { privapp_data_file app_data_file }:file write;
40allow storaged permission_service:service_manager find;
41
42# Binder permissions
43add_service(storaged, storaged_service)
44
45binder_use(storaged)
46binder_call(storaged, system_server)
47
48hal_client_domain(storaged, hal_health)
49
50# Implements a dumpsys interface.
51allow storaged dumpstate:fd use;
52
53# use a subset of the package manager service
54allow storaged package_native_service:service_manager find;
55
56# Kernel does extra check on CAP_DAC_OVERRIDE for libbinder when storaged is
57# running as root. See b/35323867 #3.
58dontaudit storaged self:global_capability_class_set { dac_override dac_read_search };
59
60# For collecting bugreports.
61allow storaged dumpstate:fifo_file write;
62
63###
64### neverallow
65###
66neverallow storaged domain:process ptrace;
67neverallow storaged self:capability_class_set *;
68