summaryrefslogtreecommitdiff
path: root/init/service_utils.cpp
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2020-06-09 13:44:17 +0900
committerJooyung Han <jooyung@google.com>2020-06-11 15:10:40 +0900
commit4f23d5a236e08ed2d9413cf2681f8ed967d01deb (patch)
tree7bfcca78b214cafaf6d024269d07d0cc4a49831b /init/service_utils.cpp
parent3447cdc741214db36f47dd1138b12215a070efa6 (diff)
init: start ueventd in the default mount namespace
Init starts ueventd in the default mount namespace to support loading firmware from APEXes. Bug: 155023652 Test: devices boots adb$ nsenter -t (pid of ueventd) -m ls /apex => shows all APEXes Change-Id: Ibb8b33a07eb014752275e3bca4541b8b694dc64b
Diffstat (limited to 'init/service_utils.cpp')
-rw-r--r--init/service_utils.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/init/service_utils.cpp b/init/service_utils.cpp
index 484c2c89f..05e632b68 100644
--- a/init/service_utils.cpp
+++ b/init/service_utils.cpp
@@ -194,7 +194,8 @@ Result<Descriptor> FileDescriptor::Create() const {
return Descriptor(ANDROID_FILE_ENV_PREFIX + name, std::move(fd));
}
-Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, bool pre_apexd) {
+Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name,
+ std::optional<MountNamespace> override_mount_namespace) {
for (const auto& [nstype, path] : info.namespaces_to_enter) {
if (auto result = EnterNamespace(nstype, path.c_str()); !result.ok()) {
return result;
@@ -202,9 +203,10 @@ Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name,
}
#if defined(__ANDROID__)
- if (pre_apexd) {
- if (!SwitchToBootstrapMountNamespaceIfNeeded()) {
- return Error() << "could not enter into the bootstrap mount namespace";
+ if (override_mount_namespace.has_value()) {
+ if (auto result = SwitchToMountNamespaceIfNeeded(override_mount_namespace.value());
+ !result.ok()) {
+ return result;
}
}
#endif