lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201109211904.29572.pedro@codesourcery.com>
Date:	Wed, 21 Sep 2011 19:04:29 +0100
From:	Pedro Alves <pedro@...esourcery.com>
To:	"Linas Vepstas (Code Aurora)" <linas@...eaurora.org>
Cc:	Jonas Bonn <jonas.bonn@...il.com>,
	Richard Kuo <rkuo@...eaurora.org>, linux-arch@...r.kernel.org,
	linux-hexagon@...r.kernel.org, linux-kernel@...r.kernel.org,
	arnd@...db.de
Subject: Re: [patch v3 19/36] Hexagon: Add ptrace support

On Wednesday 21 September 2011 18:50:09, Linas Vepstas (Code Aurora) wrote:
> On Wed, Sep 21, 2011 at 05:15:20PM +0100, Pedro Alves wrote:
> > > On Sat, Sep 10, 2011 at 12:29:57PM +0100, Pedro Alves wrote:
> > > > Yes, the x86/x86-64 ports or gdb and gdbserver are already
> > > > using GET/SETREGSET even.
> 
> Thanks; after a bit of initial confusion, I've gotten gdb to
> work with this, so I'm happy. 
> 
> > I wish there was an equivalent of PTRACE_GETREGSET for siginfo...
> 
> How? Why?

One of the the cool features of PTRACE_GETREGSET is that it returns
the regset in the natural layout of the tracee.  So when debugging a 
32-bit process on a 64-bit kernel, PTRACE_GETREGSET returns the
regset in 32-bit layout.  Recent enough GDBs can print the siginfo of a
caught signal (before its delivered with (PTRACE_CONT, sig).
Try "(gdb) p $_siginfo" on x86.  Trouble is 32-bit processes on 64-bit
kernels or other biarch setups.  PTRACE_GETSIGINFO returns the siginfo in
64-bit layout, so GDB gets to try to immitate what the kernel's 32-bit
compat layer does.  Both for reading and writting siginfo.
See compat_siginfo_from_siginfo and siginfo_from_compat_siginfo
at [1].
The kernel already knows to convert siginfo to the native layout
of the process -- needed to pass to the user space signal handler
at least.  But AFAIK, there's no way for the debugger to get at it
before the signal is actually delivered.

[1]
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/amd64-linux-nat.c?rev=1.35&content-type=text/x-cvsweb-markup&cvsroot=src

-- 
Pedro Alves
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ