Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262684AbVAVJDS (ORCPT ); Sat, 22 Jan 2005 04:03:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262685AbVAVJDR (ORCPT ); Sat, 22 Jan 2005 04:03:17 -0500 Received: from ozlabs.org ([203.10.76.45]:20611 "EHLO ozlabs.org") by vger.kernel.org with ESMTP id S262684AbVAVJDN (ORCPT ); Sat, 22 Jan 2005 04:03:13 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16882.5835.468874.683779@cargo.ozlabs.ibm.com> Date: Sat, 22 Jan 2005 20:03:07 +1100 From: Paul Mackerras To: Roland McGrath Cc: Linus Torvalds , Andrew Morton , linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, Dave Jones Subject: Re: [PATCH] PPC: fix stack alignment for signal handlers In-Reply-To: <200501220756.j0M7u06B021617@magilla.sf.frob.com> References: <200501220756.j0M7u06B021617@magilla.sf.frob.com> X-Mailer: VM 7.19 under Emacs 21.3.1 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1643 Lines: 39 Roland McGrath writes: > For PPC32 signal handlers, while the frame itself was of properly aligned > size, no alignment of the starting stack pointer was done at all, so that a > signal handler can still get a misaligned stack pointer if the interrupted > registers had one, though the kernel isn't gratuitously misaligning good > ones like it is for PPC64. I added explicit alignment to fix that. This part is unnecessary, because arch/ppc/kernel/signal.c:do_signal() already aligns the stack pointer to a 16-byte boundary: if ((ka.sa.sa_flags & SA_ONSTACK) && current->sas_ss_size && !on_sig_stack(regs->gpr[1])) newsp = current->sas_ss_sp + current->sas_ss_size; else newsp = regs->gpr[1]; newsp &= ~0xfUL; /* Whee! Actually deliver the signal. */ if (ka.sa.sa_flags & SA_SIGINFO) handle_rt_signal(signr, &ka, &info, oldset, regs, newsp); else handle_signal(signr, &ka, &info, oldset, regs, newsp); The additions to arch/ppc64/kernel/signal32.c are likewise unnecessary, because do_signal32() also does newsp &= ~0xfUL (in fact the code there is very similar to the ppc32 code). You are correct about the 64-bit case though. I thought we had fixed that but evidently not. Your patch looks fine as far as arch/ppc64/kernel/signal.c is concerned. Regards, Paul. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/