public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] Syscall tracing bug
@ 2002-09-26 19:19 Andreas Schwab
  2002-09-26 19:41 ` David Mosberger
  2002-09-26 20:09 ` Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2002-09-26 19:19 UTC (permalink / raw)
  To: linux-ia64

There is some problem with tracing syscall(2) in strace.  It sees the
actual syscall, but the arguments are shifted, with the first arg being
the syscall number.  For example:

$ cat syscall.c
#include <unistd.h>
#include <sys/syscall.h>

int
main ()
{
  write (1, "Hello World\n", 12);
  syscall (SYS_write, 1, "Hello World\n", 12);
  return 0;
}
$ stace ./syscall
execve("./syscall", ["./syscall"], [/* 91 vars */]) = 0
uname({sys="Linux", node="sykes", ...}) = 0
brk(0)                                  = 0x6000000000000b30
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 5
fstat(5, {st_mode=S_IFREG|0644, st_size„982, ...}) = 0
mmap(NULL, 84982, PROT_READ, MAP_PRIVATE, 5, 0) = 0x2000000000040000
close(5)                                = 0
open("/lib/libc.so.6.1", O_RDONLY)      = 5
read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0002\0\1\0\0\0\240@\3"..., 1024) = 1024
fstat(5, {st_mode=S_IFREG|0755, st_size#50193, ...}) = 0
mmap(NULL, 2260816, PROT_READ|PROT_EXEC, MAP_PRIVATE, 5, 0) = 0x2000000000058000
mprotect(0x2000000000260000, 130896, PROT_NONE) = 0
mmap(0x2000000000268000, 81920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 5, 0x200000) = 0x2000000000268000
mmap(0x200000000027c000, 16208, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x200000000027c000
close(5)                                = 0
mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2000000000028000
munmap(0x2000000000040000, 84982)       = 0
write(1, "Hello World\n", 12Hello World
)           = 12
write(1027, ptrace: umoven: Input/output error
0x1, 4611686018427389952Hello World
)   = 12
exit(0)                                 = ?

Is this a bug in strace or in the kernel (maybe <asm/rse.h>)?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-ia64] Syscall tracing bug
  2002-09-26 19:19 [Linux-ia64] Syscall tracing bug Andreas Schwab
@ 2002-09-26 19:41 ` David Mosberger
  2002-09-26 20:09 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: David Mosberger @ 2002-09-26 19:41 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Thu, 26 Sep 2002 21:19:31 +0200, Andreas Schwab <schwab@suse.de> said:

  Andreas> Is this a bug in strace or in the kernel (maybe
  Andreas> <asm/rse.h>)?

It's a bug in the strace you're using.  This was fixed a long time ago
in the CVS tree of strace.  I haven't updated my tree since Oct 2001,
but it has the right code: around line 1279 in syscall.c, it should
say something like this:

			sof = (cfm >> 0) & 0x7f;
			sol = (cfm >> 7) & 0x7f;
			out0 = ia64_rse_skip_regs(rbs_end, -sof + sol);

	--david


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-ia64] Syscall tracing bug
  2002-09-26 19:19 [Linux-ia64] Syscall tracing bug Andreas Schwab
  2002-09-26 19:41 ` David Mosberger
@ 2002-09-26 20:09 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2002-09-26 20:09 UTC (permalink / raw)
  To: linux-ia64

David Mosberger <davidm@napali.hpl.hp.com> writes:

|> >>>>> On Thu, 26 Sep 2002 21:19:31 +0200, Andreas Schwab <schwab@suse.de> said:
|> 
|>   Andreas> Is this a bug in strace or in the kernel (maybe
|>   Andreas> <asm/rse.h>)?
|> 
|> It's a bug in the strace you're using.  This was fixed a long time ago
|> in the CVS tree of strace.  I haven't updated my tree since Oct 2001,
|> but it has the right code: around line 1279 in syscall.c, it should
|> say something like this:
|> 
|> 			sof = (cfm >> 0) & 0x7f;
|> 			sol = (cfm >> 7) & 0x7f;
|> 			out0 = ia64_rse_skip_regs(rbs_end, -sof + sol);

Thanks, it works now.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-26 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-26 19:19 [Linux-ia64] Syscall tracing bug Andreas Schwab
2002-09-26 19:41 ` David Mosberger
2002-09-26 20:09 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox