OSDN Git Service

Exclude /mnt/vendor from vold's ownership.
authorTri Vo <trong@google.com>
Mon, 16 Apr 2018 21:27:10 +0000 (14:27 -0700)
committerTri Vo <trong@google.com>
Mon, 16 Apr 2018 21:33:53 +0000 (14:33 -0700)
Addresses this selinux denial:
avc: denied { search } for name="vendor" dev="tmpfs" ino=11069
scontext=u:r:vold:s0 tcontext=u:object_r:mnt_vendor_file:s0 tclass=dir
permissive=0

Bug: 64905218
Test: fixes above denial.
Change-Id: I670b2148e65c7e0fcabd1e11f5bace0c4f4e18bd

VolumeManager.cpp

index 5e6e74f..8c32587 100644 (file)
@@ -623,8 +623,9 @@ int VolumeManager::unmountAll() {
     mntent* mentry;
     while ((mentry = getmntent(fp)) != NULL) {
         auto test = std::string(mentry->mnt_dir);
-        if (android::base::StartsWith(test, "/mnt/")
-                || android::base::StartsWith(test, "/storage/")) {
+        if ((android::base::StartsWith(test, "/mnt/") &&
+             !android::base::StartsWith(test, "/mnt/vendor")) ||
+            android::base::StartsWith(test, "/storage/")) {
             toUnmount.push_front(test);
         }
     }