Re: [PATCH 4/6] Hexagon: check to if we will overflow the signal stack
On 04/04/2013 11:25 AM, Linas Vepstas wrote: On 3 April 2013 19:02, Richard Kuo wrote: + /* 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; I found the !likely construction confusing, as its doing both a 'unlikely' (right?) and inverting the argument. It seems clearer, to idiots like me, to write this as: if (on_sig_stack(sp) && unlikely(!on_sig_stack(sp - frame_size))) since where checking for overflow, and its unlikely that the overflow happened. -- Linas I'm not sure if putting a double negative in there will make it less not easy to understand... -- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] Hexagon: check to if we will overflow the signal stack
On 3 April 2013 19:02, Richard Kuo wrote: > + /* 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; I found the !likely construction confusing, as its doing both a 'unlikely' (right?) and inverting the argument. It seems clearer, to idiots like me, to write this as: if (on_sig_stack(sp) && unlikely(!on_sig_stack(sp - frame_size))) since where checking for overflow, and its unlikely that the overflow happened. -- Linas -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] Hexagon: check to if we will overflow the signal stack
Signed-off-by: Richard Kuo --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/