android_system_sepolicy/installd.te

51 lines
2.7 KiB
Plaintext
Raw Normal View History

2012-01-04 09:33:27 -08:00
# installer daemon
type installd, domain;
type installd_exec, exec_type, file_type;
init_daemon_domain(installd)
typeattribute installd mlstrustedsubject;
allow installd self:capability { chown dac_override fowner fsetid setgid setuid };
allow installd system_data_file:file create_file_perms;
allow installd system_data_file:lnk_file create;
allow installd dalvikcache_data_file:file create_file_perms;
Define a type for /data/dalvik-cache/profiles. I9b8e59e3bd7df8a1bf60fa7ffd376a24ba0eb42f added a profiles subdirectory to /data/dalvik-cache with files that must be app-writable. As a result, we have denials such as: W/Profiler( 3328): type=1400 audit(0.0:199): avc: denied { write } for name="com.google.android.setupwizard" dev="mmcblk0p28" ino=106067 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file W/Profiler( 3328): type=1300 audit(0.0:199): arch=40000028 syscall=322 per=800000 success=yes exit=33 a0=ffffff9c a1=b8362708 a2=20002 a3=0 items=1 ppid=194 auid=4294967295 uid=10019 gid=10019 euid=10019 suid=10019 fsuid=10019 egid=10019 sgid=10019 fsgid=10019 tty=(none) ses=4294967295 exe="/system/bin/app_process" subj=u:r:untrusted_app:s0 key=(null) W/auditd ( 286): type=1307 audit(0.0:199): cwd="/" W/auditd ( 286): type=1302 audit(0.0:199): item=0 name="/data/dalvik-cache/profiles/com.google.android.setupwizard" inode=106067 dev=b3:1c mode=0100664 ouid=1012 ogid=50019 rdev=00:00 obj=u:object_r:dalvikcache_data_file:s0 We do not want to allow untrusted app domains to write to the existing type on other /data/dalvik-cache files as that could be used for code injection into another app domain, the zygote or the system_server. So define a new type for this subdirectory. The restorecon_recursive /data in init.rc will fix the labeling on devices that already have a profiles directory created. For correct labeling on first creation, we also need a separate change to installd under the same change id. Bug: 13927667 Change-Id: I4857d031f9e7e60d48b8c72fcb22a81b3a2ebaaa Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-04-09 11:24:33 -07:00
allow installd dalvikcache_profiles_data_file:dir create_dir_perms;
allow installd dalvikcache_profiles_data_file:file create_file_perms;
allow installd { data_file_type -keystore_data_file }:dir create_dir_perms;
allow installd { data_file_type -keystore_data_file }:dir { relabelfrom relabelto };
allow installd { data_file_type -keystore_data_file }:{ file_class_set } { getattr unlink };
allow installd apk_data_file:file r_file_perms;
allow installd apk_tmp_file:file r_file_perms;
allow installd oemfs:dir r_dir_perms;
allow installd oemfs:file r_file_perms;
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)
# ASEC
allow installd app_data_file:lnk_file { create setattr };
allow installd asec_apk_file:file r_file_perms;
allow installd bluetooth_data_file:lnk_file { create setattr };
allow installd nfc_data_file:lnk_file { create setattr };
allow installd radio_data_file:lnk_file { create setattr };
allow installd shell_data_file:lnk_file { create setattr };
allow installd system_app_data_file:lnk_file { create setattr };
# restorecon /data/data
allow installd unlabeled:dir relabelfrom;
allow installd unlabeled:notdevfile_class_set relabelfrom;
allow installd system_data_file:dir relabelfrom;
allow installd system_data_file:notdevfile_class_set relabelfrom;
allow installd system_app_data_file:dir { relabelfrom relabelto };
allow installd system_app_data_file:notdevfile_class_set { relabelfrom relabelto };
allow installd bluetooth_data_file:dir { relabelfrom relabelto };
allow installd bluetooth_data_file:notdevfile_class_set { relabelfrom relabelto };
allow installd nfc_data_file:dir { relabelfrom relabelto };
allow installd nfc_data_file:notdevfile_class_set { relabelfrom relabelto };
allow installd radio_data_file:dir { relabelfrom relabelto };
allow installd radio_data_file:notdevfile_class_set { relabelfrom relabelto };
allow installd app_data_file:dir { relabelfrom relabelto };
allow installd app_data_file:notdevfile_class_set { relabelfrom relabelto };
allow installd shell_data_file:dir { relabelfrom relabelto };
allow installd shell_data_file:notdevfile_class_set { relabelfrom relabelto };