2018-08-17 09:35:42 +02:00
|
|
|
typeattribute apexd coredomain;
|
|
|
|
|
|
|
|
init_daemon_domain(apexd)
|
|
|
|
|
2019-01-14 09:10:24 +01:00
|
|
|
# Allow creating, reading and writing of APEX files/dirs in the APEX data dir
|
|
|
|
allow apexd apex_data_file:dir create_dir_perms;
|
|
|
|
allow apexd apex_data_file:file create_file_perms;
|
2018-08-17 09:35:42 +02:00
|
|
|
|
2019-03-12 16:37:13 +01:00
|
|
|
# Allow creating, reading and writing of APEX files/dirs in the APEX metadata dir
|
|
|
|
allow apexd metadata_file:dir search;
|
|
|
|
allow apexd apex_metadata_file:dir create_dir_perms;
|
|
|
|
allow apexd apex_metadata_file:file create_file_perms;
|
|
|
|
|
2019-12-02 19:29:48 +01:00
|
|
|
# Allow apexd to create directories for snapshots of apex data
|
2020-01-17 00:47:02 +01:00
|
|
|
allow apexd apex_permission_data_file:dir create_dir_perms;
|
|
|
|
allow apexd apex_permission_data_file:file create_file_perms;
|
2019-12-02 19:29:48 +01:00
|
|
|
allow apexd apex_rollback_data_file:dir create_dir_perms;
|
|
|
|
allow apexd apex_rollback_data_file:file create_file_perms;
|
|
|
|
|
2018-08-17 09:35:42 +02:00
|
|
|
# allow apexd to create loop devices with /dev/loop-control
|
|
|
|
allow apexd loop_control_device:chr_file rw_file_perms;
|
|
|
|
# allow apexd to access loop devices
|
|
|
|
allow apexd loop_device:blk_file rw_file_perms;
|
2018-10-26 14:32:44 +02:00
|
|
|
allowxperm apexd loop_device:blk_file ioctl {
|
|
|
|
LOOP_GET_STATUS64
|
|
|
|
LOOP_SET_STATUS64
|
|
|
|
LOOP_SET_FD
|
|
|
|
LOOP_SET_BLOCK_SIZE
|
|
|
|
LOOP_SET_DIRECT_IO
|
|
|
|
LOOP_CLR_FD
|
2018-12-14 10:33:01 +01:00
|
|
|
BLKFLSBUF
|
2018-10-26 14:32:44 +02:00
|
|
|
};
|
2018-08-17 09:35:42 +02:00
|
|
|
# allow apexd to access /dev/block
|
|
|
|
allow apexd block_device:dir r_dir_perms;
|
|
|
|
|
|
|
|
# allow apexd to access /dev/block/dm-* (device-mapper entries)
|
|
|
|
allow apexd dm_device:chr_file rw_file_perms;
|
|
|
|
allow apexd dm_device:blk_file rw_file_perms;
|
|
|
|
|
|
|
|
# sys_admin is required to access the device-mapper and mount
|
|
|
|
allow apexd self:global_capability_class_set sys_admin;
|
|
|
|
|
|
|
|
# allow apexd to create a mount point in /apex
|
|
|
|
allow apexd apex_mnt_dir:dir create_dir_perms;
|
|
|
|
# allow apexd to mount in /apex
|
|
|
|
allow apexd apex_mnt_dir:filesystem { mount unmount };
|
|
|
|
allow apexd apex_mnt_dir:dir mounton;
|
2018-10-16 09:02:49 +02:00
|
|
|
# allow apexd to create symlinks in /apex
|
|
|
|
allow apexd apex_mnt_dir:lnk_file create_file_perms;
|
2019-02-05 23:47:57 +01:00
|
|
|
# allow apexd to unlink apex files in /data/apex/active
|
2019-02-27 12:21:20 +01:00
|
|
|
# note that apexd won't be able to unlink files in /data/app-staging/session_XXXX,
|
2019-02-05 23:47:57 +01:00
|
|
|
# because it doesn't have write permission for staging_data_file object.
|
|
|
|
allow apexd staging_data_file:file unlink;
|
2018-10-16 09:02:49 +02:00
|
|
|
|
2019-02-27 12:21:20 +01:00
|
|
|
# allow apexd to read files from /data/app-staging and hardlink them to /data/apex.
|
2019-01-02 15:20:52 +01:00
|
|
|
allow apexd staging_data_file:dir r_dir_perms;
|
|
|
|
allow apexd staging_data_file:file { r_file_perms link };
|
|
|
|
|
2019-04-24 03:45:40 +02:00
|
|
|
# allow apexd to read files from /vendor/apex
|
|
|
|
allow apexd vendor_apex_file:dir r_dir_perms;
|
|
|
|
allow apexd vendor_apex_file:file r_file_perms;
|
|
|
|
|
2018-08-17 09:35:42 +02:00
|
|
|
# Unmount and mount filesystems
|
|
|
|
allow apexd labeledfs:filesystem { mount unmount };
|
|
|
|
|
2019-02-01 03:17:15 +01:00
|
|
|
# /sys directory tree traversal
|
|
|
|
allow apexd sysfs_type:dir search;
|
2018-12-18 15:38:59 +01:00
|
|
|
# Configure read-ahead of dm-verity and loop devices
|
|
|
|
# for dm-X
|
2018-11-08 12:57:12 +01:00
|
|
|
allow apexd sysfs_dm:dir r_dir_perms;
|
|
|
|
allow apexd sysfs_dm:file rw_file_perms;
|
2018-12-18 15:38:59 +01:00
|
|
|
# for loopX
|
|
|
|
allow apexd sysfs_loop:dir r_dir_perms;
|
|
|
|
allow apexd sysfs_loop:file rw_file_perms;
|
2018-11-08 12:57:12 +01:00
|
|
|
|
2018-08-17 09:35:42 +02:00
|
|
|
# Spawning a libbinder thread results in a dac_override deny,
|
|
|
|
# /dev/cpuset/tasks is owned by system.
|
|
|
|
#
|
|
|
|
# See b/35323867#comment3
|
|
|
|
dontaudit apexd self:global_capability_class_set { dac_override dac_read_search };
|
|
|
|
|
2019-01-23 21:44:24 +01:00
|
|
|
# Allow apexd to log to the kernel.
|
|
|
|
allow apexd kmsg_device:chr_file w_file_perms;
|
|
|
|
|
2019-02-08 01:26:00 +01:00
|
|
|
# Allow apexd to reboot device. Required for rollbacks of apexes that are
|
|
|
|
# not covered by rollback manager.
|
|
|
|
set_prop(apexd, powerctl_prop)
|
|
|
|
|
2019-06-13 02:45:05 +02:00
|
|
|
# Allow apexd to stop itself
|
|
|
|
set_prop(apexd, ctl_apexd_prop)
|
|
|
|
|
2019-03-12 13:31:15 +01:00
|
|
|
# Find the vold service, and call into vold to manage FS checkpoints
|
|
|
|
allow apexd vold_service:service_manager find;
|
|
|
|
binder_call(apexd, vold)
|
|
|
|
|
2018-12-05 01:29:21 +01:00
|
|
|
# Apex pre- & post-install permission.
|
|
|
|
|
|
|
|
# Allow self-execute for the fork mount helper.
|
|
|
|
allow apexd apexd_exec:file execute_no_trans;
|
|
|
|
|
2019-02-08 22:12:18 +01:00
|
|
|
# Unshare and make / private so that hooks cannot influence the
|
|
|
|
# running system.
|
|
|
|
allow apexd rootfs:dir mounton;
|
|
|
|
|
2018-12-05 01:29:21 +01:00
|
|
|
# Allow to execute shell for pre- and postinstall scripts. A transition
|
|
|
|
# rule is required, thus restricted to execute and not execute_no_trans.
|
|
|
|
allow apexd shell_exec:file { r_file_perms execute };
|
|
|
|
|
2019-03-14 18:45:33 +01:00
|
|
|
# apexd is using bootstrap bionic
|
|
|
|
allow apexd system_bootstrap_lib_file:dir r_dir_perms;
|
|
|
|
allow apexd system_bootstrap_lib_file:file { execute read open getattr map };
|
|
|
|
|
2019-02-08 01:26:00 +01:00
|
|
|
# Allow transition to ART APEX preinstall domain.
|
|
|
|
domain_auto_trans(apexd, art_apex_preinstall_exec, art_apex_preinstall)
|
2019-02-21 19:03:07 +01:00
|
|
|
# Allow transition to ART APEX postinstall domain.
|
|
|
|
domain_auto_trans(apexd, art_apex_postinstall_exec, art_apex_postinstall)
|
2019-02-26 13:10:21 +01:00
|
|
|
|
2018-12-05 01:29:21 +01:00
|
|
|
# Allow transition to test APEX preinstall domain.
|
|
|
|
userdebug_or_eng(`
|
|
|
|
domain_auto_trans(apexd, apex_test_prepostinstall_exec, apex_test_prepostinstall)
|
|
|
|
')
|
|
|
|
|
2019-11-14 15:28:43 +01:00
|
|
|
# Allow apexd to be invoked with logwrapper from init during userspace reboot.
|
|
|
|
allow apexd devpts:chr_file { read write };
|
|
|
|
|
2018-08-17 09:35:42 +02:00
|
|
|
neverallow { domain -apexd -init } apex_data_file:dir no_w_dir_perms;
|
2019-03-12 16:37:13 +01:00
|
|
|
neverallow { domain -apexd -init } apex_metadata_file:dir no_w_dir_perms;
|
2019-01-04 17:22:19 +01:00
|
|
|
neverallow { domain -apexd -init -kernel } apex_data_file:file no_w_file_perms;
|
2019-03-12 16:37:13 +01:00
|
|
|
neverallow { domain -apexd -init -kernel } apex_metadata_file:file no_w_file_perms;
|
2018-10-16 09:02:49 +02:00
|
|
|
neverallow { domain -apexd } apex_mnt_dir:lnk_file no_w_file_perms;
|
2019-11-19 19:10:16 +01:00
|
|
|
|
|
|
|
neverallow { domain -apexd -init -vold_prepare_subdirs } apex_module_data_file:dir no_w_dir_perms;
|
|
|
|
neverallow { domain -apexd -init -vold_prepare_subdirs } apex_module_data_file:file no_w_file_perms;
|
2019-12-02 19:29:48 +01:00
|
|
|
|
|
|
|
neverallow { domain -apexd -init -vold_prepare_subdirs } apex_rollback_data_file:dir no_w_dir_perms;
|
|
|
|
neverallow { domain -apexd -init -vold_prepare_subdirs } apex_rollback_data_file:file no_w_file_perms;
|