Disable logging during thread sync 85/317385/3
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 31 Dec 2024 10:58:40 +0000 (11:58 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 31 Dec 2024 12:35:58 +0000 (13:35 +0100)
Change-Id: I78e3154a6f5ae4697a461a0cbcce4affca2f50dd

src/client/client-security-manager.cpp
src/dpl/log/include/dpl/log/log.h
src/dpl/log/src/log.cpp

index d2f3ce26c8931b8d029d99e1ae3e8b8ea5b7392d..bba070499994e4555785778cd0b2174719e404af 100644 (file)
@@ -863,7 +863,12 @@ static inline int security_manager_sync_threads_internal(const std::string &app_
 
     g_th_barrier = 0;
 
+    auto enabled = SecurityManager::Log::LogSystemSingleton::Instance().IsLoggingEnabled();
+    if (enabled)
+        SecurityManager::Log::LogSystemSingleton::Instance().Enable(false);
+
     // No allocations allowed beyond this point
+
     signal_and_wait_for_handlers(own_pid, own_tid);
 
     // here, all TIDs except current one are waiting to start changing attributes
@@ -897,6 +902,10 @@ static inline int security_manager_sync_threads_internal(const std::string &app_
         abort();
 
     // No allocations allowed before this point
+
+    if (enabled)
+        SecurityManager::Log::LogSystemSingleton::Instance().Enable(true);
+
     g_th_barrier++; // this starts signal handlers to proceed once they wake up - logic in app starts in env where all have changed labels
 
 
index 8cb49225047dabae94bbfe6b4ef765c08dd57f15..5b0d37c0d959934bf8773f903cc1dddc0ab82323 100644 (file)
@@ -53,6 +53,7 @@ class LogSystem :
 
   public:
     bool IsLoggingEnabled() const;
+    void Enable(bool enable);
     LogSystem();
     virtual ~LogSystem();
 
index c865d77c94ccef2e268dfd1a40d91a8f00570c09..d762c80a4a9d81544bbdd20af1beb0fdb61ebd60 100644 (file)
@@ -61,6 +61,11 @@ bool LogSystem::IsLoggingEnabled() const
     return m_isLoggingEnabled;
 }
 
+void LogSystem::Enable(bool enable)
+{
+    m_isLoggingEnabled = enable;
+}
+
 LogSystem::LogSystem() :
     m_isLoggingEnabled(!getenv(SECURITY_MANAGER_LOG_OFF)),
     m_tagSet(false)