From patchwork Sun Nov 25 22:07:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 1799661 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1F59FDF264 for ; Sun, 25 Nov 2012 22:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753552Ab2KYWHi (ORCPT ); Sun, 25 Nov 2012 17:07:38 -0500 Received: from mail.sf-mail.de ([62.27.20.61]:53647 "EHLO mail.sf-mail.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753544Ab2KYWHi (ORCPT ); Sun, 25 Nov 2012 17:07:38 -0500 Received: (qmail 5351 invoked from network); 25 Nov 2012 22:07:25 -0000 Received: from dslb-178-003-165-035.pools.arcor-ip.net ([::ffff:178.3.165.35]:57432 HELO eto.sf-tec.de) (auth=eike@sf-mail.de) by mail.sf-mail.de (Qsmtpd 0.22svn) with (DHE-RSA-AES256-SHA encrypted) ESMTPSA for ; Sun, 25 Nov 2012 23:07:25 +0100 From: Rolf Eike Beer To: John David Anglin Cc: Helge Deller , Parisc List , "James E.J. Bottomley" Subject: Re: [PATCH] parisc: sigaltstack doesn't round ss.ss_sp as required Date: Sun, 25 Nov 2012 23:07:19 +0100 Message-ID: <1585369.EaOyvHic2M@eto> User-Agent: KMail/4.8.5 (Linux/3.6.6-11-desktop; KDE/4.8.5; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org John David Anglin wrote: > On 24-Nov-12, at 10:05 AM, John David Anglin wrote: > > In trying to build the debian libsigsegv2 package, I found that > > sigaltstack > > doesn't round ss.ss_sp. The tests intentionally pass an unaligned > > pointer. > > This results in the two stack overflow tests failing. > > The attached patch fixes this issue. What about something like this (entirely untested, but you'll get the idea): sp = round_down(current->sas_ss_sp + 64, 64); Greetings. Eike diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 594459b..324644d 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c @@ -188,8 +188,10 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n", (unsigned long)ka, sp, frame_size); + /* Align alternate stack and reserve 64 bytes for the signal + handler's frame marker. */ if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp)) - sp = current->sas_ss_sp; /* Stacks grow up! */ + sp = (current->sas_ss_sp + 0x7f) & ~0x3f; /* Stacks grow up! */ DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp); return (void __user *) sp; /* Stacks grow up. Fun. */