From: Oleg Nesterov <oleg@redhat.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Andrey Wagin <avagin@gmail.com>,
Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Andi Kleen <andi@firstfloor.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Al Viro <viro@zeniv.linux.org.uk>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Borislav Petkov <bp@alien8.de>,
Andy Lutomirski <luto@amacapital.net>,
Pavel Emelyanov <xemul@openvz.org>
Subject: Re: [PATCH v3 1/2] x86_64,signal: Fix SS handling for signals delivered to 64-bit programs
Date: Wed, 18 Mar 2015 19:31:33 +0100 [thread overview]
Message-ID: <20150318183133.GB1832@redhat.com> (raw)
In-Reply-To: <20150318181306.GF2255@moon>
On 03/18, Cyrill Gorcunov wrote:
>
> On Wed, Mar 18, 2015 at 06:48:43PM +0100, Oleg Nesterov wrote:
> >
> > Shot in a dark afer a quick grep: restore_gpregs() should initialize ->ss?
>
> It hasn't been needed earlier, if this would help it means abi is broken, no? :)
> Otherwise I don't understand what's happening.
until this commit the kernel simply forgot to restore ->ss in sigreturn().
after this commit, if your rt_sigframe has garbage in ->ss then SIGSEGV
is clear.
> > perhaps something like below... obviously uncompiled/untested.
> >
> > And my grep can't find the definition of UserX86RegsEntry in crtools...
> > Perhaps the change below needs CPREG1(ss, anothername).
> >
> > Seriously, where is UserX86RegsEntry?
>
> It's in protobif/core-x86.proto, welcome to protobuf hell.
Still can't find UserX86RegsEntry... OK, perhaps it comes from
user_x86_regs_entry in protobuf/core-x86.proto. Then I guess the patch I sent
can be compiled at least ;)
>
> >
> > Oleg.
> >
> >
> > --- a/arch/x86/crtools.c
> > +++ b/arch/x86/crtools.c
> > @@ -475,6 +475,7 @@ int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
> > CPREG2(rip, ip);
> > CPREG2(eflags, flags);
> > CPREG1(cs);
> > + CPREG1(ss);
> > CPREG1(gs);
> > CPREG1(fs);
> >
> > diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h
> > index 70199fb..c04fb94 100644
> > --- a/arch/x86/include/asm/restorer.h
> > +++ b/arch/x86/include/asm/restorer.h
> > @@ -53,7 +53,7 @@ struct rt_sigcontext {
> > unsigned short cs;
> > unsigned short gs;
> > unsigned short fs;
> > - unsigned short __pad0;
> > + unsigned short ss;
> > unsigned long err;
> > unsigned long trapno;
> > unsigned long oldmask;
> >
>
> Cyrill
next prev parent reply other threads:[~2015-03-18 18:34 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 20:57 [PATCH v3 0/2] x86_64: Sigcontext improvements Andy Lutomirski
2015-03-12 20:57 ` [PATCH v3 1/2] x86_64,signal: Fix SS handling for signals delivered to 64-bit programs Andy Lutomirski
2015-03-13 16:13 ` Borislav Petkov
2015-03-16 8:11 ` Ingo Molnar
2015-03-16 12:08 ` [tip:x86/asm] x86/signal/64: " tip-bot for Andy Lutomirski
2015-03-17 8:44 ` tip-bot for Andy Lutomirski
2015-03-18 17:19 ` [PATCH v3 1/2] x86_64,signal: " Andrey Wagin
2015-03-18 17:48 ` Oleg Nesterov
2015-03-18 18:06 ` Andy Lutomirski
2015-03-18 18:17 ` Cyrill Gorcunov
2015-03-18 18:20 ` Andy Lutomirski
2015-03-18 18:45 ` Cyrill Gorcunov
2015-03-18 18:25 ` Oleg Nesterov
2015-03-18 18:32 ` Andy Lutomirski
2015-03-18 19:13 ` Cyrill Gorcunov
2015-03-18 18:13 ` Cyrill Gorcunov
2015-03-18 18:31 ` Oleg Nesterov [this message]
2015-03-18 18:50 ` Cyrill Gorcunov
2015-03-18 19:52 ` Andrey Wagin
2015-03-18 20:02 ` Oleg Nesterov
2015-03-18 21:26 ` Andy Lutomirski
2015-03-18 21:34 ` Pavel Emelyanov
2015-03-18 22:03 ` Andy Lutomirski
2015-03-19 7:35 ` Cyrill Gorcunov
2015-03-19 16:08 ` Andy Lutomirski
2015-03-19 16:19 ` Cyrill Gorcunov
2015-03-20 11:43 ` Denys Vlasenko
2015-03-20 11:56 ` Cyrill Gorcunov
2015-03-20 12:04 ` Cyrill Gorcunov
2015-03-20 14:07 ` Oleg Nesterov
2015-03-20 14:47 ` Cyrill Gorcunov
2015-04-10 21:59 ` Andy Lutomirski
2015-04-10 22:11 ` Cyrill Gorcunov
2015-04-10 22:16 ` Andy Lutomirski
2015-04-10 22:20 ` Cyrill Gorcunov
2015-03-12 20:57 ` [PATCH v3 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext Andy Lutomirski
2015-03-16 12:08 ` [tip:x86/asm] x86/signal/64: " tip-bot for Andy Lutomirski
2015-03-17 8:44 ` tip-bot for Andy Lutomirski
2015-03-13 15:31 ` [PATCH v3 0/2] x86_64: Sigcontext improvements Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150318183133.GB1832@redhat.com \
--to=oleg@redhat.com \
--cc=andi@firstfloor.org \
--cc=avagin@gmail.com \
--cc=bp@alien8.de \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.org \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).