Hexagon: check to if we will overflow the signal stack
authorRichard Kuo <rkuo@codeaurora.org>
Tue, 29 May 2012 23:56:39 +0000 (18:56 -0500)
committerRichard Kuo <rkuo@codeaurora.org>
Wed, 1 May 2013 00:40:24 +0000 (19:40 -0500)
Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
arch/hexagon/kernel/signal.c

index 8a20e8ed5d7d1cb6317079ef402b9c5de3ca27f7..097623c0c4b4268b33a5178c920520566379d4e5 100644 (file)
@@ -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;