[PATCH] display mask on enter to sigreturn, not exit
Dmitry V. Levin
ldv at altlinux.org
Tue Jan 17 21:46:00 UTC 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120118/eff7ab53/attachment.bin>
More information about the Strace-devel
mailing list