Files
ubports_kernel_google_msm/include/linux
Hui Zhu a65e7bfcd7 elf: fix multithreaded program core dumping on arm
Fix the multithread program core thread message error.

This issue affects arches with neither has CORE_DUMP_USE_REGSET nor
ELF_CORE_COPY_TASK_REGS, ARM is one of them.

The thread message of core file is generated in elf_dump_thread_status.
The register values is set by elf_core_copy_task_regs in this function.

If an arch doesn't define ELF_CORE_COPY_TASK_REGS,
elf_core_copy_task_regs() will do nothing.  Then the core file will not
have the register message of thread.

So add elf_core_copy_regs to set regiser values if ELF_CORE_COPY_TASK_REGS
doesn't define.

The following is how to reproduce this issue:

cat 1.c
#include <stdio.h>
#include <pthread.h>
#include <assert.h>

void td1(void * i)
{
       while (1)
       {
               printf ("1\n");
               sleep (1);
       }

       return;
}

void td2(void * i)
{
       while (1)
       {
               printf ("2\n");
               sleep (1);
       }

       return;
}

int
main(int argc,char *argv[],char *envp[])
{
       pthread_t       t1,t2;

       pthread_create(&t1, NULL, (void*)td1, NULL);
       pthread_create(&t2, NULL, (void*)td2, NULL);

       sleep (10);

       assert(0);

       return (0);
}
arm-xxx-gcc -g -lpthread 1.c -o 1
copy 1.c and 1 to a arm board.
Goto this board.
ulimit -c 1800000
./1
# ./1
1
2
1
...
...
1
1: 1.c:37: main: Assertion `0' failed.
Aborted (core dumped)
Then you can get a core file.
gdb 1 core.xxx
Without the patch:
(gdb) info threads
 3 process 909  0x00000000 in ?? ()
 2 process 908  0x00000000 in ?? ()
* 1 process 907  0x4a6e2238 in raise () from /lib/libc.so.6
You can found that the pc of 909 and 908 is 0x00000000.
With the patch:
(gdb) info threads
 3 process 885  0x4a749974 in nanosleep () from /lib/libc.so.6
 2 process 884  0x4a749974 in nanosleep () from /lib/libc.so.6
* 1 process 883  0x4a6e2238 in raise () from /lib/libc.so.6
The pc of 885 and 884 is right.

Signed-off-by: Hui Zhu <teawater@gmail.com>
Cc: Amerigo Wang <xiyou.wangcong@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-06 13:57:03 -07:00
..
2009-06-17 19:41:52 +02:00
2009-06-22 16:56:22 -07:00
2009-06-18 08:46:47 +10:00
2009-06-30 18:56:00 -07:00
2009-06-17 00:36:36 -04:00
2009-06-30 18:55:58 -07:00
2009-04-01 08:59:23 -07:00
2009-06-01 06:21:13 +00:00
2009-05-02 15:36:10 -07:00
2009-04-23 10:06:35 +01:00
2009-06-11 21:36:09 -04:00
2009-06-22 10:12:35 +01:00
2009-05-29 08:40:01 -07:00
2009-06-11 08:50:57 -07:00
2009-06-11 21:36:06 -04:00
2009-06-15 21:30:25 -07:00
2009-06-22 10:12:30 +01:00
2009-06-22 10:12:35 +01:00
2009-05-18 14:46:26 +01:00
2009-04-03 14:53:32 -07:00
2009-06-17 09:33:49 -07:00
2009-06-24 08:17:04 -04:00
2009-06-30 18:56:00 -07:00
2009-06-15 21:30:25 -07:00
2009-06-24 08:15:27 -04:00
2009-06-18 18:40:18 -04:00
2009-06-30 20:12:24 +02:00
2009-06-18 13:04:05 -07:00
2009-04-02 19:04:53 -07:00
2009-06-03 14:05:10 -04:00
2009-05-19 16:02:02 -07:00
2009-06-29 08:59:10 +10:00
2009-06-02 00:45:24 -07:00
2009-06-18 13:03:57 -07:00
2009-05-18 14:46:26 +01:00
2009-06-18 13:03:56 -07:00
2009-04-21 13:41:48 -07:00
2009-04-21 13:41:48 -07:00
2009-06-22 10:12:35 +01:00
2009-06-15 15:49:23 +02:00
2009-06-11 17:03:28 +01:00
2009-06-10 11:48:39 +03:00
2009-04-06 16:06:26 +01:00
2009-06-23 20:21:39 +01:00
2009-06-16 19:47:57 -07:00
2009-04-28 07:37:28 +02:00
2009-04-14 09:00:19 +10:00
2009-06-16 19:47:48 -07:00
2009-06-16 08:40:20 +02:00
2009-04-29 17:32:35 -07:00
2009-06-11 19:05:32 +02:00
2009-05-25 00:55:45 -07:00
2009-06-16 19:50:13 -07:00
2009-06-25 11:22:13 -07:00
2009-06-18 13:03:57 -07:00
2009-06-11 21:36:02 -04:00
2009-06-11 21:36:01 -04:00
2009-06-17 18:02:11 -07:00
2009-06-17 18:02:11 -07:00
2009-06-17 12:24:34 -07:00
2009-06-17 12:24:34 -07:00
2009-06-17 18:02:11 -07:00
2009-06-15 21:44:43 -07:00
2009-04-01 08:59:13 -07:00
2009-04-01 08:59:13 -07:00
2009-06-30 18:55:59 -07:00
2009-04-24 08:54:21 +02:00
2009-04-01 08:59:13 -07:00
2009-06-18 13:04:04 -07:00
2009-06-18 13:04:04 -07:00
2009-06-11 21:36:12 -04:00
2009-06-24 08:17:06 -04:00
2009-05-09 10:49:41 -04:00
2009-04-01 08:59:24 -07:00
2009-06-30 18:55:59 -07:00
2009-04-08 14:33:38 -07:00
2009-06-11 08:50:58 -07:00
2009-06-24 08:17:06 -04:00
2009-04-13 15:04:29 -07:00
2009-06-15 15:50:49 +02:00
2009-04-21 19:40:00 -07:00
2009-06-16 19:47:48 -07:00
2009-04-27 02:45:02 -07:00
2009-05-12 11:11:48 +02:00
2009-06-23 12:50:05 -07:00
2009-04-02 19:05:01 -07:00
2009-06-11 08:50:59 -07:00
2009-06-11 08:51:01 -07:00