From patchwork Wed Aug 9 12:05:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 9890589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 369DE601EB for ; Wed, 9 Aug 2017 12:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25690289D5 for ; Wed, 9 Aug 2017 12:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19DD728A6F; Wed, 9 Aug 2017 12:33:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 721F7289D5 for ; Wed, 9 Aug 2017 12:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0WJ8LUoDJQdh7haa3d05D9BZCiXjOEqJLiLm0iejJEQ=; b=cQE86xfs9wMvB4db0zvuYvGFsc Pm/sIIV58ZR0GGmbCJVs9jFHKFcjXuu0+tZ4eZXU84193AHLtUjFT9NFivySCKz+IxkoN7Y8TWNGB p5U8RnnvSnM546lHUllsO2CSGM78UQXEm2lRl9alJBNcRg+2/c3RkFiDPG+xFPaLx+Fiowy+GuuA1 YDJ2CftW8+Y/jNbJlFX2qHBOs5+y6Bad49eTsNdjBcMHGFQyFAZ9TGsfLENZWX6/b/DMafCTtIDO7 YG/HkpSnZQXb1V0H5KkaiPa6OLjCTQrNtYsv8MNnRsCJ2RSxZXkd1z+kH9Wyb7HIReuDGJGVMc3H6 wXhRVIOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfQAl-0001ca-Vn; Wed, 09 Aug 2017 12:33:15 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dfPy9-0007BI-Pa for linux-arm-kernel@bombadil.infradead.org; Wed, 09 Aug 2017 12:20:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lOZSyT6fp5TSuPJ7M6G17RMxji4lpz+k257YMqrRHaM=; b=JUF2st1zYpWvMSECf3XPlK4/6 +IyF1fwoLM+ViJAN6EEDA+tCJmGqfXsnq5QfeVhLpzfb4byQIL8zWGUc+OkLLtt7QDWxa+Fx03txp t7cAVlCdT3GRZ7CGkVZHqunUeje8SRTT4B/+EKTH3u5qgF6Fr3quk4d2i0KXRoGu3EXe6XUIe3XtT 5dpRLE8VWz26OB8r4pEZ6hi7hlpiSnXd0AbY/KhvkX0jE9b1pYhH4qendvONfxPrfoFRfFNLHsl6I wjiC/621wrXPC1xCwGseZv7Y0wHO/CJA03jiNRpH1r4zx7wJa/C1X3sWN0ygptNwwbryEOXMvXq8N LZeRxk+Sw==; Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by casper.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfPnY-0001FT-Ed for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2017 12:09:18 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B8E9F1688; Wed, 9 Aug 2017 05:08:55 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E377A3F540; Wed, 9 Aug 2017 05:08:53 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 27/27] arm64/sve: signal: Include SVE when computing AT_MINSIGSTKSZ Date: Wed, 9 Aug 2017 13:05:33 +0100 Message-Id: <1502280338-23002-28-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1502280338-23002-1-git-send-email-Dave.Martin@arm.com> References: <1502280338-23002-1-git-send-email-Dave.Martin@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170809_130916_680843_AC0AB6FD X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, libc-alpha@sourceware.org, Ard Biesheuvel , Szabolcs Nagy , Catalin Marinas , Will Deacon , Michael Ellerman , Richard Sandiford , kvmarm@lists.cs.columbia.edu MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The SVE context block in the signal frame needs to be considered too when computing the maximum possible signal frame size. Because the size of this block depends on the vector length, this patch computes the size based not on the thread's current vector length but instead on the maximum possible vector length: this determines the maximum size of SVE context block that can be observed in any signal frame for the lifetime of the process. Signed-off-by: Dave Martin --- arch/arm64/kernel/signal.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 221bcf2..cb01353 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -586,11 +586,18 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user, } if (system_supports_sve()) { - unsigned int vq = 0; + unsigned int vq; - if (test_thread_flag(TIF_SVE)) { - BUG_ON(!sve_vl_valid(current->thread.sve_vl)); - vq = sve_vq_from_vl(current->thread.sve_vl); + if (!add_all && !test_thread_flag(TIF_SVE)) + vq = 0; + else { + unsigned int vl = sve_max_vl; + + if (!add_all) + vl = current->thread.sve_vl; + + BUG_ON(!sve_vl_valid(vl)); + vq = sve_vq_from_vl(vl); } err = sigframe_alloc(user, &user->sve_offset,