From 774e3f3d04db8aa4c4a9e2f6536cdbf30f2f03a9 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 29 Aug 2023 15:53:57 +0900 Subject: [PATCH] Do not close all file descriptors When the loader fails to find the main function, it tries to execute an application using execv(). Before calling execv(), the loader closes all opened file descriptors. Unfortunately, the loader can have crashed by that. To avoid crash issues, this patch removes calling CloseAllFds(). Change-Id: I902d2f73ae30dc63e4d82599da6c1ced436e3920 Signed-off-by: Hwankyu Jhun --- src/app-defined-loader/app-defined-loader.cc | 1 - src/launchpad-loader/launchpad_loader.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/src/app-defined-loader/app-defined-loader.cc b/src/app-defined-loader/app-defined-loader.cc index 57e7ffd..a135dc7 100644 --- a/src/app-defined-loader/app-defined-loader.cc +++ b/src/app-defined-loader/app-defined-loader.cc @@ -183,7 +183,6 @@ class AppDefinedLoader { argv_[0], errno, strerror_r(errno, err_str, sizeof(err_str))); } else { SECURE_LOGD("[candidate] Exec application (%s)", argv_[0]); - launchpad::Util::CloseAllFds(); if (!libdir.empty()) setenv("LD_LIBRARY_PATH", libdir.c_str(), 1); unsetenv("AUL_LOADER_INIT"); diff --git a/src/launchpad-loader/launchpad_loader.cc b/src/launchpad-loader/launchpad_loader.cc index cc62aa1..83cb8e3 100644 --- a/src/launchpad-loader/launchpad_loader.cc +++ b/src/launchpad-loader/launchpad_loader.cc @@ -265,7 +265,6 @@ int LaunchpadLoader::DoExec(int argc, char** argv, const std::string& lib_dir) { SECURE_LOGE("access() is failed. path(%s), errno(%d)", argv[0], errno); SECURE_LOGD("Execute application. path(%s)", argv[0]); - Util::CloseAllFds(); if (!lib_dir.empty()) setenv("LD_LIBRARY_PATH", lib_dir.c_str(), 1); -- 2.7.4