From: Shi Weihua <shiwh@cn.fujitsu.com>
To: Roland McGrath <roland@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 1/3] signal(i386): alternative signal stack wraparound occurs
Date: Wed, 05 Dec 2007 13:22:39 +0800 [thread overview]
Message-ID: <4756359F.5000008@cn.fujitsu.com> (raw)
In-Reply-To: <20071204215251.60C6326F8D9@magilla.localdomain>
Roland McGrath wrote::
>>> Thank you for your detailed explanation and patch. I tested your
>>> patch, unfortunately it can not stop all kinds of overflow.
>> [...]
>>> So, the patch I posted is still needed
>> thanks, i've picked up your fix for x86.git, for 2.6.25 merging.
>
> I just explained that not all overflows would be caught and that doing so
> would violate the semantics of e.g. longjmp. I don't see how the patch
> you've included now doesn't still have all those problems. I think it's wrong.
>
I am sorry, i don't understand how this is related to the semantics of e.g. longjmp.
But, i am sure my patch solves all overflows. Ingo's patch can't catch the overflow
which is caught by "int i[1000];" in the handler function.
Do you have more idea for me? Thanks.
Regards
Shi Weihua
By the way, I think Ingo's patch can be improved.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
---
--- linux-2.6.24-rc4-git1.orig/arch/x86/kernel/signal_32.c 2007-12-04 12:26:10.000000000 +0800
+++ linux-2.6.24-rc4-git1/arch/x86/kernel/signal_32.c 2007-12-05 11:13:56.000000000 +0800
@@ -297,8 +297,17 @@ get_sigframe(struct k_sigaction *ka, str
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (sas_ss_flags(esp) == 0)
+ int onstack = sas_ss_flags(esp);
+ if (onstack == 0)
esp = current->sas_ss_sp + current->sas_ss_size;
+ else if(onstack == SS_ONSTACK){
+ /*
+ * If we are on the alternate signal stack and would overflow it, don't.
+ * Return an always-bogus address instead so we will die with SIGSEGV.
+ */
+ if (!likely(on_sig_stack(esp - frame_size)))
+ return (void __user *) -1L;
+ }
}
/* This is the legacy signal stack switching. */
next prev parent reply other threads:[~2007-12-05 5:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <474CF7D5.6010702@cn.fujitsu.com>
2007-11-28 6:07 ` Fw: Re: [PATCH 1/3] signal(i386): alternative signal stack wraparound occurs Shi Weihua
2007-12-04 13:02 ` Ingo Molnar
2007-12-04 21:52 ` Roland McGrath
2007-12-04 21:57 ` Ingo Molnar
2007-12-05 5:22 ` Shi Weihua [this message]
2007-12-05 5:36 ` Roland McGrath
[not found] <20071126143317.dd884128.akpm@linux-foundation.org>
[not found] ` <20071126230242.GA9623@elte.hu>
2007-11-27 3:02 ` Fw: " Roland McGrath
2007-11-27 22:57 ` Arjan van de Ven
2007-10-04 13:08 Mikael Pettersson
2007-10-05 0:55 ` Shi Weihua
-- strict thread matches above, loose matches on Subject: below --
2007-10-03 13:46 Mikael Pettersson
2007-10-03 14:25 ` KAMEZAWA Hiroyuki
2007-10-04 11:56 ` Shi Weihua
2007-10-04 12:17 ` KAMEZAWA Hiroyuki
2007-10-04 12:33 ` Shi Weihua
2007-10-04 12:47 ` KAMEZAWA Hiroyuki
2007-10-03 12:20 Mikael Pettersson
2007-10-03 12:40 ` KAMEZAWA Hiroyuki
2007-10-03 13:20 ` KAMEZAWA Hiroyuki
2007-10-04 11:02 ` Shi Weihua
2007-10-03 8:06 Shi Weihua
2007-11-19 2:15 ` Shi Weihua
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=4756359F.5000008@cn.fujitsu.com \
--to=shiwh@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.