Subject: bad kdump output with 64bit syscalls under 32bit emul
To: NetBSD kernel <tech-kern@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: tech-kern
Date: 10/31/2007 02:11:18
Hi,

While tracing some 32bit linux process on my -current NetBSD/amd64
workstation, i noticed that kdump(1) show an incorrect number of
arguments for some syscalls.

  4190      1 exit     CALL  close(3,3)
  4190      1 exit     RET   close 0

After looking at it, i discovered that kdump(1) argument count is bad
when dealing with 64bit syscalls under 32bit emulation.

6       NOARGS  { int sys_close(int fd); }

The problem is that ktrace argsize depends on syscall args struct
size, which depends on syscallarg macro definition. this size which
should be, under compat linux32, a multiple of register32_t. But with
a 64bit syscall, it will be a multiple of register_t; leading to an
argsize two times larger than expected.

It looks like that 64bit syscalls should not be used directly under
32bit emulation in order have correct kdump output.

Unless there is a better way to fix it, that i'm currently
missing. I'll plan to fix this by replacing all native syscalls with
the netbsd32 equivalents, likewise for linux32 vs. linux calls.

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.