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 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 DCA46EB64D8 for ; Thu, 22 Jun 2023 13:40:29 +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=CeMjnw0UfZ74P9 lS5avGSjFIrKh1MTKI+dwBZqhs55rDIMpV9eQL96KBCifH4fNbCYYlPK0wBKZKHMzjvbn8wZ6utVM I6TACeTucNRzc2KUklAGK4sTPhDdzbP1duaCwD/IylEizNX35HdPTRpeLHcC6hvLPpjY1T/1vsR9p 9MPUMg+iY88w/9yHI+s4pNbpiuysEWjpI002b7k8qHwqoQTfkccIUi4Z94q2udWPVtNK8Jsy6EVUM Vndnqco4NItLSF054G9L8tBtKLknBvR4AvoIRKV++Us83favamGdNSTCdBcwsogeQgFoara8HzbQL 8bEqlDH6m7G7LRqx8qqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCKXe-000oZC-2R; Thu, 22 Jun 2023 13:40:06 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCKXb-000oXv-38 for linux-arm-kernel@lists.infradead.org; Thu, 22 Jun 2023 13:40:05 +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 4E70761831; Thu, 22 Jun 2023 13:40:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A17C433CC; Thu, 22 Jun 2023 13:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687441202; bh=w8fxWAGiQaBMUkDFhDb0uejIT4OUWJBakDRMQaptQUc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iICu2phPR5ILZG7JI+68q0+Ns20bNqyrhvhMml5d1wdZUjJIv++BCVrkuNLIDBWdt Kd20yWMwj+Dga0597jCavM6zRC4YX2QQBwy7sJsOBxGH4Sn6RLqwHv/b1evHSWIwQr Vvzl7D0C9M/k+2WEDmAG4EtSyLHUnnFIr1IQegTJXtK9mZ82SNPw5THJH9/FMAgQXH WGXWTaqIbQ8tG4UF5qObRfLwG4RRRxci7Pdvxiii/6Is5GNiD2mEomUesEHkn7QEnI I9L4amYoZMYfzQRlZECyjtWYCRe/wp1ZgqrWgAuqrTU/9BbRgBPt6zi9ZzPJT+owK1 oVn511dFpR3nQ== From: Mark Brown Date: Thu, 22 Jun 2023 14:39:45 +0100 Subject: [PATCH v2 1/2] arm64/signal: Restore TPIDR2 register rather than memory state MIME-Version: 1.0 Message-Id: <20230621-arm64-fix-tpidr2-signal-restore-v2-1-c8e8fcc10302@kernel.org> References: <20230621-arm64-fix-tpidr2-signal-restore-v2-0-c8e8fcc10302@kernel.org> In-Reply-To: <20230621-arm64-fix-tpidr2-signal-restore-v2-0-c8e8fcc10302@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan , Szabolcs Nagy Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown , 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/pANAwAKASTWi3JdVIfQAcsmYgBklE8nsYvELF3WpfKfmByc+fGAeLNPcr9NAY5/8CsN LVvdDDuJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZJRPJwAKCRAk1otyXVSH0KBhB/ 473Gq3ZQ6893sd0piLda7UZJYhhBVNu0fwedBuDBuNgvNMdK0H3wXVUYvCW9jNcR15aSIZS/pq7kU3 8URMlQX/Z3hg3mls6Rq4kAmBU26Z/ZaX1P9Q1mcVp+MWL/W6xzcN27KBFS+5nIWPX6tgpLMmVAMnep Sypvldcx/pJRVAfX5wnHWPfQ35s2NEPO+mfTDSsOh5lvsOq3KJ0KISzk3k1R6X7MCbXB6ZxVoKl7sg EzoiSrSssf+NLXLIom2bKAeEnYVN+aO+T9bF0MKAPteCBs9Am8fNNY4VBsqaD40r3LNfdl3yO2byUn Ugs8AZ/DZYuXXkxiMZmhsbq+06e+oe 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-20230622_064004_049303_596A91D4 X-CRM114-Status: GOOD ( 16.12 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Cc: stable@vger.kernel.org --- arch/arm64/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel