From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Frediano Ziglio <frediano.ziglio@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCHv2] xen/x86: don't corrupt %eip when returning from a signal handler
Date: Fri, 19 Oct 2012 16:44:00 +0100 [thread overview]
Message-ID: <50817540.5070908@citrix.com> (raw)
In-Reply-To: <50818DF502000078000A2A84@nat28.tlf.novell.com>
On 19/10/12 16:29, Jan Beulich wrote:
>>>> On 17.10.12 at 15:29, David Vrabel <david.vrabel@citrix.com> wrote:
>> From: David Vrabel <david.vrabel@citrix.com>
>>
>> In 32 bit guests, if a userspace process has %eax == -ERESTARTSYS
>> (-512) or -ERESTARTNOINTR (-513) when it is interrupted by an event
>> /and/ the process has a pending signal then %eip (and %eax) are
>> corrupted when returning to the main process after handling the
>> signal. The application may then crash with SIGSEGV or a SIGILL or it
>> may have subtly incorrect behaviour (depending on what instruction it
>> returned to).
>>
[...]
>> diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
>> index 2c63407..6a19e66 100644
>> --- a/arch/x86/kernel/entry_32.S
>> +++ b/arch/x86/kernel/entry_32.S
>> @@ -1042,7 +1042,7 @@ ENTRY(xen_sysenter_target)
>>
>> ENTRY(xen_hypervisor_callback)
>> CFI_STARTPROC
>> - pushl_cfi $0
>> + pushl_cfi $-1 /* orig_ax = -1 => not a system call */
>> SAVE_ALL
>> TRACE_IRQS_OFF
>>
>> @@ -1078,7 +1078,7 @@ ENDPROC(xen_hypervisor_callback)
>> # We distinguish between categories by maintaining a status value in EAX.
>> ENTRY(xen_failsafe_callback)
>> CFI_STARTPROC
>> - pushl_cfi %eax
>> + pushl_cfi $-1 /* orig_ax = -1 => not a system call */
>
> While making this apply to the 2.6.18 tree, I noticed that you
> replaced the wrong push here, thus causing register corruption.
> Just like on the 64-bit side, the one that needs fixing is the one
> right before the SAVE_ALL (and hence it's again not just for
> consistency, as zero is being pushed there too).
Oops.
We would have liked to test this path but could not see how to. Do you
have any ideas?
David
next prev parent reply other threads:[~2012-10-19 15:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 13:29 [PATCHv2] xen/x86: don't corrupt %eip when returning from a signal handler David Vrabel
2012-10-17 15:02 ` Konrad Rzeszutek Wilk
2012-10-19 15:29 ` Jan Beulich
2012-10-19 15:44 ` David Vrabel [this message]
2012-10-19 16:03 ` Jan Beulich
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=50817540.5070908@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=frediano.ziglio@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=stable@vger.kernel.org \
--cc=xen-devel@lists.xen.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).