Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4141834rwd; Tue, 23 May 2023 03:55:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CPVcjHyq8SJkMwn7D/cynjjbOShSuf+SXjKvgYaPpHPRmwFJkZ7iH/KL6WDXDVos6fjDj X-Received: by 2002:a17:902:b217:b0:1ac:aedf:2222 with SMTP id t23-20020a170902b21700b001acaedf2222mr11465389plr.3.1684839358679; Tue, 23 May 2023 03:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684839358; cv=none; d=google.com; s=arc-20160816; b=c/nWnTySkUuauSn9p2nN9faCjyNG8AHfRIjLFRdXYF6llu5JCOV9PumQoZwHeeLi6f BPscB4sigm33mV/L2SF9mBrNcwpF7lCipV6eDXe1mKB/glaab/oIxVn3e1nUbFC+l0Rb lkctkm3x72EnrIwjm5a2IZVS7CkIZX2Gz+Wj0P+FSK9GwVlNHtjwc2Q1ZhvqcLNYi6zB hG3xDsMzOL1miusPds2/PMmS9LMxT7uT9LU10b7Jibl2gHiGDLqVZHiKC6KrWvD1KF/y XvvmOyIlTV7dV1Ukf0JCoW8PajyWSOEiZNpaTRQ/B29+6hUkX4ZpDuzD6d+TCxXYD8TW zQSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xQRz+CLVmHPt29862bxIaROZw+OZ5dITTl193Wl+kaE=; b=dTWPTjzhvVoC5bxcPzZH++KhC1eGHY5Z0fCJ2P8+i+GVZvoXCM6wx9IkAbZxULIehH GVtzBsXBEkTEjhDERQfLaeOESOK4ThDXNetxq6Y8lg8TxH6MOsgUU0UQJj1cD1cqUe3P Xx/ZHrWjImDx4UgEn0dTWtBSOQzgEtT3ZuTQiZx1uYNllo6ltA5RUEITMbmLDdZwjq8i vlUOQgbmCViSD1AO0PYGOBBBSj40yDFXl/nd4YOQWkKauTi84dIoYZM/2F4L5rXej0Aa tRTR7ifB9FCvVRNgkZgR3dDjTHs0xnXnp1TL026+gBO95KairKXiv0Y9DHM8OAK3LiKp LCgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=itC55Fb3; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a170902be1600b001ab23ced2d2si2344699pls.613.2023.05.23.03.55.43; Tue, 23 May 2023 03:55:58 -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=@kernel.org header.s=k20201202 header.b=itC55Fb3; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236274AbjEWK2Y (ORCPT + 99 others); Tue, 23 May 2023 06:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236204AbjEWK2X (ORCPT ); Tue, 23 May 2023 06:28:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B802129; Tue, 23 May 2023 03:28:21 -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 3BA8460FB8; Tue, 23 May 2023 10:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 419C7C433D2; Tue, 23 May 2023 10:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684837700; bh=rEtWtzgud+dO4P7xKWlT7z3oMQmShxLx4UZLon9bI8A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=itC55Fb3VuqSwZMKKdERBjnsvn4Pl3mwXDIyQVMQ5ZdClxgMM2XYDfxPQNmHwVeOA k8MwbLW9WlO41YUIrtYXkTHHpDUOERpa8kOp1EiqEu7ABatoOhX1CBBzkSQpunmXX+ yZJujZPRclL+9Sb4lpuYgynCwOXHpFzcWYtbgs+5X7uZBc5WBFqzg59IAcxS4U7xdT keKGS8IcCOVkOeS/LHHd5b+H+PJYTYYtuw5GJmbn/yslH+GCWk942e2coAv7zddNxR Dxwrg7qTwgKYbcgtNTqUZCpiC+xqXhdI/De+Yt7+AL8W5QKhCoLy/Ot8JfjQ413XEL YkgYpYhdwqFog== Date: Tue, 23 May 2023 11:28:14 +0100 From: Mark Brown To: Dan Carpenter Cc: Naresh Kamboju , "open list:KERNEL SELFTEST FRAMEWORK" , linux-stable , open list , lkft-triage@lists.linaro.org, Catalin Marinas , Will Deacon , Arnd Bergmann , Shuah Khan , Anders Roxell Subject: Re: arm64: fp-stress: BUG: KFENCE: memory corruption in fpsimd_release_task Message-ID: <99c3fac1-e964-4cf6-ba14-58de305aa37d@sirena.org.uk> References: <2d9a04d8-c09e-49aa-95eb-32b4679f7eba@kili.mountain> <43d53046-f8d9-4c4a-90ba-709910a13f97@kili.mountain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tUbDFipGxi8zU7ey" Content-Disposition: inline In-Reply-To: <43d53046-f8d9-4c4a-90ba-709910a13f97@kili.mountain> X-Cookie: Beware of low-flying butterflies. 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 --tUbDFipGxi8zU7ey Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 22, 2023 at 06:40:59PM +0300, Dan Carpenter wrote: > On Thu, May 18, 2023 at 10:52:31AM +0900, Mark Brown wrote: > > > When we call sme_alloc() it will say the buffer is already allocated > > > and just zero out what we need for "vl", but the existing buffer is too > > > small. > > If we are setting the SVE vector length we do not need to reallocate the > > SME state since the size of the data stored in the sme_state buffer is > > influenced only by the SME vector length, not the SVE vector length. We > > unconditionally free the SVE state (causing it to be reallocated when > > needed) since the size needed for it depends on both vector lengths. > arch/arm64/kernel/fpsimd.c > 909 /* > 910 * Force reallocation of task SVE and SME state to the correct > 911 * size on next use: > 912 */ > 913 sve_free(task); > Sure, this forces a reallocation. But what prevents it from happening > before we reach the task_set_vl() line? Reallocation is either triggered by a trap from userspace or via ptrace, as is a vector length configuration. The two cases should already be prevented from running simultaneously, and can't simultaneously perform two actions. --tUbDFipGxi8zU7ey Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmRslT4ACgkQJNaLcl1U h9A16Af8DEHdwYbxzAGJWh0art8EcInVylPkg10slrjsYkGzxsElEhGfBJadP853 Q8eenp8r+T1Mp8y1gxa5C6kzU+Zgv3k8QkaOuZ6WJoXuH5iB57pHeRiakeaXyEqF RGze2TlhPN5ztgkNxllH4arDKvzxrPr/r3DuZRYOLTDLiEvCbVeZ4ev43K8Fu12x X5vhL+s0ZAHTIzN/SLwLW2LMF3fBSbYg/zBBcuLFy7aaGtQpNvAKD3g1YpdoQnIR nvciW+LV1Oi0/gW3Pl/1bG8PxBFDhAHVj50DDuWpo2oQ7qKVxQXnnj1ogS6FCpa6 rnW5/mie6Z3vvMnDnFexfq5+dM7nGg== =y/eH -----END PGP SIGNATURE----- --tUbDFipGxi8zU7ey--