aboutsummaryrefslogtreecommitdiffstats
path: root/uncrypt.te
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2014-02-19 13:33:32 -0800
committerNick Kralevich <nnk@google.com>2014-02-19 13:36:09 -0800
commit96eeb1ecb3980e34a5f9ed1a4afd8ffa6ada0cf0 (patch)
treecc50ae0bd16eb0a9bcb1e5407c6172bc44b1f4e3 /uncrypt.te
parent41f221f416ce3368f394c5eb8578358c52755fc4 (diff)
downloadandroid_external_sepolicy-96eeb1ecb3980e34a5f9ed1a4afd8ffa6ada0cf0.tar.gz
android_external_sepolicy-96eeb1ecb3980e34a5f9ed1a4afd8ffa6ada0cf0.tar.bz2
android_external_sepolicy-96eeb1ecb3980e34a5f9ed1a4afd8ffa6ada0cf0.zip
initial policy for uncrypt.
Add initial support for uncrypt, started via the pre-recovery service in init.rc. On an encrypted device, uncrypt reads an OTA zip file on /data, opens the underlying block device, and writes the unencrypted blocks on top of the encrypted blocks. This allows recovery, which can't normally read encrypted partitions, to reconstruct the OTA image and apply the update as normal. Add an exception to the neverallow rule for sys_rawio. This is needed to support writing to the raw block device. Add an exception to the neverallow rule for unlabeled block devices. The underlying block device for /data varies between devices within the same family (for example, "flo" vs "deb"), and the existing per-device file_context labeling isn't sufficient to cover these differences. Until I can resolve this problem, allow access to any block devices. Bug: 13083922 Change-Id: I7cd4c3493c151e682866fe4645c488b464322379
Diffstat (limited to 'uncrypt.te')
-rw-r--r--uncrypt.te25
1 files changed, 25 insertions, 0 deletions
diff --git a/uncrypt.te b/uncrypt.te
new file mode 100644
index 0000000..aea6668
--- /dev/null
+++ b/uncrypt.te
@@ -0,0 +1,25 @@
+# uncrypt
+type uncrypt, domain;
+type uncrypt_exec, exec_type, file_type;
+
+init_daemon_domain(uncrypt)
+permissive_or_unconfined(uncrypt)
+
+allow uncrypt self:capability dac_override;
+
+# Read OTA zip file from /data/data/com.google.android.gsf/app_download
+r_dir_file(uncrypt, app_data_file)
+
+# Create tmp file /cache/recovery/command.tmp
+# Read /cache/recovery/command
+# Rename /cache/recovery/command.tmp to /cache/recovery/command
+allow uncrypt cache_file:dir rw_dir_perms;
+allow uncrypt cache_file:file create_file_perms;
+
+# Set a property to reboot the device.
+unix_socket_connect(uncrypt, property, init)
+allow uncrypt powerctl_prop:property_service set;
+
+# Raw writes to block device
+allow uncrypt self:capability sys_rawio;
+allow uncrypt block_device:blk_file w_file_perms;