)]}'
{
  "commit": "266594305a1a1a140a911685cbb5a1ded45426f7",
  "tree": "0406bf1264fffb62a00f3f87ddf0e319692fb3d0",
  "parents": [
    "816cab342a8db032b660018d4c933032a326b5c8"
  ],
  "author": {
    "name": "Martin Stjernholm",
    "email": "mast@google.com",
    "time": "Fri Apr 16 19:55:03 2021 +0100"
  },
  "committer": {
    "name": "Nicolas Geoffray",
    "email": "ngeoffray@google.com",
    "time": "Mon May 10 09:40:21 2021 +0000"
  },
  "message": "Avoid loading external libraries from ARTs internal linker namespace\n(reland).\n\ndlopen() calls in ART will use its own linker namespace\n(com_android_art). That\u0027s appropriate for internal libraries in the\nAPEX, but not when ART loads libraries on behalf of external requests.\nIn those cases we should instead use android_dlopen_ext to load them\nfrom the system namespace, i.e. the one that searches /system/lib(64).\n\nThe linker config has been using allow_all_shared_libs, so any loads\nfrom com_android_art fall back to the system namespace, and hence\ndlopen() usually works regardless which namespace it ought to use.\nHowever we want to drop allow_all_shared_libs, so we need to figure out\nwhich dlopen\u0027s should use which namespace:\n\n1. Several ART libraries are loaded on-demand, e.g. libart-compiler and\n   libart-disassembler. There are also those going through the runtime\n   plugin system, like libperfetto_hprofd and heapprofd_client_api. All\n   these are internal or at least statically known (so we can provide\n   links for them in the linker config), and should continue to use\n   dlopen from the ART namespace.\n\n2. libnativeloader loads the preloadable public libraries from\n   system/etc/public.libraries.txt, and should use the system namespace\n   for that.\n\n3. libnativebridge loads the native bridge implementation specified\n   through the command line (or ultimately the system property\n   ro.dalvik.vm.native.bridge). It\u0027s not part of the ART APEX and not\n   known statically, so the system namespace should be used.\n\n4. libnativeloader also loads JNI libraries from classloader\n   namespaces, but has a fallback if no such namespace can be found\n   based on caller location. Fall back to the system namespace to\n   handle libraries loaded during the preload phase in the zygote.\n\n5. JVMTI agents are loaded by dalvik.system.VMDebug.attachAgent().\n   Treat these too as external libraries - they are loaded in a way\n   similar to JNI libraries through OpenNativeLibrary in\n   libnativeloader, so are covered by #4.\n\n   They are normally loaded by apps with a classloader, but a special\n   case is adbconnection which loads libjdwp.so in the ART APEX without\n   one and hence falls back to the system namespace. We therefore need\n   to create a link for it (https://r.android.com/1690889,\n   https://r.android.com/1690795).\n\nAll cases #2-#5 are covered by libnativeloader and libnativebridge.\nIntroduce OpenSystemLibrary, and since libnativeloader depends on\nlibnativebridge, put it in the latter to be usable from both. It\u0027s only\nan internal dependency not exposed in the APEX stubs.\n\n(Another possibility could be to put it in the generic toolbox lib\nlibartbase, but it\u0027s split into -d and non-d variants, and we don\u0027t\nwant to split libnative{loader,bridge} that way.)\n\nSince libnativeloader_test no longer needs to mock dlopen we can\nsimplify it to a more regular test that loads the tested libs\ndynamically.\n\nThis relands https://r.android.com/1673312 without setting\nANDROID_ADDITIONAL_PUBLIC_LIBRARIES in run-test-jar, because that made\nlibnativeloader try to preload internal libraries from the system\nnamespace.\n\nTest: mmm art\nTest: atest art/libnativeloader\nTest: atest CtsJniTestCases\nTest: Cuttlefish app compat test that uses NDK translation\nTest: Manual tests with Android Studio TI agents\n  (http://g/art-module-team/7Jy3Tg7LCh0)\nTest: art/test/testrunner/testrunner.py --target --64 --optimizing\n  in chroot on cuttlefish\nBug: 130340935\nChange-Id: I7fb32faacc1c214402b58125d8190e97bbbcfad2\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "cb07d35363725b78551217538a3575e57d32ce75",
      "old_mode": 33188,
      "old_path": "libnativebridge/Android.bp",
      "new_id": "8e87997b00f13b77af83e76965cbe1eb16260dcc",
      "new_mode": 33188,
      "new_path": "libnativebridge/Android.bp"
    },
    {
      "type": "modify",
      "old_id": "e20b6270a119907dc91f4b87b333d0412fb1b7b9",
      "old_mode": 33188,
      "old_path": "libnativebridge/include/nativebridge/native_bridge.h",
      "new_id": "2199bab5521f140b840c4f33888bd18a94ececb9",
      "new_mode": 33188,
      "new_path": "libnativebridge/include/nativebridge/native_bridge.h"
    },
    {
      "type": "modify",
      "old_id": "46a05a23bff7931584c23b934c99df642f73fe08",
      "old_mode": 33188,
      "old_path": "libnativebridge/native_bridge.cc",
      "new_id": "fb13d62be00298afa8333e954d07b24c6464018c",
      "new_mode": 33188,
      "new_path": "libnativebridge/native_bridge.cc"
    },
    {
      "type": "modify",
      "old_id": "316c0874530fd3287a7b99192b6bd56cd76e6dd6",
      "old_mode": 33188,
      "old_path": "libnativeloader/Android.bp",
      "new_id": "2cc6b80787f990c67eaad48dc47336a330c97dcc",
      "new_mode": 33188,
      "new_path": "libnativeloader/Android.bp"
    },
    {
      "type": "modify",
      "old_id": "79fee060cf6cb509be3b7743751865219f9de7b5",
      "old_mode": 33188,
      "old_path": "libnativeloader/library_namespaces.cpp",
      "new_id": "59369eee43fb3e9400372fe8e6a591bb1949c3a2",
      "new_mode": 33188,
      "new_path": "libnativeloader/library_namespaces.cpp"
    },
    {
      "type": "modify",
      "old_id": "b34692ae16d5009c1e8f934b989c486da3840c87",
      "old_mode": 33188,
      "old_path": "libnativeloader/native_loader.cpp",
      "new_id": "30c7b5a377d538144f43ad851be95b249efca300",
      "new_mode": 33188,
      "new_path": "libnativeloader/native_loader.cpp"
    },
    {
      "type": "modify",
      "old_id": "43c3c151c925bbd91b00261eefb3b8cf47475a55",
      "old_mode": 33188,
      "old_path": "libnativeloader/native_loader_test.cpp",
      "new_id": "e754414f46fe298d93440ab4ddecdf45242722e5",
      "new_mode": 33188,
      "new_path": "libnativeloader/native_loader_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "86eb722e6b7a8b0e1dea78cc930a0f95455d69c2",
      "old_mode": 33261,
      "old_path": "test/etc/run-test-jar",
      "new_id": "ba3c4eb60ff10688150216555a525716adccd067",
      "new_mode": 33261,
      "new_path": "test/etc/run-test-jar"
    }
  ]
}
