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: 799736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-82937-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="poWAlprX"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xS9DM1pJdz9rxm for ; Wed, 9 Aug 2017 22:14:11 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=BDfqU24C3HyLmBCfTZSlWiOBnmJI6i/ cYqzHiy8khNSuabWgQ1Hj/hU4JSdjc/oOZ+mitlZkz4nvzuKPVVFLaB4DXf0G3FB BD9WOfMswX+87vEbCiyUsnZkvD4fu/8OS7nW4+nkMgIWFQV910btTM9dko28FHjx RKgKCDAfvdZU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=V7ONYxN2stBiJQyAg8dEx4KUmKY=; b=poWAl prX3+gxKG/17eg9p/NgOeNhlDbw2w1G/ujztZJIwYE1AHagvCC1/GUoVSy1SHpOd HRyENdw6ORTDpIPZhclFl7J06bCCCgxrcZdqkS4EON2mxqjtjVwA0XDieQ6ns8z/ qGqfBxXipcM43akVLC2cIiAgISP6ugfGCUl6js= Received: (qmail 130398 invoked by alias); 9 Aug 2017 12:08:59 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 130298 invoked by uid 89); 9 Aug 2017 12:08:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*au X-HELO: foss.arm.com From: Dave Martin To: linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Szabolcs Nagy , Richard Sandiford , kvmarm@lists.cs.columbia.edu, libc-alpha@sourceware.org, linux-arch@vger.kernel.org, Michael Ellerman 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> In-Reply-To: <1502280338-23002-1-git-send-email-Dave.Martin@arm.com> References: <1502280338-23002-1-git-send-email-Dave.Martin@arm.com> 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,