'syscall: unknown syscall trap' with assembler program

Valery valery at magicErmine.com
Mon Jun 16 11:40:06 UTC 2008

Ooops, sorry, I forget attach file :(

Good day,

I recently discovered following problem with strace on ARM
(QEMU, with kernel 2.6.18-5-versatile, OABI, strace both 4.5.14-2 and 4.5.16.

When I run any "normal" program under strace both statically and  
dynamically linked -
like /sbin/ldconfig, /bin/dd, etc - everything is OK.

When I run my own program written in assembler, which doesn't linked with libc
I got:
strace ./bad1
execve("./bad1", ["./bad1"], [/* 19 vars */]) = 0
syscall: unknown syscall trap 0x00008000

Attached is a tar with makefile and 4 assembler programs: 2 of them  
(good1 and good2) run
under strace and another 2 (bad1 and bad2) fail with a message above.

When I was trying to understand what is a problem I added some debug output to
the strace (4.5.16)
In the file syscall.c (line 1058)
  scno = ptrace(PTRACE_PEEKTEXT, pid, (void *)(regs.ARM_pc - 4), NULL);
I printed regs.ARM_pc and was surprised to see, that it for some reason not
address of syscall instruction but executable entry point !).

In the line 1063:
                         if (scno == 0 && (tcp->flags & TCB_WAITEXECVE)) {
                                 tcp->flags &= ~TCB_WAITEXECVE;
                                 return 0;

I.e if regs.ARM_pc - 4 points to the word with content 0, this  
"syscall" ignored
(like in case with glibc-linked programs) otherwise - it's processed.
Value in this address is implementation depended.
I was able to fix my tests (and real program too) and now I am able to  
run them
under strace.
But it's still looks like some problem with strace.
Mat be condition in line 1063 should be changed to something like
                         if ( ((scno == 0) || (regs.ARM_pc ==  
entry_point)) && (tcp->flags

My test programs are following:
good1.S - my very basic test program - run under strace
bad1.S  - slightly modified test program - failed under strace
good2.S - when I realized, that word before program's entry point should be 0
          I added it. Run under strace.
bad2.S   - Just to verify that I got it right - this word changed from  0 to 1
         and oops - as expected it's failed.


Tools for Professional Software Deployment
-------------- next part --------------
A non-text attachment was scrubbed...
Name: STRACE.tgz
Type: application/x-tar-gz
Size: 468 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20080616/45818f57/attachment.bin>

More information about the Strace-devel mailing list