From patchwork Thu Aug 3 18:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13340746 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13016EB64DD for ; Thu, 3 Aug 2023 18:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X0FxTidUWkKOBaNFrbFE1sHBAvfIqO+WFrpOrdC+lzM=; b=1RBYJm6EgszCg+ 8Wr0n/+EL1IX9dDk/mbueHRvI9LeU4lFZRG/ThuxYVAXozmTDgRKCFdbG8mww66vYT7Wu7x4YnoTs ZBF4ukQig+C9qBh7NDunEIdv8xr1JJmJ4tIhbiAh4i/iui67yomzz1bgACZZ4YbthvYS7FlY5WQo1 x4XUzKL7gd3v8y7i5dzDID5qPkNKuBZwtWX9aZ1/HeiSGX1Y5E0qnVK7GDI76KeUfDT6Q51OHpWVt ScyXhOU1y1PomRPNYs+LCr6kRlQ76NqNKaDcT/wVqp2bxYYvVRJsjIdOyIEJnkYTphgqum26SePUv 55pezc2oIgs2nrVYNuIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHs-00AeG8-1R; Thu, 03 Aug 2023 18:43:04 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHA-00AdRK-36 for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 18:42:22 +0000 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 33B7561E7D; Thu, 3 Aug 2023 18:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D220BC433C9; Thu, 3 Aug 2023 18:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691088139; bh=Q6O8ubzpvyVkC7Ej05HHTMDmMzaSvsK+JutbFIX5e0s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kbZKyYeaOPPCdZwv7ubKCh30NYJEYWQwYEs4BlcmwX/AG14B7B6ct/NmSi0zbpqsx OVyotPmnROQN6BVOA3z8VZId3WESsSfGApoeqc+H7yJ/sHo5AiFx9k5QeyRfZt+EyF hlGi0RfK8daFyAL1olp5gPwXJavKRZ5KPaT451qbPWWSjaV37nLiMluN3KQojMhAQg ZCIgjjxr1vO+6suD9s6qPMcql75EfBIgE2Z+8/QjiuNUiU99XryURAkW1R200TDTaT pf91yjzszWJCzttRb+YnST1bQtYopbzyfT4MXlXvEloW8Ja3GM6hl/FpYVgaz6te20 AdlVJ3tGizmlA== From: Mark Brown Date: Thu, 03 Aug 2023 19:33:21 +0100 Subject: [PATCH 1/3] arm64/ptrace: Don't enable SVE when setting streaming SVE MIME-Version: 1.0 Message-Id: <20230803-arm64-fix-ptrace-ssve-no-sve-v1-1-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=2249; i=broonie@kernel.org; h=from:subject:message-id; bh=Q6O8ubzpvyVkC7Ej05HHTMDmMzaSvsK+JutbFIX5e0s=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBky/UEmwKiFjTRvpTlHWMHkQ3ykgHly+u9CiYxdtUF dR5Ms1GJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZMv1BAAKCRAk1otyXVSH0FFnB/ oDTbLZARptJWnKqqaplgnHepLKSsvOpQBNaEbXDpncgv2gLndEkIFNdsoOtoTlVUZ913ZFKFS47HsY rnG7oslf0LQHCR9yaGudN08M//nV399/8H6ScITDlRnBzZ10LSiPQDTlO6GQuChG5hGYRCpxXIjAqA aT4TQHHiEuesDQhMN0TkwVvc6qcVCZY/dtUvtE3k7yrs7REHhQgaWtaBAxBWO9VGiKVFUjq3bPohsW xu28lbFnYprLSi0sWEdIya02W/YR+7lzsVcwqXyr44JRusdNUDN6j0/WbgTgjrMpeRAmkkYOeAwy7H V7tFlkiySYs7gDWDM3uzOHoPVxHjNu X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_114221_137165_B762F64E X-CRM114-Status: GOOD ( 16.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: e12310a0d30 ("arm64/sme: Implement ptrace support for streaming mode SVE registers") Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- arch/arm64/kernel/ptrace.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index d7f4f0d1ae12..8a85dcc66597 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -932,11 +932,13 @@ static int sve_set_common(struct task_struct *target, /* * Ensure target->thread.sve_state is up to date with target's * FPSIMD regs, so that a short copyin leaves trailing - * registers unmodified. Always enable SVE even if going into - * streaming mode. + * registers unmodified. Only enable SVE if we are + * configuring normal SVE, a system with streaming SVE may not + * have normal SVE. */ fpsimd_sync_to_sve(target); - set_tsk_thread_flag(target, TIF_SVE); + if (type == ARM64_VEC_SVE) + set_tsk_thread_flag(target, TIF_SVE); target->thread.fp_type = FP_STATE_SVE; BUILD_BUG_ON(SVE_PT_SVE_OFFSET != sizeof(header)); From patchwork Thu Aug 3 18:33:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13340749 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A085FEB64DD for ; Thu, 3 Aug 2023 18:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3RMSNJcwWRihmTdnkQ+DFhE9yv+0boffZK3JYuOyFMU=; b=D4K2BSdmnrepWZ l6urEjuAZecK0er6hqbl+G8PTPMHHVApU6RGw93pO98bKDWjXTR6rN5l1n5BGf2jg+Q+w0JPZNEc5 4C4zIE2TWjhJDvusDZavtMODs8pp8tfE7xfe22ste/b3ggtVwcHjsVZBgd1g66huM+zSgcqnDdkVg 73rU/augK24IGJzZSz4ReJXpLebrkkhev/QIwGTO364K1yLaPZnyJUaGhh6Y+BIvWKugJTW1d6js1 hdS/QboalYikW8MkZBrjI0PQrdzn8L6SIR8nwIUfpNR53zfUKj5XmkxsmAu/JJ+b43VofQaaHL9sV /SdO3tfqIdp45mcOhPSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHt-00AeHE-1Z; Thu, 03 Aug 2023 18:43:05 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHD-00AdTU-0z for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 18:42:24 +0000 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 6F69261E98; Thu, 3 Aug 2023 18:42:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D58CC433CB; Thu, 3 Aug 2023 18:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691088141; bh=VyfjNO5h5r77yO4Y1JW8iCxzkIDFIM1fWR/4Pr5RYRg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PLCPxIk+rX4tVb1dQWIa7fuSns+Q05eQxvWW1pX9z4siJovRzdIkePyyZFfLatKwg OKjhAo4UeTFFBQl8ZqVXb+hivg4QBExi/Q1qkURhjOL8a9ElJiC1ouwgShjA1i2Fxf jmf/cvlP09V+cY6Jg0DdTJNPRW4GzRP7HwTgv5Cu8KKgRSDsPyEXnDRBwG5z86vwIs bg/NJCZ3hLg4KHoHshygIiVaCbkv2V2pkUBoTSkhzQ9rB+tTywray8lkcpbD2DaiEe X/LApfLG0zs7LmR2cjVTaQ6eu4oo0mRRWWLy/GIL2U1HZ/dTfw9FvKZq9OCLa7kONq aJmqThvOXaYcg== From: Mark Brown Date: Thu, 03 Aug 2023 19:33:22 +0100 Subject: [PATCH 2/3] arm64/fpsimd: Sync FPSIMD state with SVE for SME only systems MIME-Version: 1.0 Message-Id: <20230803-arm64-fix-ptrace-ssve-no-sve-v1-2-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=1318; i=broonie@kernel.org; h=from:subject:message-id; bh=VyfjNO5h5r77yO4Y1JW8iCxzkIDFIM1fWR/4Pr5RYRg=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBky/UFuHsJ06H3Tw69T76dXRohdyF0xpCyyRI8oCC/ d5fJ7SeJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZMv1BQAKCRAk1otyXVSH0DwkB/ wLdg/UyqGcamMN1NStA3gnuq4KUFkBMnOgGe0MR/DTXqKb4z5c4AXSdU+WQZ8iFVP1nNFtpPERUinw 4ePvcXEwRCtiLVET0UOMyq8C06RslgakCPJJ6OgSXVXA18uKXsNjZVnLorkwhvNay5Xwxi39v1OX/k RhczmRj2zdB9EACANJtldzSkwNjt82ambXoCiQKkUKIXl/AHUOnlNc47v95rO5+Orn+spJUQW6adk9 SjKPRalND+QtLZvjmssYZWZZ95FxdBoVPz1iIosAzsfSRp63NMTXCypaergImIVq+q/079uw4cWLC+ d5oJfnBr7baCUCEDWA7aOHdSUOJrIK X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_114223_469794_EEF09BCB X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently we guard FPSIMD/SVE state conversions with a check for the system supporting SVE but SME only systems may need to sync streaming mode SVE state so add a check for SME support too. These functions are only used by the ptrace code. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 520b681a07bb..b4afa0d147cc 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -679,7 +679,7 @@ static void fpsimd_to_sve(struct task_struct *task) void *sst = task->thread.sve_state; struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state; - if (!system_supports_sve()) + if (!system_supports_sve() && !system_supports_sme()) return; vq = sve_vq_from_vl(thread_get_cur_vl(&task->thread)); @@ -705,7 +705,7 @@ static void sve_to_fpsimd(struct task_struct *task) unsigned int i; __uint128_t const *p; - if (!system_supports_sve()) + if (!system_supports_sve() && !system_supports_sme()) return; vl = thread_get_cur_vl(&task->thread); From patchwork Thu Aug 3 18:33:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13340747 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2210C04A6A for ; Thu, 3 Aug 2023 18:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jrbyjEPMGy8PbNYhEeDkmgCcqCQqfQPlKmPxpMeFz40=; b=MANNCO4dV1Kl6E l52NHR+uA0++pGeZCn4FW6EAt6RvRj7yUa1KZS4KLEZT5kEjA78cH+UGLBa9G+mk8N5+NnhNeaspb aqfO51HHmwz8ikznUACDtRe5U+cIyVTD8PKCoyC+WwwE9zkZM5b6VaAQElBKsHqnWoTm6eNxAChNB AQPhOehLJ426yTaj/XNfplWbCMSxfAxS40ysag3yRIOYfFFY+1mvY706XphZCYkyQfj3e03BD2Axk qb7krHe6MCaPOnDSmNuyj6AM7RAIiaKR8Kkw42d3uXMSPd2g2/E9fXm/IISQkyrE+0RMYUNQXNgT1 D/WAGUK9jlvkWPuA3AFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHu-00AeIn-2D; Thu, 03 Aug 2023 18:43:06 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRdHG-00AdVz-0D for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 18:42:27 +0000 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 046B461EA4; Thu, 3 Aug 2023 18:42:25 +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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_114226_200570_17C1606A X-CRM114-Status: GOOD ( 15.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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));