Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 23 Mar 2013 02:31:17 +0400
From: "Dmitry V. Levin" <ldv@...linux.org>
To: owl-dev@...ts.openwall.com
Subject: Re: strace

On Wed, Mar 20, 2013 at 10:42:22PM +0100, Pavel Kankovsky wrote:
> On Fri, 15 Mar 2013, Dmitry V. Levin wrote:
> 
> >strace started to use "struct pt_regs" from asm/ptrace.h with commit
> >v4.6-124-geb0e3e8 that introduced PTRACE_GETREGS on x86.
> >
> >Recently (commit v4.7-82-g2550d48) strace was changed on x86* to stop
> >including asm/ptrace.h and use "struct user_regs_struct" instead.
> 
> *slaps himself* It's obvious, isn't it?

Yes, thanks to your analysis, now it is.

> Strace in Owl-current is 4.7 and it calls PTRACE_GETREGS with struct 
> pt_regs. This means it is broken when compiled against older kernel 
> headers where pt_regs is different from user_regs_struct, namely
> 2.6.18-based kernel in Owl.

Who could suppose at the time of adding PTRACE_GETREGS support that the
structure returned by PTRACE_GETREGS on 2.6.18-based i386 kernel is not
"struct pt_regs" from kernel's <asm/ptrace.h> but
"struct user_regs_struct" from libc's <sys/user.h>?

The morale is simple: avoid using "struct pt_regs" on i386, it may bite
when you expect it less.


-- 
ldv

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ