Enhance few logs around application launching. 42/220442/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Wed, 18 Dec 2019 07:19:32 +0000 (08:19 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Wed, 18 Dec 2019 07:20:50 +0000 (08:20 +0100)
It was reported that some checks during our launching could be more verbose
and informative about what is going on. Added few more sentences to clearly
state if application process is improperly setup and why.

Change-Id: I47d6578dceff957cf76aa8ee690420d5a5cc9d7f

src/client/check-proper-drop.cpp
src/client/client-security-manager.cpp

index bc9ac81..ccb0b68 100644 (file)
@@ -66,8 +66,10 @@ void CheckProperDrop::getThreads()
 bool CheckProperDrop::checkThreads()
 {
 #define REPORT_THREAD_ERROR(TID, NAME, VAL1, VAL2) {                           \
-    LogError("Invalid value of " << (NAME) << " for thread " << (TID) << "."   \
-        << ". Process has " << (VAL1) << ", thread has " << (VAL2) << ".");    \
+    LogError("Invalid value of " << (NAME) << " for thread " << (TID) << ". "  \
+        << "Process has " << (VAL1) << ", thread has " << (VAL2) << ". "       \
+        << "Application candidate process not prepared properly for launch. "  \
+        << (NAME) <<  " values should be same for all threads.");              \
     return false;                                                              \
 }
 
index ba026c9..24ab61b 100644 (file)
@@ -853,7 +853,8 @@ int security_manager_prepare_app_candidate(void)
 
         FS::FileNameVector files = FS::getSubDirectoriesFromDirectory("/proc/self/task");
         if (files.size() > 3) { // 3 because we have ., we have .. and we should have only one thread here
-            LogError("Too many threads in current process, can't switch to new namespace safely in multithreaded program");
+            LogError("Too many threads in current process, can't switch to new namespace safely in multithreaded program. "\
+                     "Abort launching the application, as it may have too high privileges and pose risk to the system.");
             return SECURITY_MANAGER_ERROR_INPUT_PARAM;
         }
         return MountNS::createMountNamespace();