diff options
author | 2022-09-13 18:18:04 +0100 | |
---|---|---|
committer | 2022-09-13 23:27:04 +0100 | |
commit | 7eacdf8e532839b75dd464b8f64a29845f8cb221 (patch) | |
tree | 9cd1d56e13ec5d457b8f9f4e3829c7ffceb614c0 /libnativeloader/library_namespaces.cpp | |
parent | a0a5d8ad760c73e7b21968aacc6232c091a893bb (diff) |
Allow the vendor partition to be in /system/vendor.
With the changed logic in https://r.android.com/2211602 it would
otherwise be treated as a system APK and given full access to system
libraries, which would be unfortunate.
/vendor must be a separate partition starting in U, but this is
necessary for the module on S and T.
A note on tests: It's difficult to set up fixtures to test
/system/{product,vendor} paths if the device has them as symlinks to
/{product,vendor}, because it would require moving the mount points and
symlink in the other direction.
Test: atest libnativeloader_e2e_tests
Bug: 237577392
Change-Id: I9267c008db644ebe38f6215d3b692b98dd88ee34
Diffstat (limited to 'libnativeloader/library_namespaces.cpp')
-rw-r--r-- | libnativeloader/library_namespaces.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index fd21f168ab..d49420f313 100644 --- a/libnativeloader/library_namespaces.cpp +++ b/libnativeloader/library_namespaces.cpp @@ -82,19 +82,22 @@ constexpr const char* kSharedNamespaceSuffix = "-shared"; constexpr const char* kAlwaysPermittedDirectories = "/data:/mnt/expand"; constexpr const char* kVendorLibPath = "/vendor/" LIB; +// TODO(mast): It's unlikely that both paths are necessary for kProductLibPath +// below, because they can't be two separate directories - either one has to be +// a symlink to the other. constexpr const char* kProductLibPath = "/product/" LIB ":/system/product/" LIB; constexpr const char* kSystemLibPath = "/system/" LIB ":/system_ext/" LIB; -const std::regex kVendorDexPathRegex("(^|:)/vendor/"); +const std::regex kVendorDexPathRegex("(^|:)(/system)?/vendor/"); const std::regex kProductDexPathRegex("(^|:)(/system)?/product/"); const std::regex kSystemDexPathRegex("(^|:)/system(_ext)?/"); // MUST be tested last. // Define origin partition of APK using ApkOrigin = enum { APK_ORIGIN_DEFAULT = 0, - APK_ORIGIN_VENDOR = 1, + APK_ORIGIN_VENDOR = 1, // Includes both /vendor and /system/vendor APK_ORIGIN_PRODUCT = 2, // Includes both /product and /system/product - APK_ORIGIN_SYSTEM = 3, // Includes both /system and /system_ext but not /system/product + APK_ORIGIN_SYSTEM = 3, // Includes both /system and /system_ext but not /system/{vendor,product} }; jobject GetParentClassLoader(JNIEnv* env, jobject class_loader) { |