On Tue, Jan 17, 2012 at 08:59:46PM +0100, Denys Vlasenko wrote: > On 01/17/2012 08:43 PM, Dmitry V. Levin wrote: > > On Tue, Jan 17, 2012 at 08:01:00PM +0100, Denys Vlasenko wrote: > >> On 01/17/2012 07:53 PM, Dmitry V. Levin wrote: > > [...] > >>> [X86_64] (x86_64_regs): Remove. > >>> * syscall.c [X86_64] (x86_64_regs): Make static. > >> > >> I think we will eventually need register structs to be accessible > >> from all files. That's why I made x86_64_regs global too, > >> even though it does not have to be global (so far). > >> > >> I would like to ask for it to remain global. > > > > I'd probably agree, but the most astonishing thing is that global > > x86_64_regs doesn't work for me at all: > > > > $ ./strace /bin/true > > Segmentation fault > > Mysterious...
There is no mystic, just a commonplace data corruption. On x86-64, sizeof(struct user_regs_struct) == 27 * sizeof(long), but sizeof(struct pt_regs) == 21 * sizeof(long). strace passes x86_64_regs of type "struct pt_regs" to PTRACE_GETREGS, which expects a pointer to "struct user_regs_struct", and happily overwrites 6 extra long words. It could crash much earlier than now. We probably had to use user_regs_struct instead of pt_regs. -- ldv
pgp4rh66fOylC.pgp
Description: PGP signature
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
