Do not close all file descriptors 60/297960/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 29 Aug 2023 06:53:57 +0000 (15:53 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Wed, 30 Aug 2023 06:35:58 +0000 (06:35 +0000)
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 <h.jhun@samsung.com>
src/app-defined-loader/app-defined-loader.cc
src/launchpad-loader/launchpad_loader.cc

index 57e7ffd53e89cb3ee9c5967404e7478ac6fc4462..a135dc7c2afae4fff76ea49fb2e054fed62c00fd 100644 (file)
@@ -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");
index cc62aa16b48aa1319dbe7e359eefc76242d1e7f5..83cb8e36ae5047a29fc5e865dd197e80e12e452c 100644 (file)
@@ -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);