From 721f1adf53be30eda7668d09ba271cc21aeb4fa1 Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Thu, 13 Mar 2014 15:35:46 -0400 Subject: [PATCH] Allow drmserver and mediaserver to read apk files. Required to support passing resources via open apk files over Binder. Resolves denials such as: avc: denied { read } for pid=31457 comm="SoundPoolThread" path="/mnt/asec/au.com.shiftyjelly.pocketcasts-1/pkg.apk" dev="dm-10" ino=12 scontext=u:r:mediaserver:s0 tcontext=u:object_r:asec_apk_file:s0 tclass=file avc: denied { read } for pid=31439 comm="Binder_2" path="/mnt/asec/au.com.shiftyjelly.pocketcasts-1/pkg.apk" dev="dm-10" ino=12 scontext=u:r:drmserver:s0 tcontext=u:object_r:asec_apk_file:s0 tclass=file We do not allow open as it is not required (i.e. the files are passed as open files over Binder or local socket and opened by the client). Change-Id: Ib0941df1e9aac8d20621a356d2d212b98471abbc Signed-off-by: Stephen Smalley --- drmserver.te | 4 ++++ mediaserver.te | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drmserver.te b/drmserver.te index b4191118d..c8e0b2170 100644 --- a/drmserver.te +++ b/drmserver.te @@ -37,3 +37,7 @@ allow drmserver apk_data_file:sock_file unlink; # After taking a video, drmserver looks at the video file. r_dir_file(drmserver, media_rw_data_file) + +# Read resources from open apk files passed over Binder. +allow drmserver apk_data_file:file { read getattr }; +allow drmserver asec_apk_file:file { read getattr }; diff --git a/mediaserver.te b/mediaserver.te index faec50dad..43783d653 100644 --- a/mediaserver.te +++ b/mediaserver.te @@ -36,8 +36,9 @@ allow mediaserver audio_device:chr_file rw_file_perms; # XXX Label with a specific type? allow mediaserver sysfs:file rw_file_perms; -# XXX Why? +# Read resources from open apk files passed over Binder. allow mediaserver apk_data_file:file { read getattr }; +allow mediaserver asec_apk_file:file { read getattr }; # Access camera device. allow mediaserver camera_device:chr_file rw_file_perms;