From patchwork Tue May 8 10:43:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 910122 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WIJGRSPQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="mwS+etID"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40gGbL2mjxz9rvt for ; Tue, 8 May 2018 20:54:54 +1000 (AEST) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=Hsx18rCNVe1C5PIcpRC9HaKm1SuDGhuHw1cRXR79PmQ=; b=WIJGRSPQTN6Oj3 BVGc+R2tItHsYXB0iSO/FH5p4CfTzAmSY+JFNkKwAgX12hKVv/noMIe2dsU/LPk/jgAUGzyYFh2gO SltB9yBLUMOt1dSPht4SGDlcgGkX0qClPCbBs4p+gwt0qewu4tdHGxQsRSNGegf51usDot23sGroj RXZhv1yupMEeWQzv0s2MHqFgChr9JLePvC+E+UCF9PNMydzdq1EZelm7wSsM2r50BeJrWgBSfSH/Q QDPdxwkqmbRHJ9thaIm378kGtZhNfEntb4HLzx04gtiKdWgz0kacbj1IdMb4Kq6uZzZ/Z2dKzKGZy /mMoYTIbStEU/6iOrMyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fG0Gf-0000K3-Fh; Tue, 08 May 2018 10:54:49 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fG0GS-0000El-W4 for linux-arm-kernel@bombadil.infradead.org; Tue, 08 May 2018 10:54:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To: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=u2A4ZU6B4WbItdHd4OeNN8HjUVVl1TcH2AAt/DxwJFo=; b=mwS+etIDaRjYqmoXjRe/uGTQ6a qTyQ0DxkiyH8sYy0IOnGkHw+C0krXwqL5FOfv++SdY1z4bkC67GmLz319wfJJkN0e/rpd+rybQ6t0 Gmimqm1yH7IYDWT2GQ36eJDJffXhbgXsqo3518c1ITPb3m69FDcFMbRR+QprMpQrbo0l62KpI44se fYeMEw9/H0yQplbJMJVDV+rrW4Ua3XpP1EKLtofqmfsEQxoQaD6Nx92/MMJGvVWB+TW46dhl0rOPz IK44ElNdxPRICuNJxRIvrYN3lcY5EbnZPGLcYNPn/DrIkiuXss9Mig9prH4GKVwAPpvIeepBMU/oF BHLIVcPA==; Received: from foss.arm.com ([217.140.101.70]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fG061-0002Ii-Q4 for linux-arm-kernel@lists.infradead.org; Tue, 08 May 2018 10:43:51 +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 A579815BE; Tue, 8 May 2018 03:43:38 -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 979FB3F592; Tue, 8 May 2018 03:43:37 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] arm64/sve: signal: Include SVE when computing AT_MINSIGSTKSZ Date: Tue, 8 May 2018 11:43:31 +0100 Message-Id: <1525776211-28169-3-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1525776211-28169-1-git-send-email-Dave.Martin@arm.com> References: <1525776211-28169-1-git-send-email-Dave.Martin@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180508_114349_976674_EC50BB40 X-CRM114-Status: GOOD ( 11.99 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-5.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Catalin Marinas , Will Deacon , Ard Biesheuvel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 Cc: Ard Biesheuvel Cc: Alex Bennée --- arch/arm64/kernel/signal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index a4f1edf..3427c70 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -599,8 +599,18 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user, if (system_supports_sve()) { unsigned int vq = 0; - if (test_thread_flag(TIF_SVE)) - vq = sve_vq_from_vl(current->thread.sve_vl); + if (add_all || test_thread_flag(TIF_SVE)) { + int vl = sve_max_vl; + + if (!add_all) + vl = current->thread.sve_vl; + + /* Fail safe if something wasn't initialised */ + if (WARN_ON(!sve_vl_valid(vl))) + vl = SVE_VL_MIN; + + vq = sve_vq_from_vl(vl); + } err = sigframe_alloc(user, &user->sve_offset, SVE_SIG_CONTEXT_SIZE(vq));