Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2653795rwo; Thu, 3 Aug 2023 12:43:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg2h2qeqn2+C+MDnF2G6Mm3IC5UpOCH2WjXpNaz3nKsl5CuUv3pvWX20Q2MQqc1SuxecE5 X-Received: by 2002:a05:6870:c155:b0:1bf:8c9a:9a2f with SMTP id g21-20020a056870c15500b001bf8c9a9a2fmr1537227oad.25.1691091790789; Thu, 03 Aug 2023 12:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691091790; cv=none; d=google.com; s=arc-20160816; b=l+2N1gAdq3/wBaGzWc9ErllsjCZNymGqyWc3OuKxfzx59G6/Ek2S7Q9ng/O6bpKaM7 0PVF8rPPSd6TMH3hMjpLVeIheFNqEQTXoty+Ah8k9ZYKMtMPasiuBr5LOmE6lzgGHfNX kNqzsREHGmb7AG1xRD3RL8ooWO18H6K3MW0VhbywMOgxx4WqbOLlys/dpOSkZ/TEB7F/ ZcYIONY2+O9LtjxOliTovKPhv8UyGqGoGzgu3wigdbKqsVKf/0vSSJN2t6MkouBhiSeD t7BCbuSOB7lkZcPGMcSUrzY/J1THNf24NPI6cqTeHxL5CUTunfp5SUjh6Eog91MH6d20 ShjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=FOo27g6OGBz1yXIwui27KoT9Qrgl2/Es4a/C7ZFLmss=; fh=y1YNzMTa0VBjj3s8pV4LY81EkGsSKa5rhSScGuGiy5w=; b=wWz9MN2ZoXH+roObPinG0Nl0omcwZ6DMOIreVUgwV/Z6yZlxb72CyovGQujlVDzYj6 VyR5CEgaUVcxA3OX4eJ0PRoGXy+VfKNJbuHAtC2ldc1faKR7ypGMq/1lXc07kWu4zp4L clD1bhRe0pwMIiXR0gEP4AIrnu8+rW5F7rterL2pg5faYcaufwkTIJ9owJ81jdl9r9vH /icwdVpbUYpilUHxSqZR7lf+tMbs4rgPGoNryoqpUiWoAYkTbcYPUuaUdj0HgLrdmby/ aUUpQ0/w+2Pifshb4bPDCKoeiud3py8MchjwSsRP5pr7N9JWA6RWefY6uyU26FzVSYE/ 3xxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iKhq/fj8"; 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 gc22-20020a17090b311600b0026923261e44si79504pjb.42.2023.08.03.12.42.55; Thu, 03 Aug 2023 12:43:10 -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="iKhq/fj8"; 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 S231972AbjHCSo0 (ORCPT + 99 others); Thu, 3 Aug 2023 14:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234018AbjHCSnj (ORCPT ); Thu, 3 Aug 2023 14:43:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BC926B2; Thu, 3 Aug 2023 11:43:17 -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 7F64A61EAA; Thu, 3 Aug 2023 18:42:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E9D4C433CA; Thu, 3 Aug 2023 18:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691088143; bh=95Dt53hR2pyBz39OJo3JRDWSs/xQPgCW4Y8m1VN2MTo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iKhq/fj8MaM0IEbTjBTPoJfjrkSC+hVn0SNJKfrodcO7wm+PSmBwo6mX9rS/4q+kH NGkaPQn3CV9peiWVaWBwzHzetYAdlJdIl1QwgHrQZ7KwHAcVYQP6c2KiEN9joGDv+a k5COH7hCFhp9SRu2HM++qTzRf6nNV9gXlOFtDmZYvYuRQv6a5x4YSpKCA3aS/5/Kdh G7v/O+d/MIuFI4f+/xM2jWRLO4DnV2WOVJUyvIPcSxvKuTHJA1HBwkCEbakQeA5mea ShpqaBq1fA6hXTCvv3Sn2TEJqIOFhhFNMP+9P5o/+NgSqLuVc4CKPzt0qoKNkzOzrs yyg+HG9Ip8H9Q== From: Mark Brown Date: Thu, 03 Aug 2023 19:33:23 +0100 Subject: [PATCH 3/3] arm64/fpsimd: Sync and zero pad FPSIMD state for streaming SVE MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230803-arm64-fix-ptrace-ssve-no-sve-v1-3-49df214bfb3e@kernel.org> References: <20230803-arm64-fix-ptrace-ssve-no-sve-v1-0-49df214bfb3e@kernel.org> In-Reply-To: <20230803-arm64-fix-ptrace-ssve-no-sve-v1-0-49df214bfb3e@kernel.org> To: Oleg Nesterov , Catalin Marinas , Will Deacon Cc: David Spickett , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Brown , stable@vger.kernel.org X-Mailer: b4 0.13-dev-034f2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1255; i=broonie@kernel.org; h=from:subject:message-id; bh=95Dt53hR2pyBz39OJo3JRDWSs/xQPgCW4Y8m1VN2MTo=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBky/UG59zUDvfiprOkSFdpvtR91Bq9XADckhG2g6Sc jiCzcImJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZMv1BgAKCRAk1otyXVSH0GTVB/ 9J8/zx7cdkXvm4pbhhG5E4Heen6fPAuF/GNuXHVhmgPYd/qRn9HZz93uR4OlhvCIkfOcMDsRWZVXZT XBjRbHU3zKf/+1X+diJZf22raEPYoYjwJK3EeRQkYjPMHz1DZQu1aPoposJKxxDDgNkzdRqNDSfFOp pxF2WiEK0O7hgXtI6r4Nx3OVHgw0oDATOC60HggBmXODZWQIzOpRvvFhgmBDm/F2mpje6VduU3dS/Y 6mUk3H4BLWwd64hpSiQfc70nAcG4BzcIoE0JItmKd4n2CZd4tVVqSs5AEdat3g61cwd1vYIyzZ92wB QcpSFIZpyStyDkPGwIe0m3j4ZOkhG2 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB 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 We have a function sve_sync_from_fpsimd_zeropad() which is used by the ptrace code to update the SVE state when the user writes to the the FPSIMD register set. Currently this checks that the task has SVE enabled but this will miss updates for tasks which have streaming SVE enabled if SVE has not been enabled for the thread, also do the conversion if the task has streaming SVE enabled. Fixes: e12310a0d30 ("arm64/sme: Implement ptrace support for streaming mode SVE registers") Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- arch/arm64/kernel/fpsimd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index b4afa0d147cc..8e8b853da616 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -835,7 +835,8 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task) void *sst = task->thread.sve_state; struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state; - if (!test_tsk_thread_flag(task, TIF_SVE)) + if (!test_tsk_thread_flag(task, TIF_SVE) && + !thread_sm_enabled(&task->thread)) return; vq = sve_vq_from_vl(thread_get_cur_vl(&task->thread)); -- 2.30.2