diff options
author | Jiyong Park <jiyong@google.com> | 2019-01-18 12:29:12 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-01-18 12:30:51 +0900 |
commit | 8b73dfc0a44e069e57592a50800b7ea10270ce83 (patch) | |
tree | e624db058a3485c0757ce94a7fb2b33f423836ea /init/builtins.cpp | |
parent | 80aec3f0f016933159c5a9a29214a444ca60fafa (diff) | |
download | system_core-8b73dfc0a44e069e57592a50800b7ea10270ce83.tar.gz system_core-8b73dfc0a44e069e57592a50800b7ea10270ce83.tar.bz2 system_core-8b73dfc0a44e069e57592a50800b7ea10270ce83.zip |
Revert "Bionic libs and the dynamic linker are bind mounted"
This reverts commit 2599088ff67c10c66a70d3741c41529d3e11c7f5.
Reason: Breaks some 3p apps.
Bug: 122920047
Test: run the app, login.
Change-Id: Idea332b1f91e9d2ac6ebd3879da7820c8ba2284f
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index e1a86e4f9..169edbe09 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -1098,86 +1098,6 @@ static Result<Success> do_parse_apex_configs(const BuiltinArguments& args) { } } -static Result<Success> bind_mount_file(const char* source, const char* mount_point, - bool remount_private) { - if (remount_private && mount(nullptr, mount_point, nullptr, MS_PRIVATE, nullptr) == -1) { - return ErrnoError() << "Could not change " << mount_point << " to a private mount point"; - } - if (mount(source, mount_point, nullptr, MS_BIND, nullptr) == -1) { - return ErrnoError() << "Could not bind-mount " << source << " to " << mount_point; - } - return Success(); -} - -static Result<Success> bind_mount_bionic(const char* linker_source, const char* lib_dir_source, - const char* linker_mount_point, const char* lib_mount_dir, - bool remount_private) { - if (access(linker_source, F_OK) != 0) { - return Success(); - } - if (auto result = bind_mount_file(linker_source, linker_mount_point, remount_private); - !result) { - return result; - } - for (auto libname : kBionicLibFileNames) { - std::string mount_point = lib_mount_dir + libname; - std::string source = lib_dir_source + libname; - if (auto result = bind_mount_file(source.c_str(), mount_point.c_str(), remount_private); - !result) { - return result; - } - } - return Success(); -} - -// The bootstrap bionic libs and the bootstrap linker are bind-mounted to -// the mount points for pre-apexd processes. -static Result<Success> do_prepare_bootstrap_bionic(const BuiltinArguments& args) { - static bool prepare_bootstrap_bionic_done = false; - if (prepare_bootstrap_bionic_done) { - return Error() << "prepare_bootstrap_bionic was already executed. Cannot be executed again"; - } - if (auto result = bind_mount_bionic(kBootstrapLinkerPath, kBootstrapBionicLibsDir, - kLinkerMountPoint, kBionicLibsMountPointDir, false); - !result) { - return result; - } - if (auto result = bind_mount_bionic(kBootstrapLinkerPath64, kBootstrapBionicLibsDir64, - kLinkerMountPoint64, kBionicLibsMountPointDir64, false); - !result) { - return result; - } - - LOG(INFO) << "prepare_bootstrap_bionic done"; - prepare_bootstrap_bionic_done = true; - return Success(); -} - -// The bionic libs and the dynamic linker from the runtime APEX are bind-mounted -// to the mount points. As a result, the previous mounts done by -// prepare_bootstrap_bionic become hidden. -static Result<Success> do_setup_runtime_bionic(const BuiltinArguments& args) { - static bool setup_runtime_bionic_done = false; - if (setup_runtime_bionic_done) { - return Error() << "setup_runtime_bionic was already executed. Cannot be executed again"; - } - if (auto result = bind_mount_bionic(kRuntimeLinkerPath, kRuntimeBionicLibsDir, - kLinkerMountPoint, kBionicLibsMountPointDir, true); - !result) { - return result; - } - if (auto result = bind_mount_bionic(kRuntimeLinkerPath64, kRuntimeBionicLibsDir64, - kLinkerMountPoint64, kBionicLibsMountPointDir64, true); - !result) { - return result; - } - - ServiceList::GetInstance().MarkRuntimeAvailable(); - LOG(INFO) << "setup_runtime_bionic done"; - setup_runtime_bionic_done = true; - return Success(); -} - // Builtin-function-map start const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max(); @@ -1216,7 +1136,6 @@ const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"mount_all", {1, kMax, {false, do_mount_all}}}, {"mount", {3, kMax, {false, do_mount}}}, {"parse_apex_configs", {0, 0, {false, do_parse_apex_configs}}}, - {"prepare_bootstrap_bionic",{0, 0, {false, do_prepare_bootstrap_bionic}}}, {"umount", {1, 1, {false, do_umount}}}, {"readahead", {1, 2, {true, do_readahead}}}, {"restart", {1, 1, {false, do_restart}}}, @@ -1225,7 +1144,6 @@ const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"rm", {1, 1, {true, do_rm}}}, {"rmdir", {1, 1, {true, do_rmdir}}}, {"setprop", {2, 2, {true, do_setprop}}}, - {"setup_runtime_bionic", {0, 0, {false, do_setup_runtime_bionic}}}, {"setrlimit", {3, 3, {false, do_setrlimit}}}, {"start", {1, 1, {false, do_start}}}, {"stop", {1, 1, {false, do_stop}}}, |