Hi Waldemar,

On 16/05/16 19:54, Waldemar Brodkorb wrote:
I compile and test the thread test app from here on
Qemu coldfire emulation:
http://debug.openadk.org/arm-pthreads/hello.c

Sometimes it works, sometimes I get SIGILL.

Here is the strace output when I get SIGILL:
~ # strace -f /test
ioctl(0, TCGETS, {B115200 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
getpid()                                = 115
rt_sigaction(SIGRTMIN, {0x46c6184e, [], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x46c617ba, [RTMIN], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_2, {0x46c613be, [], 0}, NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x46c76000
write(1, "x: 0, y: 0\n", 11x: 0, y: 0)            = 11
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x46aec000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x46aee000
pipe([3, 4])                            = 0
clone(child_stack=0x46aedfe0, 
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 116
write(4, "F\3069\340\0\0\0\5F\307\7\fF\307\t\\F\307^\230F\306L\224F\307^\210", 
28) = 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(4, "F\307\5 \0\0\0\0\0\0\0\0F\306\1\214F\307^\304\200\0\0\0\0\0\0\0", 28) 
= 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([], 8strace: Process 116 attached <unfinished ...>
[pid   116] rt_sigprocmask(SIG_SETMASK, ~[TRAP RT_1], NULL, 8) = 0
[pid   116] read(3, 
"F\3069\340\0\0\0\5F\307\7\fF\307\t\\F\307^\230F\306L\224F\307^\210", 28) = 28
[pid   116] poll([{fd=3, events=POLLIN}], 1, 2000) = 1 ([{fd=3, 
revents=POLLIN}])
[pid   116] getppid()                   = 115
[pid   116] read(3, "F\307\5 
\0\0\0\0\0\0\0\0F\306\1\214F\307^\304\200\0\0\0\0\0\0\0", 28) = 28
[pid   116] mmap2(NULL, 20480, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x47f60000
[pid   116] clone(child_stack=0x47f63ea0, 
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGRT_1) = 117
[pid   116] kill(115, SIGRTMIN <unfinished ...>
[pid   115] <... rt_sigsuspend resumed> ) = ? ERESTARTNOHAND (To be restarted 
if no handler)
[pid   115] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_USER, si_pid=116, 
si_uid=0} ---
[pid   115] sigreturn({mask=[RTMIN]})   = -1 EINTR (Interrupted system call)
[pid   115] write(1, "y increment finished\n", 21y increment finished) = 21
[pid   115] rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
[pid   115] rt_sigsuspend([], 8strace: Process 117 attached <unfinished ...>
[pid   117] getpid()                    = 117
[pid   117] rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
[pid   117] write(1, "x increment finished\n", 21x increment finished) = 21
[pid   117] kill(115, SIGRTMIN <unfinished ...>
[pid   115] <... rt_sigsuspend resumed> ) = ? ERESTARTNOHAND (To be restarted 
if no handler)
[pid   115] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_USER, si_pid=117, 
si_uid=0} ---
[pid   115] sigreturn({mask=[RTMIN]})   = -1 EINTR (Interrupted system call)
[pid   115] --- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPC, 
si_addr=0x46c6b220} ---
[pid   115] +++ killed by SIGILL +++
[pid   117] +++ killed by SIGILL +++
+++ killed by SIGILL +++
ILL

And here when it works:
~ # strace -f /test
ioctl(0, TCGETS, {B115200 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
getpid()                                = 111
rt_sigaction(SIGRTMIN, {0x46c6184e, [], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x46c617ba, [RTMIN], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_2, {0x46c613be, [], 0}, NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x46c76000
write(1, "x: 0, y: 0\n", 11x: 0, y: 0)            = 11
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x47f68000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x47f6a000
pipe([3, 4])                            = 0
clone(child_stack=0x47f69fe0, 
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 112
write(4, "F\3069\340\0\0\0\5F\307\7\fF\307\t\\F\307^\230F\306L\224F\307^\210", 
28) = 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(4, "F\307\5 \0\0\0\0\0\0\0\0F\306\1\214F\307^\304\200\0\0\0\0\0\0\0", 28) 
= 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([], 8strace: Process 112 attached <unfinished ...>
[pid   112] rt_sigprocmask(SIG_SETMASK, ~[TRAP RT_1], NULL, 8) = 0
[pid   112] read(3, 
"F\3069\340\0\0\0\5F\307\7\fF\307\t\\F\307^\230F\306L\224F\307^\210", 28) = 28
[pid   112] poll([{fd=3, events=POLLIN}], 1, 2000) = 1 ([{fd=3, 
revents=POLLIN}])
[pid   112] getppid()                   = 111
[pid   112] read(3, "F\307\5 
\0\0\0\0\0\0\0\0F\306\1\214F\307^\304\200\0\0\0\0\0\0\0", 28) = 28
[pid   112] mmap2(NULL, 20480, PROT_READ|PROT_WRITE, 
MAP_SHARED|MAP_ANONYMOUS|MAP_UNINITIALIZED, 0, 0) = 0x47f60000
[pid   112] clone(child_stack=0x47f63ea0, 
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGRT_1) = 113
strace: Process 113 attached
[pid   113] getpid()                    = 113
[pid   113] rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
[pid   113] write(1, "x increment finished\n", 21x increment finished) = 21
[pid   113] exit_group(0)               = ?
[pid   113] +++ exited with 0 +++
[pid   112] kill(111, SIGRTMIN <unfinished ...>
[pid   111] <... rt_sigsuspend resumed> ) = ? ERESTARTNOHAND (To be restarted 
if no handler)
[pid   111] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_USER, si_pid=112, 
si_uid=0} ---
[pid   111] sigreturn({mask=[RTMIN]})   = -1 EINTR (Interrupted system call)
[pid   111] write(1, "y increment finished\n", 21y increment finished) = 21
[pid   111] write(4, "F\307\5 \0\0\0\1\0\0\4\2F\307_ 
F\306oXF\307\0074\0\0\0\0", 28) = 28
[pid   111] write(1, "x: 100, y: 100\n", 15x: 100, y: 100) = 15
[pid   111] write(4, "F\307\5 \0\0\0\2\0\0\0\0F\307_ 
\0\0\0\17F\306oXF\307\0074", 28) = 28
[pid   112] <... kill resumed> )        = 0
[pid   112] --- SIGRT_1 {si_signo=SIGRT_1, si_code=0x1, si_pid=113, si_uid=0} 
---
[pid   112] sigreturn({mask=~[TRAP KILL STOP RT_1]}) = 0
[pid   112] poll([{fd=3, events=POLLIN}], 1, 2000) = 1 ([{fd=3, 
revents=POLLIN}])
[pid   112] getppid()                   = 111
[pid   112] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 
WNOHANG|__WCLONE, NULL) = 113
[pid   112] wait4(-1, 0x47f69f74, WNOHANG|__WCLONE, NULL) = -1 ECHILD (No child 
processes)
[pid   112] read(3, "F\307\5 \0\0\0\1\0\0\4\2F\307_ F\306oXF\307\0074\0\0\0\0", 
28) = 28
[pid   112] poll([{fd=3, events=POLLIN}], 1, 2000 <unfinished ...>
[pid   111] rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
[pid   111] rt_sigsuspend([], 8 <unfinished ...>
[pid   112] <... poll resumed> )        = 1 ([{fd=3, revents=POLLIN}])
[pid   112] getppid()                   = 111
[pid   112] read(3, "F\307\5 \0\0\0\2\0\0\0\0F\307_ 
\0\0\0\17F\306oXF\307\0074", 28) = 28
[pid   112] kill(111, SIGRTMIN <unfinished ...>
[pid   111] <... rt_sigsuspend resumed> ) = ? ERESTARTNOHAND (To be restarted 
if no handler)
[pid   111] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_USER, si_pid=112, 
si_uid=0} ---
[pid   111] sigreturn({mask=[RTMIN]})   = -1 EINTR (Interrupted system call)
[pid   111] wait4(112,  <unfinished ...>
[pid   112] <... kill resumed> )        = 0
[pid   112] exit_group(0)               = ?
[pid   112] +++ exited with 0 +++
<... wait4 resumed> NULL, __WCLONE, NULL) = 112
exit_group(0)                           = ?
+++ exited with 0 +++
~ #

Tested with buildroot and qemu_m68k_mcf5208_defconfig. It uses gcc
4.9.3 and binutils 2.25.1. The kernel is 4.5.3 including the signal
handler patch. uClibc-ng 1.0.14 is used.

Any idea?

Do you get the SIGILL when running without strace?
How often does it work, and not work?

I have a setup with a gcc-5.3/binutils-2.25.1 toolchain building
linux-4.6 and using uClibc-ng-1.0.14 and using your hello.c test
app and I don't see any SIGILLs. Ran it quite a few times but
didn't see any.

This is what it gives:

/> strace hello
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
write(1, "x: 0, y: 0\n", 11x: 0, y: 0
)            = 11
getpid()                                = 83
rt_sigaction(SIGRTMIN, {0x41461988, [], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x41461af2, [RTMIN], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_2, {0x41461628, [], 0}, NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0
mmap2(NULL, 324, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0x4144afae) = 0x4142c000 mmap2(NULL, 8164, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0x4144afae) = 0x4142e000
pipe([3, 4])                            = 0
clone(child_stack=0x4142ffe0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 84 write(4, "\0\0\0\0\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 28) = 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(4, "ACK`\0\0\0\0\0\0\0\0AF\0\200AC\237<\200\0\0\0\0\0\0\0", 28x increment finished
) = 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([])                       = ? ERESTARTNOHAND (To be restarted)
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
sigreturn()                             = ? (mask now [ABRT])
write(1, "y increment finished\n", 21y increment finished
)  = 21
write(4, "ACK`\0\0\0\1\0\0\4\2AFZ\252ACM(AGR'AC\237,", 28) = 28
write(1, "x: 100, y: 100\n", 15x: 100, y: 100
)        = 15
write(4, "ACK`\0\0\0\2\0\0\0\0AC\0 \0\0\0\17AF\203,ACMP", 28) = 28
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([])                       = ? ERESTARTNOHAND (To be restarted)
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
sigreturn()                             = ? (mask now [ABRT])
wait4(84, NULL, __WCLONE, NULL)         = 84
munmap(0x4142c000, 324)                 = 0
exit_group(0)                           = ?

Regards
Greg
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to