Pierre-Hugues Husson | c642be2 | 2018-07-07 23:43:53 +0200 | [diff] [blame^] | 1 | From e89aed22785fc3ce5aa0bd75c6410003dbc55245 Mon Sep 17 00:00:00 2001 |
| 2 | From: Pierre-Hugues Husson <phh@phh.me> |
| 3 | Date: Tue, 1 May 2018 17:47:36 +0200 |
| 4 | Subject: [PATCH 07/16] Also scan /system/overlay |
| 5 | |
| 6 | --- |
| 7 | core/jni/android_util_AssetManager.cpp | 6 +++++- |
| 8 | core/jni/fd_utils.cpp | 3 ++- |
| 9 | 2 files changed, 7 insertions(+), 2 deletions(-) |
| 10 | |
| 11 | diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp |
| 12 | index 30d8abe..9ec1a75 100644 |
| 13 | --- a/core/jni/android_util_AssetManager.cpp |
| 14 | +++ b/core/jni/android_util_AssetManager.cpp |
| 15 | @@ -164,7 +164,7 @@ static void verifySystemIdmaps() |
| 16 | } |
| 17 | |
| 18 | // Generic idmap parameters |
| 19 | - const char* argv[9]; |
| 20 | + const char* argv[10]; |
| 21 | int argc = 0; |
| 22 | struct stat st; |
| 23 | |
| 24 | @@ -193,6 +193,10 @@ static void verifySystemIdmaps() |
| 25 | argv[argc++] = "/product/overlay"; |
| 26 | } |
| 27 | |
| 28 | + if (stat("/system/overlay/", &st) == 0) { |
| 29 | + argv[argc++] = "/system/overlay"; |
| 30 | + } |
| 31 | + |
| 32 | // Finally, invoke idmap (if any overlay directory exists) |
| 33 | if (argc > 5) { |
| 34 | execv(AssetManager::IDMAP_BIN, (char* const*)argv); |
| 35 | diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp |
| 36 | index 496b140..6ba3798 100644 |
| 37 | --- a/core/jni/fd_utils.cpp |
| 38 | +++ b/core/jni/fd_utils.cpp |
| 39 | @@ -90,7 +90,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const { |
| 40 | if ((android::base::StartsWith(path, kOverlayDir) |
| 41 | || android::base::StartsWith(path, kOverlaySubdir) |
| 42 | || android::base::StartsWith(path, kVendorOverlayDir) |
| 43 | - || android::base::StartsWith(path, "/product/overlay")) |
| 44 | + || android::base::StartsWith(path, "/product/overlay") |
| 45 | + || android::base::StartsWith(path, "/system/overlay")) |
| 46 | && android::base::EndsWith(path, kApkSuffix) |
| 47 | && path.find("/../") == std::string::npos) { |
| 48 | return true; |
| 49 | -- |
| 50 | 2.7.4 |
| 51 | |