2012-01-04 18:33:27 +01:00
|
|
|
# installer daemon
|
|
|
|
type installd, domain;
|
|
|
|
type installd_exec, exec_type, file_type;
|
|
|
|
|
|
|
|
init_daemon_domain(installd)
|
2013-07-02 02:08:11 +02:00
|
|
|
typeattribute installd mlstrustedsubject;
|
|
|
|
allow installd self:capability { chown dac_override fowner fsetid setgid setuid };
|
2014-05-31 00:21:22 +02:00
|
|
|
allow installd apk_data_file:file rename;
|
|
|
|
allow installd apk_data_file:dir create_dir_perms;
|
|
|
|
allow installd apk_data_file:lnk_file { create read unlink };
|
2014-05-09 20:26:36 +02:00
|
|
|
allow installd asec_apk_file:file r_file_perms;
|
2013-07-02 02:08:11 +02:00
|
|
|
allow installd apk_tmp_file:file r_file_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 system_file:file x_file_perms;
|
|
|
|
allow installd cgroup:dir create_dir_perms;
|
|
|
|
# Check validity of SELinux context before use.
|
|
|
|
selinux_check_context(installd)
|
|
|
|
# Read /seapp_contexts and /data/security/seapp_contexts
|
|
|
|
security_access_policy(installd)
|
2014-05-09 20:26:36 +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;
|
|
|
|
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 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;
|
|
|
|
|
|
|
|
# Create /data/.layout_version.* file
|
2014-05-12 17:18:21 +02:00
|
|
|
type_transition installd system_data_file:file install_data_file;
|
|
|
|
allow installd install_data_file:file create_file_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;
|
|
|
|
|
|
|
|
# Create /data/dalvik-cache/profiles.
|
|
|
|
allow installd dalvikcache_profiles_data_file:dir rw_dir_perms;
|
|
|
|
allow installd dalvikcache_profiles_data_file:file create_file_perms;
|
|
|
|
|
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-07-03 07:59:19 +02:00
|
|
|
# Run dex2oat in its own sandbox.
|
|
|
|
domain_auto_trans(installd, dex2oat_exec, dex2oat)
|
|
|
|
# dex2oat needs LD_PRELOAD, passed down from init
|
|
|
|
# https://android-review.googlesource.com/94851
|
|
|
|
allow installd dex2oat:process noatsecure;
|
|
|
|
|
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.
|
|
|
|
# Types extracted from seapp_contexts type= fields.
|
|
|
|
allow installd { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:dir { create_dir_perms relabelfrom relabelto };
|
2014-05-12 14:41:14 +02:00
|
|
|
allow installd { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:lnk_file { create setattr getattr unlink rename relabelfrom relabelto };
|
2014-06-11 15:09:25 +02:00
|
|
|
allow installd { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:{ file sock_file fifo_file } { getattr unlink rename relabelfrom relabelto setattr };
|