Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp684951pxb; Tue, 5 Apr 2022 18:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9m34E/VXtuL4uHbJmHHRd9Gn9/4/swaJV7vcK5aJvMzvU00FCE7mgR5O8gRTdCciau7oP X-Received: by 2002:a17:907:6e04:b0:6e0:736b:d786 with SMTP id sd4-20020a1709076e0400b006e0736bd786mr6106321ejc.667.1649209376271; Tue, 05 Apr 2022 18:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649209376; cv=none; d=google.com; s=arc-20160816; b=OkixIx5ucjRpxtJk9QNjaAtDTB7LiBo3Ej3mTZmc6fixwMlFh6y8FAbT2+Ixb+lEOD jNR/RH2bl0oqJVPKdRadHxv8nt2n0Z9K1FIcvD3qlEca8CLmL1/ae5o6WbAlZyQQTVAv 8spsHkDNLPVObGhPrfvfPK3TuLoJyX5KSXd+cpZHvtkRy1ID6vYiQsy5w8ebW/WDRuB1 oH3e0kdcKCFs+76F0iuSfz9anV8i/idr3y+k5UaXRoogSk+2ep7bs8kvEMPes5rDexR6 oTRCI8K480cefxZJoxPNwGOu3wKfZX/1co/tymkqp1sq9LGcyofpUsn7tHKah0CsJPjb YYLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rtPUluTKKc3vBns2KWndJ4i0//p32f2trqy+df2pCyw=; b=sn/pjODojf0qo+aDdMXdT5w70/Lj6iwFwr5LZ9FLg9X23TgVHpUI2/IHXEnnSJ2nBb vTcGLNmvY7k7wlgUeX7OOhkx20rBLnipEfxsvdDzeLcJSxsdqKdmK6jFo5lWMCPmeJ/H gbV1wTpfD524okgaK8Se9ZMSYUDObClePwUQMCXjZNDIvwQ1hjgSeaJMaHxOObrMVzec AnxKYM+481HMzox/Z7yRrM8GGujrERTm4m+W0u69JnXr8xIUydgrHsddBfjzfZMYE0XF 6wK9eq7aa8ffVwS3hluu3jhs/XhFG57UTJiTGxG225O/CAGP3VcuCFRclUZN0wBdWR8c kT/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R4yqA9Cp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a056402055600b0041cdc07ff86si4423619edx.584.2022.04.05.18.42.29; Tue, 05 Apr 2022 18:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R4yqA9Cp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376416AbiDELVy (ORCPT + 99 others); Tue, 5 Apr 2022 07:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241526AbiDEIs3 (ORCPT ); Tue, 5 Apr 2022 04:48:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28A4929C9D; Tue, 5 Apr 2022 01:36:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5484B61515; Tue, 5 Apr 2022 08:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65BEFC385A0; Tue, 5 Apr 2022 08:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147800; bh=YhiSsJ3TnEyST2jyx9qSBcFa+5qpcWGpbNlsUtKc+X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4yqA9CpyAwHLTrjq5C1PfgS8lzrdOhUOfmSmCGUDDt63wz31d0YS0xJv1ZbEUf8h +/qLAaDLnqmNSnI6FM6Zs6hj1D47jwrNoBX8uCE1VshpY9GD4pmfu9n62I43YBoF8S eiuYavGx7sSS/2ediLV0LKUrwOrGwSvKhQKCbfds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Engraf , Catalin Marinas , Will Deacon , Mark Brown Subject: [PATCH 5.16 0127/1017] arm64: signal: nofpsimd: Do not allocate fp/simd context when not available Date: Tue, 5 Apr 2022 09:17:20 +0200 Message-Id: <20220405070357.969110479@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Engraf commit 0a32c88ddb9af30e8a16d41d7b9b824c27d29459 upstream. Commit 6d502b6ba1b2 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") introduced saving the fp/simd context for signal handling only when support is available. But setup_sigframe_layout() always reserves memory for fp/simd context. The additional memory is not touched because preserve_fpsimd_context() is not called and thus the magic is invalid. This may lead to an error when parse_user_sigframe() checks the fp/simd area and does not find a valid magic number. Signed-off-by: David Engraf Reviwed-by: Mark Brown Fixes: 6d502b6ba1b267b3 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") Cc: # 5.6.x Reviewed-by: Catalin Marinas Link: https://lore.kernel.org/r/20220225104008.820289-1-david.engraf@sysgo.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/signal.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -577,10 +577,12 @@ static int setup_sigframe_layout(struct { int err; - err = sigframe_alloc(user, &user->fpsimd_offset, - sizeof(struct fpsimd_context)); - if (err) - return err; + if (system_supports_fpsimd()) { + err = sigframe_alloc(user, &user->fpsimd_offset, + sizeof(struct fpsimd_context)); + if (err) + return err; + } /* fault information, if valid */ if (add_all || current->thread.fault_code) {