2012-01-04 09:33:27 -08:00
|
|
|
# installer daemon
|
2015-11-03 09:54:39 -08:00
|
|
|
type installd, domain, domain_deprecated;
|
2012-01-04 09:33:27 -08:00
|
|
|
type installd_exec, exec_type, file_type;
|
2013-07-01 17:08:11 -07:00
|
|
|
typeattribute installd mlstrustedsubject;
|
|
|
|
allow installd self:capability { chown dac_override fowner fsetid setgid setuid };
|
2015-04-30 16:07:49 -07:00
|
|
|
|
|
|
|
# Allow labeling of files under /data/app/com.example/oat/
|
2015-03-03 18:19:12 -08:00
|
|
|
allow installd dalvikcache_data_file:dir relabelto;
|
2015-06-05 04:18:22 -07:00
|
|
|
allow installd dalvikcache_data_file:file { relabelto link };
|
2015-04-30 16:07:49 -07:00
|
|
|
|
|
|
|
# Allow movement of APK files between volumes
|
2015-03-03 18:19:12 -08:00
|
|
|
allow installd apk_data_file:dir { create_dir_perms relabelfrom };
|
2015-06-05 04:18:22 -07:00
|
|
|
allow installd apk_data_file:file { create_file_perms relabelfrom link };
|
2016-09-09 16:27:17 -07:00
|
|
|
allow installd apk_data_file:lnk_file { create r_file_perms unlink };
|
2015-04-30 16:07:49 -07:00
|
|
|
|
2014-05-09 11:26:36 -07:00
|
|
|
allow installd asec_apk_file:file r_file_perms;
|
2015-03-03 18:19:12 -08:00
|
|
|
allow installd apk_tmp_file:file { r_file_perms unlink };
|
|
|
|
allow installd apk_tmp_file:dir { relabelfrom create_dir_perms };
|
2014-04-25 13:59:52 -07:00
|
|
|
allow installd oemfs:dir r_dir_perms;
|
|
|
|
allow installd oemfs:file r_file_perms;
|
2013-07-01 17:08:11 -07:00
|
|
|
allow installd cgroup:dir create_dir_perms;
|
2016-09-09 16:27:17 -07:00
|
|
|
allow installd cgroup:{ file lnk_file } create_file_perms;
|
2015-06-15 22:18:32 -07:00
|
|
|
allow installd mnt_expand_file:dir { search getattr };
|
2013-07-01 17:08:11 -07:00
|
|
|
# Check validity of SELinux context before use.
|
|
|
|
selinux_check_context(installd)
|
2014-05-09 11:26:36 -07:00
|
|
|
|
2016-09-09 16:27:17 -07:00
|
|
|
r_dir_file(installd, rootfs)
|
|
|
|
|
2014-06-04 10:56:22 -07:00
|
|
|
# Search /data/app-asec and stat files in it.
|
2014-05-14 05:29:00 -07:00
|
|
|
allow installd asec_image_file:dir search;
|
2014-06-04 10:56:22 -07:00
|
|
|
allow installd asec_image_file:file getattr;
|
2014-05-14 05:29:00 -07:00
|
|
|
|
2014-05-09 11:26:36 -07: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;
|
|
|
|
allow installd system_data_file:lnk_file { create setattr unlink };
|
|
|
|
|
|
|
|
# Upgrade /data/media for multi-user if necessary.
|
|
|
|
allow installd media_rw_data_file:dir create_dir_perms;
|
2014-06-04 10:56:22 -07:00
|
|
|
allow installd media_rw_data_file:file { getattr unlink };
|
2014-05-09 11:26:36 -07:00
|
|
|
# restorecon new /data/media directory.
|
2014-05-07 10:10:02 -07:00
|
|
|
allow installd system_data_file:dir relabelfrom;
|
2014-05-09 11:26:36 -07:00
|
|
|
allow installd media_rw_data_file:dir relabelto;
|
|
|
|
|
2014-10-13 04:10:08 -07: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};
|
|
|
|
|
2014-05-09 11:26:36 -07:00
|
|
|
# Create /data/.layout_version.* file
|
2014-05-12 08:18:21 -07:00
|
|
|
type_transition installd system_data_file:file install_data_file;
|
|
|
|
allow installd install_data_file:file create_file_perms;
|
2014-05-09 11:26:36 -07: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;
|
|
|
|
|
2014-06-16 14:19:31 -07: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 11:26:36 -07:00
|
|
|
# Upgrade from unlabeled userdata.
|
2014-05-27 07:56:24 -07: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 11:26:36 -07:00
|
|
|
|
|
|
|
# Upgrade from before system_app_data_file was used for system UID apps.
|
2014-05-12 08:18:21 -07:00
|
|
|
# Just need enough to relabel it and to unlink removed package files.
|
2014-05-09 11:26:36 -07:00
|
|
|
# Directory access covered by earlier rule above.
|
2014-05-12 08:18:21 -07:00
|
|
|
allow installd system_data_file:notdevfile_class_set { getattr relabelfrom unlink };
|
2014-05-09 11:26:36 -07: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.
|
|
|
|
# Types extracted from seapp_contexts type= fields.
|
2015-11-25 09:41:05 -08:00
|
|
|
allow installd {
|
|
|
|
system_app_data_file
|
|
|
|
bluetooth_data_file
|
|
|
|
nfc_data_file
|
|
|
|
radio_data_file
|
|
|
|
shell_data_file
|
|
|
|
app_data_file
|
2016-10-06 13:15:44 -07:00
|
|
|
ephemeral_data_file
|
2015-11-25 09:41:05 -08:00
|
|
|
}:dir { create_dir_perms relabelfrom relabelto };
|
|
|
|
|
|
|
|
allow installd {
|
|
|
|
system_app_data_file
|
|
|
|
bluetooth_data_file
|
|
|
|
nfc_data_file
|
|
|
|
radio_data_file
|
|
|
|
shell_data_file
|
|
|
|
app_data_file
|
2016-10-06 13:15:44 -07:00
|
|
|
ephemeral_data_file
|
2015-11-25 09:41:05 -08:00
|
|
|
}:notdevfile_class_set { create_file_perms relabelfrom relabelto };
|
2015-04-09 21:07:36 -07:00
|
|
|
|
2016-02-01 11:28:39 -08:00
|
|
|
# Similar for the files under /data/misc/profiles/
|
|
|
|
allow installd user_profile_data_file:dir create_dir_perms;
|
|
|
|
allow installd user_profile_data_file:file create_file_perms;
|
2016-02-23 08:34:23 -08:00
|
|
|
allow installd user_profile_data_file:dir rmdir;
|
|
|
|
allow installd user_profile_data_file:file unlink;
|
2016-06-15 15:27:48 -07:00
|
|
|
allow installd user_profile_foreign_dex_data_file:dir { add_name getattr rmdir open read write search remove_name };
|
|
|
|
allow installd user_profile_foreign_dex_data_file:file { getattr rename unlink };
|
|
|
|
|
2016-05-27 12:41:35 -07: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 11:28:39 -08:00
|
|
|
|
2015-04-09 21:07:36 -07:00
|
|
|
# Create and use pty created by android_fork_execvp().
|
|
|
|
allow installd devpts:chr_file rw_file_perms;
|
2015-10-02 16:40:17 -07:00
|
|
|
|
|
|
|
# execute toybox for app relocation
|
|
|
|
allow installd toolbox_exec:file rx_file_perms;
|