Message ID | 20230621-arm64-fix-tpidr2-signal-restore-v1-1-b6d9e584d2ee@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 06B05EB64D8 for <linux-arm-kernel@archiver.kernel.org>; Wed, 21 Jun 2023 21:01:58 +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=h1j7dutURxQJpoWsEaij8HZzrYgG46+YFnHYm7TyGFY=; b=zr/B+lAnqP0xLI x3toNfESwvhTmbmOR7BlKFCekFlHMvmlx2UpKQ/aVFzZL2SrqTgU1GLkevzHyniQ73A4QRFTPbj7v 1XHKEGKDJWuaV79Xp3iDb0FYja2ZrZF6wE1WgeY0xQsT3aFSlmwZVKpjytcE62E+hApPOrqQdlfgA MoaQ6JVAGH23cqnkUhyuhadHwxkWmxuPM2rl63GqA8mW1XRuGp5TY9mhrTyqWI1k0eJb8+OGK2Tpa X0vyvsHIlf2S3rD7zRLEdUOzSyllKB0g6jv/EEl3dQ8xDVl2wkkESDWHt4SBJlAlctC5m36tPe/Bf I6H8QabsWXo9AbF02UEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qC4xH-00Fjin-1O; Wed, 21 Jun 2023 21:01:31 +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 1qC4x7-00FjfL-2r for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 21:01:23 +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 32A15616D7; Wed, 21 Jun 2023 21:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03452C433CC; Wed, 21 Jun 2023 21:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687381280; bh=w8fxWAGiQaBMUkDFhDb0uejIT4OUWJBakDRMQaptQUc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JiOVv+OUQ+GiSChpM3EbH//sZ9SW/cdtlVUBmlB99xwHurGA0IB21aX7NtIRBVSZv 2jKP7BjYYD1wBUJZLHrHJTJ/b/RTQBMaWWaIDcW53eOdLIPOAdxBBJyHDvaZ8n6TuW dGN/toXoCWf7+mkPVWJ8oAiQFylGAiD6jzKC3OIwLsXYxw6t8o1Kt7kQlNcT1d+UKg wqnom1XH2Fi2tCZKhsw3uVDQLXhGLMXPER8bXSYdIpSANkUQJbaUrxVLn3dst3D4tt /e1/sHNVzBLhAIei9oR5TY9HVRiMiHdV3fOe70AMOQSBiVYa06ZhZ1YO5NCOGdog0c kZLPLDYFbYRfA== From: Mark Brown <broonie@kernel.org> Date: Wed, 21 Jun 2023 22:00:50 +0100 Subject: [PATCH 1/2] arm64/signal: Restore TPIDR2 register rather than memory state MIME-Version: 1.0 Message-Id: <20230621-arm64-fix-tpidr2-signal-restore-v1-1-b6d9e584d2ee@kernel.org> References: <20230621-arm64-fix-tpidr2-signal-restore-v1-0-b6d9e584d2ee@kernel.org> In-Reply-To: <20230621-arm64-fix-tpidr2-signal-restore-v1-0-b6d9e584d2ee@kernel.org> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>, Szabolcs Nagy <szabolcs.nagy@arm.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown <broonie@kernel.org>, stable@vger.kernel.org X-Mailer: b4 0.13-dev-c6835 X-Developer-Signature: v=1; a=openpgp-sha256; l=1250; i=broonie@kernel.org; h=from:subject:message-id; bh=w8fxWAGiQaBMUkDFhDb0uejIT4OUWJBakDRMQaptQUc=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkk2UbS0wOwkAWAp+qIYM0ZvfglKPKPUmMPK3OciMF ig54HByJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZJNlGwAKCRAk1otyXVSH0DnFB/ 4/OhOmCaDtC6BJBtGVnMSAH2V/hCabEzZqI5wEeh/K/BHoRw1ks+XiL+wU7BQN/R7oPfqZ4ZQhhezM WDK7HxpI2KN0XyMv3+VL5chk/LRbh6Jy3HZ5X8Y0YD740T/dcxfIwgggIo7Fea0swkXBHoGv6M/U1R VFujmezrE/NAJqhbmW5pNHYI2N7FG8/fkMjP8XdQDgc7MT2izYSFqqbq9iV1v5ZVMeycuTTluQYD+B +5tR1HhYZ2HjNjPnXn74D8ZsHJmjFlQEL+MZkIVood5WkIk4nCXlQm9ocmQTm9JBpuKuXy4SX9iuEu Uhs/mS5LhHoy+mPTGWqdTUXMiDyJzz 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-20230621_140121_965292_B178BA3A X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64/signal: Fix handling of TPIDR2
|
expand
|
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 2cfc810d0a5b..10b407672c42 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -398,7 +398,7 @@ static int restore_tpidr2_context(struct user_ctxs *user) __get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err); if (!err) - current->thread.tpidr2_el0 = tpidr2_el0; + write_sysreg_s(tpidr2_el0, SYS_TPIDR2_EL0); return err; }
Currently when restoring the TPIDR2 signal context we set the new value from the signal frame in the thread data structure but not the register, following the pattern for the rest of the data we are restoring. This does not work in the case of TPIDR2, the register always has the value for the current task. This means that either we return to userspace and ignore the new value or we context switch and save the register value on top of the newly restored value. Load the value from the signal context into the register instead. Fixes: 39e54499280f ("arm64/signal: Include TPIDR2 in the signal context") Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org --- arch/arm64/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)