Subject: Re: bad kdump output with 64bit syscalls under 32bit emul
To: Nicolas Joly <njoly@pasteur.fr>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 10/31/2007 08:08:09
On Wed, Oct 31, 2007 at 02:11:18AM +0100, Nicolas Joly wrote:
> 
> 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.

I'll have a think about it later, something is iffy about the
trace_enter code.

	David

-- 
David Laight: david@l8s.co.uk