2012-01-04 18:33:27 +01:00
|
|
|
# installer daemon
|
2017-05-15 22:19:03 +02:00
|
|
|
type installd, domain;
|
2018-09-27 19:21:37 +02:00
|
|
|
type installd_exec, system_file_type, exec_type, file_type;
|
2013-07-02 02:08:11 +02:00
|
|
|
typeattribute installd mlstrustedsubject;
|
2021-07-15 05:05:41 +02:00
|
|
|
allow installd self:global_capability_class_set { chown dac_override dac_read_search fowner fsetid setgid setuid sys_admin kill };
|
2015-05-01 01:07:49 +02:00
|
|
|
|
|
|
|
# Allow labeling of files under /data/app/com.example/oat/
|
2015-03-04 03:19:12 +01:00
|
|
|
allow installd dalvikcache_data_file:dir relabelto;
|
2015-06-05 13:18:22 +02:00
|
|
|
allow installd dalvikcache_data_file:file { relabelto link };
|
2015-05-01 01:07:49 +02:00
|
|
|
|
|
|
|
# Allow movement of APK files between volumes
|
2017-01-25 23:55:56 +01:00
|
|
|
allow installd apk_data_file:dir { create_dir_perms relabelfrom };
|
|
|
|
allow installd apk_data_file:file { create_file_perms relabelfrom link };
|
|
|
|
allow installd apk_data_file:lnk_file { create r_file_perms unlink };
|
2015-05-01 01:07:49 +02:00
|
|
|
|
2019-01-04 22:06:20 +01:00
|
|
|
# FS_IOC_ENABLE_VERITY and FS_IOC_MEASURE_VERITY (or in old implementation used in installd,
|
|
|
|
# FS_IOC_SET_VERITY_MEASUREMENT) ioctls on APKs in /data/app, to support fsverity.
|
|
|
|
# TODO(b/120629632): this path is deprecated, remove when possible.
|
2018-10-12 17:24:04 +02:00
|
|
|
allowxperm installd apk_data_file:file ioctl {
|
2019-01-04 22:06:20 +01:00
|
|
|
FS_IOC_ENABLE_VERITY FS_IOC_MEASURE_VERITY
|
2018-10-12 17:24:04 +02:00
|
|
|
};
|
|
|
|
|
2014-05-09 20:26:36 +02:00
|
|
|
allow installd asec_apk_file:file r_file_perms;
|
2017-01-25 23:55:56 +01:00
|
|
|
allow installd apk_tmp_file:file { r_file_perms unlink };
|
|
|
|
allow installd apk_tmp_file:dir { relabelfrom create_dir_perms };
|
2014-04-25 22:59:52 +02:00
|
|
|
allow installd oemfs:dir r_dir_perms;
|
|
|
|
allow installd oemfs:file r_file_perms;
|
2013-07-02 02:08:11 +02:00
|
|
|
allow installd cgroup:dir create_dir_perms;
|
2021-02-12 00:18:11 +01:00
|
|
|
allow installd cgroup_v2:dir create_dir_perms;
|
2015-06-16 07:18:32 +02:00
|
|
|
allow installd mnt_expand_file:dir { search getattr };
|
2013-07-02 02:08:11 +02:00
|
|
|
# Check validity of SELinux context before use.
|
|
|
|
selinux_check_context(installd)
|
2014-05-09 20:26:36 +02:00
|
|
|
|
2016-09-10 01:27:17 +02:00
|
|
|
r_dir_file(installd, rootfs)
|
2016-11-08 01:14:28 +01:00
|
|
|
# Scan through APKs in /system/app and /system/priv-app
|
|
|
|
r_dir_file(installd, system_file)
|
2017-04-04 18:30:41 +02:00
|
|
|
# Scan through APKs in /vendor/app
|
|
|
|
r_dir_file(installd, vendor_app_file)
|
2019-02-27 21:23:24 +01:00
|
|
|
# Scan through JARs in /vendor/framework
|
|
|
|
r_dir_file(installd, vendor_framework_file)
|
2017-04-19 06:05:37 +02:00
|
|
|
# Scan through Runtime Resource Overlay APKs in /vendor/overlay
|
|
|
|
r_dir_file(installd, vendor_overlay_file)
|
2017-03-24 23:02:13 +01:00
|
|
|
# Get file context
|
|
|
|
allow installd file_contexts_file:file r_file_perms;
|
2017-03-27 19:57:07 +02:00
|
|
|
# Get seapp_context
|
|
|
|
allow installd seapp_contexts_file:file r_file_perms;
|
2016-09-10 01:27:17 +02:00
|
|
|
|
2014-06-04 19:56:22 +02:00
|
|
|
# Search /data/app-asec and stat files in it.
|
2014-05-14 14:29:00 +02:00
|
|
|
allow installd asec_image_file:dir search;
|
2014-06-04 19:56:22 +02:00
|
|
|
allow installd asec_image_file:file getattr;
|
2014-05-14 14:29:00 +02:00
|
|
|
|
2014-05-09 20:26:36 +02:00
|
|
|
# Create /data/user and /data/user/0 if necessary.
|
|
|
|
# Also required to initially create /data/data subdirectories
|
|
|
|
# and lib symlinks before the setfilecon call. May want to
|
|
|
|
# move symlink creation after setfilecon in installd.
|
|
|
|
allow installd system_data_file:dir create_dir_perms;
|
2017-10-27 02:42:51 +02:00
|
|
|
# Also, allow read for lnk_file so that we can process /data/user/0 links when
|
|
|
|
# optimizing application code.
|
|
|
|
allow installd system_data_file:lnk_file { create getattr read setattr unlink };
|
2014-05-09 20:26:36 +02:00
|
|
|
|
2020-01-13 21:42:37 +01:00
|
|
|
# Manage lower filesystem via pass_through mounts
|
|
|
|
allow installd mnt_pass_through_file:dir r_dir_perms;
|
|
|
|
|
2014-05-09 20:26:36 +02:00
|
|
|
# Upgrade /data/media for multi-user if necessary.
|
|
|
|
allow installd media_rw_data_file:dir create_dir_perms;
|
2014-06-04 19:56:22 +02:00
|
|
|
allow installd media_rw_data_file:file { getattr unlink };
|
2014-05-09 20:26:36 +02:00
|
|
|
# restorecon new /data/media directory.
|
2014-05-07 19:10:02 +02:00
|
|
|
allow installd system_data_file:dir relabelfrom;
|
2014-05-09 20:26:36 +02:00
|
|
|
allow installd media_rw_data_file:dir relabelto;
|
|
|
|
|
2017-05-03 18:52:59 +02:00
|
|
|
# Delete /data/media files through sdcardfs, instead of going behind its back
|
|
|
|
allow installd tmpfs:dir r_dir_perms;
|
|
|
|
allow installd storage_file:dir search;
|
2021-06-23 10:21:49 +02:00
|
|
|
allow installd { sdcard_type fuse }:dir { search open read write remove_name getattr rmdir };
|
|
|
|
allow installd { sdcard_type fuse }:file { getattr unlink };
|
2017-05-03 18:52:59 +02:00
|
|
|
|
2019-12-13 13:30:26 +01:00
|
|
|
# Create app's mirror data directory in /data_mirror, and bind mount the real directory to it
|
|
|
|
allow installd mirror_data_file:dir { create_dir_perms mounton };
|
|
|
|
|
2014-10-13 13:10:08 +02:00
|
|
|
# Upgrade /data/misc/keychain for multi-user if necessary.
|
|
|
|
allow installd misc_user_data_file:dir create_dir_perms;
|
|
|
|
allow installd misc_user_data_file:file create_file_perms;
|
|
|
|
allow installd keychain_data_file:dir create_dir_perms;
|
|
|
|
allow installd keychain_data_file:file {r_file_perms unlink};
|
|
|
|
|
2019-08-16 22:41:55 +02:00
|
|
|
# Create /data/misc/installd/layout_version.* file
|
2014-05-12 17:18:21 +02:00
|
|
|
allow installd install_data_file:file create_file_perms;
|
2019-08-16 22:41:55 +02:00
|
|
|
allow installd install_data_file:dir rw_dir_perms;
|
2014-05-09 20:26:36 +02:00
|
|
|
|
|
|
|
# Create files under /data/dalvik-cache.
|
|
|
|
allow installd dalvikcache_data_file:dir create_dir_perms;
|
|
|
|
allow installd dalvikcache_data_file:file create_file_perms;
|
2016-12-16 22:54:56 +01:00
|
|
|
allow installd dalvikcache_data_file:lnk_file getattr;
|
2014-05-09 20:26:36 +02:00
|
|
|
|
2014-06-16 23:19:31 +02:00
|
|
|
# Create files under /data/resource-cache.
|
|
|
|
allow installd resourcecache_data_file:dir rw_dir_perms;
|
|
|
|
allow installd resourcecache_data_file:file create_file_perms;
|
|
|
|
|
2014-05-09 20:26:36 +02:00
|
|
|
# Upgrade from unlabeled userdata.
|
2014-05-27 16:56:24 +02:00
|
|
|
# Just need enough to remove and/or relabel it.
|
|
|
|
allow installd unlabeled:dir { getattr search relabelfrom rw_dir_perms rmdir };
|
|
|
|
allow installd unlabeled:notdevfile_class_set { getattr relabelfrom rename unlink setattr };
|
|
|
|
# Read pkg.apk file for input during dexopt.
|
|
|
|
allow installd unlabeled:file r_file_perms;
|
2014-05-09 20:26:36 +02:00
|
|
|
|
|
|
|
# Upgrade from before system_app_data_file was used for system UID apps.
|
2014-05-12 17:18:21 +02:00
|
|
|
# Just need enough to relabel it and to unlink removed package files.
|
2014-05-09 20:26:36 +02:00
|
|
|
# Directory access covered by earlier rule above.
|
2014-05-12 17:18:21 +02:00
|
|
|
allow installd system_data_file:notdevfile_class_set { getattr relabelfrom unlink };
|
2014-05-09 20:26:36 +02:00
|
|
|
|
|
|
|
# Manage /data/data subdirectories, including initially labeling them
|
|
|
|
# upon creation via setfilecon or running restorecon_recursive,
|
|
|
|
# setting owner/mode, creating symlinks within them, and deleting them
|
|
|
|
# upon package uninstall.
|
2020-10-27 18:35:33 +01:00
|
|
|
allow installd app_data_file_type:dir { create_dir_perms relabelfrom relabelto };
|
|
|
|
allow installd app_data_file_type:notdevfile_class_set { create_file_perms relabelfrom relabelto };
|
2015-04-10 06:07:36 +02:00
|
|
|
|
2016-02-01 20:28:39 +01:00
|
|
|
# Similar for the files under /data/misc/profiles/
|
2020-12-04 15:07:52 +01:00
|
|
|
allow installd user_profile_root_file:dir { create_dir_perms relabelfrom };
|
|
|
|
allow installd user_profile_data_file:dir { create_dir_perms relabelto };
|
2016-02-01 20:28:39 +01:00
|
|
|
allow installd user_profile_data_file:file create_file_perms;
|
2016-02-23 17:34:23 +01:00
|
|
|
allow installd user_profile_data_file:file unlink;
|
2016-06-16 00:27:48 +02:00
|
|
|
|
2020-12-04 15:07:52 +01:00
|
|
|
# Allow zygote to unmount mirror directories
|
|
|
|
allow installd labeledfs:filesystem unmount;
|
|
|
|
|
2016-05-27 21:41:35 +02:00
|
|
|
# Files created/updated by profman dumps.
|
|
|
|
allow installd profman_dump_data_file:dir { search add_name write };
|
|
|
|
allow installd profman_dump_data_file:file { create setattr open write };
|
2016-02-01 20:28:39 +01:00
|
|
|
|
2015-04-10 06:07:36 +02:00
|
|
|
# Create and use pty created by android_fork_execvp().
|
|
|
|
allow installd devpts:chr_file rw_file_perms;
|
2015-10-03 01:40:17 +02:00
|
|
|
|
|
|
|
# execute toybox for app relocation
|
|
|
|
allow installd toolbox_exec:file rx_file_perms;
|
2016-12-05 19:19:11 +01:00
|
|
|
|
|
|
|
# Allow installd to publish a binder service and make binder calls.
|
|
|
|
binder_use(installd)
|
2017-01-19 22:23:52 +01:00
|
|
|
add_service(installd, installd_service)
|
2016-12-05 19:19:11 +01:00
|
|
|
allow installd dumpstate:fifo_file { getattr write };
|
|
|
|
|
|
|
|
# Allow installd to call into the system server so it can check permissions.
|
|
|
|
binder_call(installd, system_server)
|
|
|
|
allow installd permission_service:service_manager find;
|
|
|
|
|
2016-12-15 20:51:00 +01:00
|
|
|
# Allow installd to read and write quotas
|
|
|
|
allow installd block_device:dir { search };
|
|
|
|
allow installd labeledfs:filesystem { quotaget quotamod };
|
|
|
|
|
2016-09-07 22:11:12 +02:00
|
|
|
# Allow installd to delete from /data/preloads when trimming data caches
|
|
|
|
# TODO b/34690396 Remove when time-based purge policy for preloads is implemented in system_server
|
|
|
|
allow installd preloads_data_file:file { r_file_perms unlink };
|
|
|
|
allow installd preloads_data_file:dir { r_dir_perms write remove_name rmdir };
|
2017-03-14 19:42:03 +01:00
|
|
|
allow installd preloads_media_file:file { r_file_perms unlink };
|
|
|
|
allow installd preloads_media_file:dir { r_dir_perms write remove_name rmdir };
|
2016-09-07 22:11:12 +02:00
|
|
|
|
2020-02-20 14:02:33 +01:00
|
|
|
# Allow installd to read /proc/filesystems
|
|
|
|
allow installd proc_filesystems:file r_file_perms;
|
|
|
|
|
2021-03-31 12:37:02 +02:00
|
|
|
#add for move app to sd card
|
|
|
|
get_prop(installd, storage_config_prop)
|
|
|
|
|
2021-06-10 22:05:56 +02:00
|
|
|
# Allow installd to access apps installed on the Incremental File System
|
|
|
|
# Accessing files on the Incremental File System uses fds opened in the context of vold.
|
|
|
|
allow installd vold:fd use;
|
|
|
|
|
2016-12-05 19:19:11 +01:00
|
|
|
###
|
|
|
|
### Neverallow rules
|
|
|
|
###
|
|
|
|
|
2019-11-27 02:34:29 +01:00
|
|
|
# only system_server, installd, dumpstate, and servicemanager may interact with installd over binder
|
2017-01-19 22:23:52 +01:00
|
|
|
neverallow { domain -system_server -dumpstate -installd } installd_service:service_manager find;
|
2019-11-27 02:34:29 +01:00
|
|
|
neverallow { domain -system_server -dumpstate -servicemanager } installd:binder call;
|
2019-01-27 22:39:19 +01:00
|
|
|
neverallow installd {
|
|
|
|
domain
|
|
|
|
-system_server
|
|
|
|
-servicemanager
|
|
|
|
userdebug_or_eng(`-su')
|
|
|
|
}:binder call;
|