From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57876EB64DD for ; Wed, 9 Aug 2023 09:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjHIJHr (ORCPT ); Wed, 9 Aug 2023 05:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjHIJHq (ORCPT ); Wed, 9 Aug 2023 05:07:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552D51BD9 for ; Wed, 9 Aug 2023 02:07:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E842B6307D for ; Wed, 9 Aug 2023 09:07:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E74EC433C8; Wed, 9 Aug 2023 09:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1691572065; bh=3YU0iEyzKdvhUIE3UCOAD5CZpwKhDxR+e6WQeekyLv4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I7z5DAssWTsYT6y2YBPn7jEqWUDca+1cKYmFdwe0jKIRuPmFk4k/Ne7IepG/3KOYY eN8xZ7tgnCuC+wPY04CA6GCbHch4JBeAI185hqI71B/Zgeg6jfPfiLdbhGicdcPMpY fsC1MY77/sm123TR3LWsaW3o8PfFmdNi6h+bjogc= Date: Wed, 9 Aug 2023 11:07:42 +0200 From: Greg KH To: Mark Brown Cc: stable@vger.kernel.org, Catalin Marinas Subject: Re: [PATCH 6.1.y] arm64/ptrace: Don't enable SVE when setting streaming SVE Message-ID: <2023080934-doorstep-afraid-cb52@gregkh> References: <2023080713-schedule-tuition-b3a5@gregkh> <20230807195634.309031-1-broonie@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230807195634.309031-1-broonie@kernel.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Aug 07, 2023 at 08:56:33PM +0100, Mark Brown wrote: > Systems which implement SME without also implementing SVE are > architecturally valid but were not initially supported by the kernel, > unfortunately we missed one issue in the ptrace code. > > The SVE register setting code is shared between SVE and streaming mode > SVE. When we set full SVE register state we currently enable TIF_SVE > unconditionally, in the case where streaming SVE is being configured on a > system that supports vanilla SVE this is not an issue since we always > initialise enough state for both vector lengths but on a system which only > support SME it will result in us attempting to restore the SVE vector > length after having set streaming SVE registers. > > Fix this by making the enabling of SVE conditional on setting SVE vector > state. If we set streaming SVE state and SVE was not already enabled this > will result in a SVE access trap on next use of normal SVE, this will cause > us to flush our register state but this is fine since the only way to > trigger a SVE access trap would be to exit streaming mode which will cause > the in register state to be flushed anyway. > > Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers") > Signed-off-by: Mark Brown > Cc: stable@vger.kernel.org > Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-ssve-no-sve-v1-1-49df214bfb3e@kernel.org > Signed-off-by: Catalin Marinas > (cherry picked from commit 045aecdfcb2e060db142d83a0f4082380c465d2c) > [Fix up backport -- broonie] > Signed-off-by: Mark Brown Now queued up, thanks. greg k-h