summaryrefslogtreecommitdiffstats
path: root/init/service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init/service.cpp')
-rw-r--r--init/service.cpp76
1 files changed, 0 insertions, 76 deletions
diff --git a/init/service.cpp b/init/service.cpp
index c25628e15..638dc5a07 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -140,43 +140,6 @@ Result<Success> Service::SetUpMountNamespace() const {
return Success();
}
-Result<Success> Service::SetUpPreApexdMounts() const {
- // If a pre-apexd service is 're' launched after the runtime APEX is
- // available, unmount the linker and bionic libs which are currently
- // bind mounted to the files in the runtime APEX. This will reveal
- // the hidden mount points (targetting the bootstrap ones in the
- // system partition) which were setup before the runtime APEX was
- // started. Note that these unmounts are done in a separate mount namespace
- // for the process. It does not affect other processes including the init.
- if (pre_apexd_ && ServiceList::GetInstance().IsRuntimeAvailable()) {
- if (access(kLinkerMountPoint, F_OK) == 0) {
- if (umount(kLinkerMountPoint) == -1) {
- return ErrnoError() << "Could not umount " << kLinkerMountPoint;
- }
- for (const auto& libname : kBionicLibFileNames) {
- std::string mount_point = kBionicLibsMountPointDir + libname;
- if (umount(mount_point.c_str()) == -1) {
- return ErrnoError() << "Could not umount " << mount_point;
- }
- }
- }
-
- if (access(kLinkerMountPoint64, F_OK) == 0) {
- if (umount(kLinkerMountPoint64) == -1) {
- return ErrnoError() << "Could not umount " << kLinkerMountPoint64;
- }
- for (const auto& libname : kBionicLibFileNames) {
- std::string mount_point = kBionicLibsMountPointDir64 + libname;
- std::string source = kBootstrapBionicLibsDir64 + libname;
- if (umount(mount_point.c_str()) == -1) {
- return ErrnoError() << "Could not umount " << mount_point;
- }
- }
- }
- }
- return Success();
-}
-
Result<Success> Service::SetUpPidNamespace() const {
if (prctl(PR_SET_NAME, name_.c_str()) == -1) {
return ErrnoError() << "Could not set name";
@@ -966,14 +929,6 @@ Result<Success> Service::Start() {
scon = *result;
}
- if (!ServiceList::GetInstance().IsRuntimeAvailable() && !pre_apexd_) {
- // If this service is started before the runtime APEX gets available,
- // mark it as pre-apexd one. Note that this marking is permanent. So
- // for example, if the service is re-launched (e.g., due to crash),
- // it is still recognized as pre-apexd... for consistency.
- pre_apexd_ = true;
- }
-
LOG(INFO) << "starting service '" << name_ << "'...";
pid_t pid = -1;
@@ -990,26 +945,6 @@ Result<Success> Service::Start() {
LOG(FATAL) << "Service '" << name_ << "' could not enter namespaces: " << result.error();
}
- if (pre_apexd_) {
- // pre-apexd process gets a private copy of the mount namespace.
- // However, this does not mean that mount/unmount events are not
- // shared across pre-apexd processes and post-apexd processes.
- // *Most* of the events are still shared because the propagation
- // type of / is set to 'shared'. (see `mount rootfs rootfs /shared
- // rec` in init.rc)
- //
- // This unsharing is required to not propagate the mount events
- // under /system/lib/{libc|libdl|libm}.so and /system/bin/linker(64)
- // whose propagation type is set to private. With this,
- // bind-mounting the bionic libs and the dynamic linker from the
- // runtime APEX to the mount points does not affect pre-apexd
- // processes which should use the bootstrap ones.
- if (unshare(CLONE_NEWNS) != 0) {
- LOG(FATAL) << "Creating a new mount namespace for service"
- << " '" << name_ << "' failed: " << strerror(errno);
- }
- }
-
if (namespace_flags_ & CLONE_NEWNS) {
if (auto result = SetUpMountNamespace(); !result) {
LOG(FATAL) << "Service '" << name_
@@ -1017,13 +952,6 @@ Result<Success> Service::Start() {
}
}
- if (pre_apexd_ && ServiceList::GetInstance().IsRuntimeAvailable()) {
- if (auto result = SetUpPreApexdMounts(); !result) {
- LOG(FATAL) << "Pre-apexd service '" << name_
- << "' could not setup the mount points: " << result.error();
- }
- }
-
if (namespace_flags_ & CLONE_NEWPID) {
// This will fork again to run an init process inside the PID
// namespace.
@@ -1396,10 +1324,6 @@ void ServiceList::MarkServicesUpdate() {
delayed_service_names_.clear();
}
-void ServiceList::MarkRuntimeAvailable() {
- runtime_available_ = true;
-}
-
void ServiceList::DelayService(const Service& service) {
if (services_update_finished_) {
LOG(ERROR) << "Cannot delay the start of service '" << service.name()