linux-hexagon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Kuo <rkuo@codeaurora.org>
To: linux-arch@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk
Cc: Richard Kuo <rkuo@codeaurora.org>
Subject: [PATCH 4/6] Hexagon: check to if we will overflow the signal stack
Date: Wed,  3 Apr 2013 19:02:54 -0500	[thread overview]
Message-ID: <1365033776-21804-5-git-send-email-rkuo@codeaurora.org> (raw)
In-Reply-To: <1365033776-21804-1-git-send-email-rkuo@codeaurora.org>

Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
---
 arch/hexagon/kernel/signal.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index 8a20e8e..097623c 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -41,6 +41,10 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 {
 	unsigned long sp = regs->r29;
 
+	/* check if we would overflow the alt stack */
+	if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size)))
+		return (void __user __force *)-1UL;
+
 	/* Switch to signal stack if appropriate */
 	if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
 		sp = current->sas_ss_sp + current->sas_ss_size;
-- 
1.7.9.5

--

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2013-04-04  0:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04  0:02 [PATCH 0/6] Hexagon: various signal and return path cleanups Richard Kuo
2013-04-04  0:02 ` [PATCH 1/6] Hexagon: Signal and return path fixes Richard Kuo
2013-04-04  0:02 ` [PATCH 2/6] Hexagon: fix up int enable/disable at ret_from_fork Richard Kuo
2013-04-04  0:02 ` [PATCH 3/6] Hexagon: use correct work mask when checking for more work Richard Kuo
2013-04-04  0:02 ` Richard Kuo [this message]
2013-04-04 16:25   ` [PATCH 4/6] Hexagon: check to if we will overflow the signal stack Linas Vepstas
2013-04-04 16:58     ` Richard Kuo
2013-04-04  0:02 ` [PATCH 5/6] Hexagon: break up user fn/arg register setting Richard Kuo
2013-04-04  0:02 ` [PATCH 6/6] Hexagon: fix psp/sp macro Richard Kuo

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=1365033776-21804-5-git-send-email-rkuo@codeaurora.org \
    --to=rkuo@codeaurora.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).