blob: ec64a33478822ff6f5cfe4d1b83544080b8897e6 [file] [log] [blame]
Pierre-Hugues Hussonc642be22018-07-07 23:43:53 +02001From e89aed22785fc3ce5aa0bd75c6410003dbc55245 Mon Sep 17 00:00:00 2001
2From: Pierre-Hugues Husson <phh@phh.me>
3Date: Tue, 1 May 2018 17:47:36 +0200
4Subject: [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
11diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
12index 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);
35diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
36index 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--
502.7.4
51