Revert "Change the signal used by security-manager prepare_app implementation"
authorTomasz Swierczek <t.swierczek@samsung.com>
Tue, 11 Jul 2023 17:14:07 +0000 (19:14 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Tue, 11 Jul 2023 17:14:35 +0000 (19:14 +0200)
This reverts commit 4e26238c9e62a442042145a42207c8b669bf939d.

TCT tests seem to fail when signal is changed to SIGRTMIN+2
from SIGSETXID used previously.

Change-Id: Ib7df235addc30d6fb4b5d503a6f43d012218b55d

src/client/client-security-manager.cpp

index 694ba38..2f78590 100644 (file)
@@ -111,10 +111,8 @@ static int g_all_tid_num;
 
 #define MAX_SIG_WAIT_TIME   5000 // times 2 ms thats 10 seconds
 
-// Hackish, but decided NOT to use signal SIGSETXID used by glibc
-// as this was proven to cause interference with app candidate
-// processes using glibc at the time of security-manager operation
-#define SIGNAL_NUM           (__SIGRTMIN + 2)
+// Hackish, based on glibc's definition in sysdeps/unix/sysv/linux/nptl-signals.h
+#define SIGSETXID           (__SIGRTMIN + 1)
 
 SECURITY_MANAGER_API
 const char *security_manager_strerror(enum lib_retcode rc)
@@ -678,7 +676,7 @@ static inline int security_manager_sync_threads_internal(const std::string &app_
             g_threads_count--;
         };
 
-        if (Syscall::sigaction(SIGNAL_NUM, &act, &old) < 0) {
+        if (Syscall::sigaction(SIGSETXID, &act, &old) < 0) {
             LogError("Error in sigaction()");
             return SECURITY_MANAGER_ERROR_UNKNOWN;
         }
@@ -695,7 +693,7 @@ static inline int security_manager_sync_threads_internal(const std::string &app_
             synced_tids.push_back(tid); // this will not add current TID (but its already added)
             g_tid_status[tid_index++].tid = tid;
 
-            if (Syscall::tgkill(cur_pid, tid, SIGNAL_NUM) < 0) {
+            if (Syscall::tgkill(cur_pid, tid, SIGSETXID) < 0) {
                 const auto err = errno;
                 if (ESRCH == err) { // thread already gone
                     threads_gone++;
@@ -720,7 +718,7 @@ static inline int security_manager_sync_threads_internal(const std::string &app_
             }
         }
 
-        Syscall::sigaction(SIGNAL_NUM, &old, nullptr);
+        Syscall::sigaction(SIGSETXID, &old, nullptr);
 
         if (g_threads_count) {
             LogError("Not all threads synchronized: threads left: " << g_threads_count);