Merge "Replaceable mac_permission.xml support"
diff --git a/file_contexts b/file_contexts
index 976783f..837ee1d 100644
--- a/file_contexts
+++ b/file_contexts
@@ -1,9 +1,31 @@
###########################################
# Root
-#
-# Nothing required since it is initramfs and implicitly labeled
-# by genfscon rootfs in ocontexts.
-#
+/ u:object_r:rootfs:s0
+
+# Data files
+/adb_keys u:object_r:rootfs:s0
+/default.prop u:object_r:rootfs:s0
+/fstab\..* u:object_r:rootfs:s0
+/init\..* u:object_r:rootfs:s0
+/res(/.*)? u:object_r:rootfs:s0
+/ueventd\..* u:object_r:rootfs:s0
+
+# Executables
+/charger u:object_r:rootfs:s0
+/init u:object_r:rootfs:s0
+/sbin(/.*)? u:object_r:rootfs:s0
+
+# Empty directories
+/lost\+found u:object_r:rootfs:s0
+/proc u:object_r:rootfs:s0
+/sys u:object_r:rootfs:s0
+
+# SELinux policy files
+/file_contexts u:object_r:rootfs:s0
+/property_contexts u:object_r:rootfs:s0
+/seapp_contexts u:object_r:rootfs:s0
+/sepolicy u:object_r:rootfs:s0
+
##########################
# Devices
#
diff --git a/mediaserver.te b/mediaserver.te
index 4b299a0..f5274d9 100644
--- a/mediaserver.te
+++ b/mediaserver.te
@@ -2,18 +2,23 @@
type mediaserver, domain;
type mediaserver_exec, exec_type, file_type;
-init_daemon_domain(mediaserver)
-net_domain(mediaserver)
typeattribute mediaserver mlstrustedsubject;
-allow mediaserver kernel:system module_request;
+
+net_domain(mediaserver)
+init_daemon_domain(mediaserver)
+unix_socket_connect(mediaserver, property, init)
+
+r_dir_file(mediaserver, sdcard)
+
binder_use(mediaserver)
binder_call(mediaserver, binderservicedomain)
binder_call(mediaserver, appdomain)
binder_transfer(mediaserver, surfaceflinger)
binder_service(mediaserver)
+
+allow mediaserver kernel:system module_request;
allow mediaserver app_data_file:dir search;
allow mediaserver app_data_file:file r_file_perms;
-r_dir_file(mediaserver, sdcard)
allow mediaserver sdcard:file write;
allow mediaserver camera_device:chr_file rw_file_perms;
allow mediaserver graphics_device:chr_file rw_file_perms;
@@ -21,8 +26,12 @@
allow mediaserver audio_device:dir r_dir_perms;
allow mediaserver audio_device:chr_file rw_file_perms;
allow mediaserver qemu_device:chr_file rw_file_perms;
+allow mediaserver tee_device:chr_file rw_file_perms;
+allow mediaserver audio_prop:property_service set;
+
# XXX Label with a specific type?
allow mediaserver sysfs:file rw_file_perms;
+
# XXX Why?
allow mediaserver apk_data_file:file { read getattr };
@@ -39,7 +48,6 @@
# Read/[write] to /proc/net/xt_qtaguid/ctrl and /dev/xt_qtaguid
allow mediaserver qtaguid_proc:file rw_file_perms;
allow mediaserver qtaguid_device:chr_file r_file_perms;
+
# Allow abstract socket connection
allow mediaserver rild:unix_stream_socket connectto;
-
-allow mediaserver tee_device:chr_file rw_file_perms;
diff --git a/property.te b/property.te
index b62004e..ed84c64 100644
--- a/property.te
+++ b/property.te
@@ -7,3 +7,4 @@
type ctl_default_prop, property_type;
type ctl_dumpstate_prop, property_type;
type ctl_rildaemon_prop, property_type;
+type audio_prop, property_type;
diff --git a/property_contexts b/property_contexts
index a08ae80..d86bcb6 100644
--- a/property_contexts
+++ b/property_contexts
@@ -29,6 +29,7 @@
service.adb.root u:object_r:shell_prop:s0
service.adb.tcp.port u:object_r:shell_prop:s0
+persist.audio. u:object_r:audio_prop:s0
persist.sys. u:object_r:system_prop:s0
persist.service. u:object_r:system_prop:s0
persist.security. u:object_r:system_prop:s0
diff --git a/zygote.te b/zygote.te
index 3350ce3..743af36 100644
--- a/zygote.te
+++ b/zygote.te
@@ -6,6 +6,8 @@
typeattribute zygote mlstrustedsubject;
# Override DAC on files and switch uid/gid.
allow zygote self:capability { dac_override setgid setuid };
+# Drop capabilities from bounding set.
+allow zygote self:capability setpcap;
# Switch SELinux context to app domains.
allow zygote system:process dyntransition;
allow zygote appdomain:process dyntransition;