From cf610692252b4df30b42f2bce3de464ac1804f97 Mon Sep 17 00:00:00 2001
From: Stephen Smalley <sds@tycho.nsa.gov>
Date: Fri, 20 Jun 2014 14:13:14 -0400
Subject: [PATCH] Only allow app domains to access SDcard via fuse mount.

sdcard_internal is assigned to fuse mounts while sdcard_external
is assigned to vfat mounts by genfs_contexts.  Originally we
allowed access to both via the sdcard_type attribute, and access
via both means was required.  IIUC however, in 4.4 and later,
SDcard access should always occur via the fuse mount and we can
drop access to sdcard_external.

I think we can do the same for all domains except sdcardd.  However,
I cannot test this as the Nexus devices do not have external SDcard
support.

Also wondering if we should rename sdcard_internal type to fuse
and sdcard_external type to vfat to more clearly represent their
meaning, since one accesses the external SDcard via the fuse mount now.

Change-Id: Ie44221e9eea90e627a48df5398c456b86293f724
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
 app.te | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app.te b/app.te
index df8ff81b4..63e61e0ff 100644
--- a/app.te
+++ b/app.te
@@ -115,9 +115,9 @@ allow appdomain radio_data_file:file { read write getattr };
 # cropping or taking user photos.
 allow untrusted_app system_app_data_file:file { read write getattr };
 
-# Access SDcard.
-allow appdomain sdcard_type:dir create_dir_perms;
-allow appdomain sdcard_type:file create_file_perms;
+# Access SDcard via the fuse mount.
+allow appdomain sdcard_internal:dir create_dir_perms;
+allow appdomain sdcard_internal:file create_file_perms;
 
 # Allow apps to use the USB Accessory interface.
 # http://developer.android.com/guide/topics/connectivity/usb/accessory.html
-- 
GitLab