Remove the dying message feature of deadlock's reason 05/251505/2 accepted/tizen/unified/20210118.141052 submit/tizen/20210115.052157
authorYoungHun Kim <yh8004.kim@samsung.com>
Thu, 14 Jan 2021 10:03:48 +0000 (19:03 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 15 Jan 2021 04:02:17 +0000 (04:02 +0000)
 - backtrace_symbols calls internally malloc of async-signal-safe
   which is reason of deadlock when crashed

Change-Id: I47ed587be71cbf291b9c8df0a15cbe8d40767a7e

server/src/muse_server_signal.c

index 1b72ad0..67e4ab5 100644 (file)
@@ -31,7 +31,6 @@ static struct sigaction ms_xcpu_old_action;
 static struct sigaction ms_pipe_old_action;
 
 static void _ms_signal_handler(int signo);
-static void _ms_signal_backtrace(void *arg);
 static void _ms_signal_sigaction(int signo, siginfo_t *si, void *arg);
 
 static void _ms_signal_handler(int signo)
@@ -63,49 +62,6 @@ static void _ms_signal_handler(int signo)
        raise(signo);
 }
 
-static void _ms_signal_backtrace(void *arg)
-{
-       void *trace[MUSE_MSG_LEN];
-       int tracesize;
-       int idx;
-       char **strings = NULL;
-       ucontext_t *uctxt = NULL;
-       Dl_info info;
-       char *sym_addr = NULL;
-
-       if (!arg)
-               return;
-
-       tracesize = backtrace(trace, MUSE_MSG_LEN);
-       if (tracesize <= 0)
-               return;
-
-       uctxt = (ucontext_t *)arg;
-
-#if defined(REG_EIP)
-       trace[1] = (void *) uctxt->uc_mcontext.gregs[REG_EIP];
-#elif defined(REG_RIP)
-       trace[1] = (void *) uctxt->uc_mcontext.gregs[REG_RIP];
-#endif
-
-       strings = backtrace_symbols(trace, tracesize);
-       if (!strings)
-               return;
-
-       /* skip the first stack frame because it just points here. */
-       for (idx = 1; idx < tracesize; idx++) {
-               sym_addr = g_strstr_len(strings[idx], strlen(strings[idx]), "[0x");
-
-               memset(&info, 0, sizeof(info));
-               if (sym_addr && dladdr((const void *)strtoul(sym_addr + 1, NULL, 16), &info) && info.dli_sname)
-                       LOGE("[%u] %s %s", idx - 1, strings[idx], info.dli_sname);
-               else
-                       LOGE("[%u] %s", idx - 1, strings[idx]);
-       }
-
-       free(strings);
-}
-
 static void _ms_signal_sigaction(int signo, siginfo_t *si, void *arg)
 {
        muse_return_if_fail(si);
@@ -114,7 +70,6 @@ static void _ms_signal_sigaction(int signo, siginfo_t *si, void *arg)
        ms_remove_ready_file();
        ms_config_remove_lockfile();
 
-       _ms_signal_backtrace(arg);
        _ms_signal_handler(signo);
 }