Add runtime namespace am: 72410b5474
am: 0fd4cc0afb
Change-Id: Ib5f13b8682a6e5b20b5c74a05a4caee4edd5b5dc
diff --git a/contents/include/linkerconfig/namespacebuilder.h b/contents/include/linkerconfig/namespacebuilder.h
index 107d3b7..f582063 100644
--- a/contents/include/linkerconfig/namespacebuilder.h
+++ b/contents/include/linkerconfig/namespacebuilder.h
@@ -38,6 +38,7 @@
NamespaceBuilder BuildUnrestrictedDefaultNamespace;
NamespaceBuilder BuildPostInstallNamespace;
NamespaceBuilder BuildNeuralNetworksNamespace;
+NamespaceBuilder BuildRuntimeNamespace;
} // namespace contents
} // namespace linkerconfig
} // namespace android
diff --git a/contents/namespace/runtime.cc b/contents/namespace/runtime.cc
new file mode 100644
index 0000000..564cb17
--- /dev/null
+++ b/contents/namespace/runtime.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "linkerconfig/namespacebuilder.h"
+
+using android::linkerconfig::modules::AsanPath;
+using android::linkerconfig::modules::Namespace;
+
+namespace android {
+namespace linkerconfig {
+namespace contents {
+
+Namespace BuildRuntimeNamespace([[maybe_unused]] const Context& ctx) {
+ // Currently, the runtime namespace is only to isolate
+ // libc_malloc_hooks/debug.so. libc/l/d are loaded in the default namespace.
+ Namespace ns("runtime",
+ /*is_isolated=*/true,
+ /*is_visible=*/true);
+
+ ns.AddSearchPath("/apex/com.android.runtime/${LIB}", AsanPath::SAME_PATH);
+
+ ns.GetLink(ctx.GetSystemNamespaceName())
+ .AddSharedLib("libc.so", "libdl.so", "libm.so", "liblog.so");
+
+ return ns;
+}
+
+} // namespace contents
+} // namespace linkerconfig
+} // namespace android
diff --git a/contents/section/legacy.cc b/contents/section/legacy.cc
index cd448f6..c3d0940 100644
--- a/contents/section/legacy.cc
+++ b/contents/section/legacy.cc
@@ -37,6 +37,7 @@
namespaces.emplace_back(BuildConscryptNamespace(ctx));
namespaces.emplace_back(BuildResolvNamespace(ctx));
namespaces.emplace_back(BuildNeuralNetworksNamespace(ctx));
+ namespaces.emplace_back(BuildRuntimeNamespace(ctx));
Section section("legacy", std::move(namespaces));
AddStandardSystemLinks(ctx, §ion);
diff --git a/contents/section/system.cc b/contents/section/system.cc
index da002de..d944f5f 100644
--- a/contents/section/system.cc
+++ b/contents/section/system.cc
@@ -41,6 +41,7 @@
namespaces.emplace_back(BuildRsNamespace(ctx));
namespaces.emplace_back(BuildVndkNamespace(ctx));
namespaces.emplace_back(BuildNeuralNetworksNamespace(ctx));
+ namespaces.emplace_back(BuildRuntimeNamespace(ctx));
Section section("system", std::move(namespaces));
AddStandardSystemLinks(ctx, §ion);
diff --git a/contents/section/vendor.cc b/contents/section/vendor.cc
index 7674433..f872be3 100644
--- a/contents/section/vendor.cc
+++ b/contents/section/vendor.cc
@@ -49,6 +49,8 @@
namespaces.emplace_back(BuildVndkInSystemNamespace(ctx));
}
+ namespaces.emplace_back(BuildRuntimeNamespace(ctx));
+
Section section("vendor", std::move(namespaces));
AddStandardSystemLinks(ctx, §ion);
return section;