aboutsummaryrefslogtreecommitdiffstats
path: root/device.te
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2014-09-23 09:11:30 -0400
committerNick Kralevich <nnk@google.com>2014-09-28 03:23:27 +0000
commit8a0c25efb0553576afadc157b86b65eedf2ef917 (patch)
tree94913518dcd674ecf5950342dd3fc1a120f203bf /device.te
parent54e9bc4514bc29b29e5450828cdd8953163cb44c (diff)
downloadandroid_external_sepolicy-8a0c25efb0553576afadc157b86b65eedf2ef917.tar.gz
android_external_sepolicy-8a0c25efb0553576afadc157b86b65eedf2ef917.tar.bz2
android_external_sepolicy-8a0c25efb0553576afadc157b86b65eedf2ef917.zip
Do not allow init to execute anything without changing domains.
Remove the ability of init to execute programs from / or /system without changing domains. This forces all helper programs and services invoked by init to be assigned their own domain. Introduce separate domains for running the helper programs executed from the fs_mgr library by init. This requires a domain for e2fsck (named fsck for generality) and a domain for running mkswap (named toolbox since mkswap is just a symlink to the toolbox binary and the domain transition occurs on executing the binary, not based on the symlink in any way). e2fsck is invoked on any partitions marked with the check mount option in the fstab file, typically userdata and cache but never system. We allow it to read/write the userdata_block_device and cache_block_device types but also allow it to read/write the default block_device type until we can get the more specific types assigned in all of the device-specific policies. mkswap is invoked on any swap partition defined in the fstab file. We introduce a new swap_block_device type for this purpose, to be assigned to any such block devices in the device-specific policies, and only allow it to read/write such block devices. As there seem to be no devices in AOSP with swap partitions in their fstab files, this does not appear to risk any breakage for existing devices. With the introduction of these domains, we can de-privilege init to only having read access to block devices for mounting filesystems; it no longer needs direct write access to such devices AFAICT. To avoid breaking execution of toolbox by system services, apps, or the shell, we allow all domains other than kernel and init the ability to run toolbox in their own domain. This is broader than strictly required; we could alternatively only add it to those domains that already had x_file_perms to system_file but this would require a coordinated change with device-specific policy. Change-Id: Ib05de2d2bc2781dad48b70ba385577cb855708e4 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'device.te')
-rw-r--r--device.te3
1 files changed, 3 insertions, 0 deletions
diff --git a/device.te b/device.te
index 788d9cb..abe5daa 100644
--- a/device.te
+++ b/device.te
@@ -73,3 +73,6 @@ type userdata_block_device, dev_type;
# Cache block device mounted on /cache.
type cache_block_device, dev_type;
+
+# Block device for any swap partition.
+type swap_block_device, dev_type;