Skip to content

Commit 2814cfc

Browse files
vladimirolteanbgcngm
authored andcommitted
Fix storaged access to /sys/block/mmcblk0/stat after 48027a0
* Commit "storaged: remove access to sysfs_type" denied the storaged daemon access to the sysfs node it needed to do its work. * It also didn't provide any means necessary for adding the necessary rules at a device level, since its sepolicy is private. * Here we define a new sysfs_disk_stat security label, which device maintainers are supposed to add to their genfs_contexts file. This is similar to how hal_health_default and sysfs_batteryinfo is handled. * What prevents the genfs_contexts from being added here directly is that in a typical vendor implementation, these sysfs files are actually symlinks and not a single, unified path SELinux-wise. Change-Id: I13ca09cf2458b22ffb6c70b8a353e891e810c606 Signed-off-by: Vladimir Oltean <[email protected]>
1 parent bb4d016 commit 2814cfc

File tree

17 files changed

+29
-0
lines changed

17 files changed

+29
-0
lines changed

prebuilts/api/29.0/private/compat/26.0/26.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
statscompanion_service
159159
storaged_data_file
160160
super_block_device
161+
sysfs_disk_stat
161162
sysfs_fs_ext4_features
162163
system_boot_reason_prop
163164
system_bootstrap_lib_file

prebuilts/api/29.0/private/compat/27.0/27.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
storaged_data_file
146146
super_block_device
147147
staging_data_file
148+
sysfs_disk_stat
148149
system_boot_reason_prop
149150
system_bootstrap_lib_file
150151
system_lmk_prop

prebuilts/api/29.0/private/compat/28.0/28.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
simpleperf_app_runner_exec
123123
su_tmpfs
124124
super_block_device
125+
sysfs_disk_stat
125126
sysfs_fs_f2fs
126127
system_bootstrap_lib_file
127128
system_event_log_tags_file

prebuilts/api/29.0/private/storaged.te

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ init_daemon_domain(storaged)
77
# Read access to pseudo filesystems
88
r_dir_file(storaged, domain)
99

10+
# Allow read access to /sys/block/mmcblk0/stat or /sys/block/sda/stat.
11+
# Implementations typically have symlinks to vendor specific files.
12+
# Vendors should mark sysfs_disk_stat on all files read by storaged.
13+
r_dir_file(storaged, sysfs_disk_stat)
14+
1015
# Read /proc/uid_io/stats
1116
allow storaged proc_uid_io_stats:file r_file_perms;
1217

prebuilts/api/29.0/public/file.te

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type proc_overcommit_memory, fs_type, proc_type;
1111
type proc_min_free_order_shift, fs_type, proc_type;
1212
# proc, sysfs, or other nodes that permit configuration of kernel usermodehelpers.
1313
type usermodehelper, fs_type, proc_type;
14+
type sysfs_disk_stat, fs_type, sysfs_type;
1415
type sysfs_usermodehelper, fs_type, sysfs_type;
1516
type proc_qtaguid_ctrl, fs_type, mlstrustedobject, proc_type;
1617
type proc_qtaguid_stat, fs_type, mlstrustedobject, proc_type;

prebuilts/api/30.0/private/compat/26.0/26.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
statscompanion_service
162162
storaged_data_file
163163
super_block_device
164+
sysfs_disk_stat
164165
sysfs_fs_ext4_features
165166
system_boot_reason_prop
166167
system_bootstrap_lib_file

prebuilts/api/30.0/private/compat/27.0/27.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
storaged_data_file
149149
super_block_device
150150
staging_data_file
151+
sysfs_disk_stat
151152
system_boot_reason_prop
152153
system_bootstrap_lib_file
153154
system_lmk_prop

prebuilts/api/30.0/private/compat/28.0/28.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
socket_hook_prop
128128
su_tmpfs
129129
super_block_device
130+
sysfs_disk_stat
130131
sysfs_fs_f2fs
131132
system_bootstrap_lib_file
132133
system_event_log_tags_file

prebuilts/api/30.0/private/compat/29.0/29.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
staged_install_file
101101
storage_config_prop
102102
surfaceflinger_display_prop
103+
sysfs_disk_stat
103104
sysfs_dm_verity
104105
system_adbd_prop
105106
system_config_service

prebuilts/api/30.0/private/storaged.te

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ init_daemon_domain(storaged)
77
# Read access to pseudo filesystems
88
r_dir_file(storaged, domain)
99

10+
# Allow read access to /sys/block/mmcblk0/stat or /sys/block/sda/stat.
11+
# Implementations typically have symlinks to vendor specific files.
12+
# Vendors should mark sysfs_disk_stat on all files read by storaged.
13+
r_dir_file(storaged, sysfs_disk_stat)
14+
1015
# Read /proc/uid_io/stats
1116
allow storaged proc_uid_io_stats:file r_file_perms;
1217

prebuilts/api/30.0/public/file.te

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type proc_min_free_order_shift, fs_type, proc_type;
1515
type proc_kpageflags, fs_type, proc_type;
1616
# proc, sysfs, or other nodes that permit configuration of kernel usermodehelpers.
1717
type usermodehelper, fs_type, proc_type;
18+
type sysfs_disk_stat, fs_type, sysfs_type;
1819
type sysfs_usermodehelper, fs_type, sysfs_type;
1920
type proc_qtaguid_ctrl, fs_type, mlstrustedobject, proc_type;
2021
type proc_qtaguid_stat, fs_type, mlstrustedobject, proc_type;

private/compat/26.0/26.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
statscompanion_service
162162
storaged_data_file
163163
super_block_device
164+
sysfs_disk_stat
164165
sysfs_fs_ext4_features
165166
system_boot_reason_prop
166167
system_bootstrap_lib_file

private/compat/27.0/27.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
storaged_data_file
149149
super_block_device
150150
staging_data_file
151+
sysfs_disk_stat
151152
system_boot_reason_prop
152153
system_bootstrap_lib_file
153154
system_lmk_prop

private/compat/28.0/28.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
socket_hook_prop
128128
su_tmpfs
129129
super_block_device
130+
sysfs_disk_stat
130131
sysfs_fs_f2fs
131132
system_bootstrap_lib_file
132133
system_event_log_tags_file

private/compat/29.0/29.0.ignore.cil

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
staged_install_file
101101
storage_config_prop
102102
surfaceflinger_display_prop
103+
sysfs_disk_stat
103104
sysfs_dm_verity
104105
system_adbd_prop
105106
system_config_service

private/storaged.te

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ init_daemon_domain(storaged)
77
# Read access to pseudo filesystems
88
r_dir_file(storaged, domain)
99

10+
# Allow read access to /sys/block/mmcblk0/stat or /sys/block/sda/stat.
11+
# Implementations typically have symlinks to vendor specific files.
12+
# Vendors should mark sysfs_disk_stat on all files read by storaged.
13+
r_dir_file(storaged, sysfs_disk_stat)
14+
1015
# Read /proc/uid_io/stats
1116
allow storaged proc_uid_io_stats:file r_file_perms;
1217

public/file.te

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type proc_min_free_order_shift, fs_type, proc_type;
1515
type proc_kpageflags, fs_type, proc_type;
1616
# proc, sysfs, or other nodes that permit configuration of kernel usermodehelpers.
1717
type usermodehelper, fs_type, proc_type;
18+
type sysfs_disk_stat, fs_type, sysfs_type;
1819
type sysfs_usermodehelper, fs_type, sysfs_type;
1920
type proc_qtaguid_ctrl, fs_type, mlstrustedobject, proc_type;
2021
type proc_qtaguid_stat, fs_type, mlstrustedobject, proc_type;

0 commit comments

Comments
 (0)