From owner-freebsd-toolchain@freebsd.org Tue Feb 2 16:20:06 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98C42A98600; Tue, 2 Feb 2016 16:20:06 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 571FA197F; Tue, 2 Feb 2016 16:20:06 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ob0-x22d.google.com with SMTP id is5so153624317obc.0; Tue, 02 Feb 2016 08:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Xv/L/zIAtzIJC/2yac1TZZKr2wvXRC7IbnYrRbdGqFk=; b=auctRQ0hKiwTA3eSFa48P0Q040E8wBg20q/LZ/YA75zT5KWeeiiWs4zxwKfrC6tcqg xJ4ZS1Nnyo9+MBdeD2mSlYpDoTQPfUHb0exKlmDcvhvx0q3NZgWyP+kNY930ahlRGYNU +WPG+jB8Oa8/lRQU5BS8TCPUifQPgG32v+Lp062g1WZSkMdJ0ShZE6Y03YD/C3Xfd+L6 1PZD4ZrX3gbazaSY4SOw/Th6RJwCuQRo5mF2cxebFJfklqUFhfv7gVzl9Mu+EPXy+L6O FM739/tWQsWkDsU+hV1NGWqYc37aePvwJQ+djXDYsz21pRFpe/sUAx58QMA3sYfgTcXR /3XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Xv/L/zIAtzIJC/2yac1TZZKr2wvXRC7IbnYrRbdGqFk=; b=VB4DbRDmM4kP69NH0Vw+vW/U7m3677wXXsyXMp4zBTT4LBplTqo6h1H2Qlg6o+pdbi lN+xN2ab4ulSI1ymWSLVG4hFGdi4uT59van2JNsuRp+pDwh1UbX81A2dGR28LYCaQ7Bu 6o60IhcKLazdvbEDZykEifcvXf3tGAueNhTQGimuDuAFqqMpFOeYZRrh5tatvVUCsq6L iPx0+kLOQLIJg/YjTdp26AJa5JXRntxDPRp9nr/W8wdEs2crqCPKZbrEwzKWySl/5qU8 Ll+I+iUzO4qiKuK7bkt8fXt7a12eOE9kH+WLqeLztI3gBcAwy+vfsQQ1LlLnQCyA4udc KKZw== X-Gm-Message-State: AG10YORgs7BEBqLN/BW1ovFymWdgl9sgyshonVHzCnJJlRgHUMHOavcZPj+lLwK1SbNOR+WqoG2Eq4mLSmDoxA== MIME-Version: 1.0 X-Received: by 10.182.70.70 with SMTP id k6mr23464550obu.74.1454430005559; Tue, 02 Feb 2016 08:20:05 -0800 (PST) Received: by 10.182.74.101 with HTTP; Tue, 2 Feb 2016 08:20:05 -0800 (PST) In-Reply-To: <20160202161317.GB91220@kib.kiev.ua> References: <20160131140807.GA83147@vlakno.cz> <0716BE3E-B7D1-4A10-B011-C1F0245296E7@dsl-only.net> <70A66DFD-557A-4D82-813C-05EED6EAB089@dsl-only.net> <1CCB483E-882A-4068-AF5B-EF43DAF0BA79@dsl-only.net> <261D8A47-3B8A-4DE6-9D2C-F536C9143E84@dsl-only.net> <8D38E67E-B798-4EFD-951F-DADFDBAEDD8A@dsl-only.net> <20160202161317.GB91220@kib.kiev.ua> Date: Tue, 2 Feb 2016 10:20:05 -0600 Message-ID: Subject: Re: 3 quick questions about stack alignment for powerpc (32-bit) signal handlers [the change that caused misaligned] From: Justin Hibbits To: Konstantin Belousov Cc: Mark Millard , FreeBSD Toolchain , Roman Divacky , FreeBSD PowerPC ML Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2016 16:20:06 -0000 On Tue, Feb 2, 2016 at 10:13 AM, Konstantin Belousov wrote: > On Tue, Feb 02, 2016 at 10:05:16AM -0600, Justin Hibbits wrote: >> Good catch! I'll commit the change tonight. > I looked once at the powerpc sigsend(), and I think that it has an > issue. The usfp is calculated by taking the stack pointer at the time > of signal delivery and substracting the sigframe size. This means that > a transient misalignment during some code (e.g. leaf function) is > transferred to the signal handler execution. > > Other arches explicitely realign stack pointer for the signal > frame before the frame is formed. > > I am not sure if the problem reported in the thread is caused by this > or not, but forced realignment in sendsig() is required for ABI compliance. Good point. Currently the assumption is that the stack will always be 16-byte aligned, which is required per ABI. Since there's no push/pop, only full frame creation/destruction, it hasn't bitten us yet, but it should be fixed. It's not the cause of this bug, though. This bug is caused after sendsig(), in the sigcode trampoline in user space. - Justin