crash-manager: Fix TID finding 90/257690/2
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Thu, 29 Apr 2021 10:57:55 +0000 (12:57 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 30 Apr 2021 12:30:23 +0000 (14:30 +0200)
To find a thread ID that crashed crash-worker checked if
/proc/<pid>/tasks/<pid>/wchan contains pipe_wait or do_coredump.
Additionally it should check if pipe_write is there, because since
kernel 5.10 this content is for the thread that crashed.

Change-Id: Ic45913306d4f5b39ae704abdd58bbd79fef5e7cd

src/shared/util.c

index 4c04626..778f0ad 100644 (file)
@@ -473,10 +473,12 @@ static int check_thread_wchan(int pid, int tid)
        buf[cnt] = 0;
        close(fd);
 
-       if (strncmp("do_coredump", buf, sizeof(buf)) == 0 || strncmp("pipe_wait", buf, sizeof(buf)) == 0)
+       if (strncmp("do_coredump", buf, sizeof(buf)) == 0 ||
+           strncmp("pipe_wait", buf, sizeof(buf)) == 0 ||
+           strncmp("pipe_write", buf, sizeof(buf)) == 0)
                return tid;
        else
-               return 0;
+               return -1;
 }
 
 /**