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 D6A58C433EF for ; Thu, 16 Dec 2021 19:54:15 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F24LcMVSZ4To/EGwE9xf5zxhjAeQN6/luFAkXgGEoVc=; b=dsug9K3jqIFC70bXy+hbfOfLjh Xh8yZUxuG2D+T+pocNHMxOeEe8r3rCPjvt1WWaF5rk6v3U0UqwXrRJsmxYtk497X3o9sjKBD1bAsp rBOWjsHoVX94xshMvw/YSsx/fBNz1yp3i8HSg6QZSVIc0nXZX2tGfaEDTSd3CESIjfu70uZuSznnM Bnkfpp6JZwK6slhaQIeRO1BIWLfFKac9Q5vdXyANpFnzl1/CJgfxW+4n5oSWqbZLpwQWvj0Wum4Xi c1x05EAjJlCDb/13/0hsMij8iSTKrCK37qzApUEZb6C6LTil13ODGk1HPcQPphCYJmFfGc21P4Luf jONucA9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxwoA-007OIK-7T; Thu, 16 Dec 2021 19:52:54 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxwo6-007OHH-A8 for linux-arm-kernel@lists.infradead.org; Thu, 16 Dec 2021 19:52:51 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 326A761F56; Thu, 16 Dec 2021 19:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B351C36AE8; Thu, 16 Dec 2021 19:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639684366; bh=DdyFEXpPgowIoxK9D2O0sssnSAz/Zh5lHJfWf9iTjdQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HKDQqUPjVMC/0tOS2KsUQHFvgPrpC717mh69I281xFmwzyruocaukYEt241AKwz7B NmTd+jBdt9S6QqL8tALEuCGSo0w3tk3DeziPKZPUh4i9/SU2ZK6dlll46bESTaS43D zMlRf0i/+JEL+Yni0YEZ16P4KiGkNDSyQof9R/tGOAHAnWtnXl4GAQuujqrQRECQuh fnQDBLhU6v1RC5n7Rpsv2Uc66YKaFPybNN/gnjqPQloassmDs4SOjjaw7Is6d6d8W5 8uOOx2hssbbxzydmCISr9jZ/d1POXN/jdPYYXdAhM0KEqvZ/Yto646iImapPw6p6KJ bTcEJ9F2J0/QQ== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mxwo0-00CdoN-JT; Thu, 16 Dec 2021 19:52:44 +0000 MIME-Version: 1.0 Date: Thu, 16 Dec 2021 19:52:44 +0000 From: Marc Zyngier To: D Scott Phillips Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Darren Hart , patches@amperecomputing.com Subject: Re: [PATCH v2] arm64: errata: Fix exec handling in erratum 1418040 workaround In-Reply-To: <20211216191618.972956-1-scott@os.amperecomputing.com> References: <20211216191618.972956-1-scott@os.amperecomputing.com> User-Agent: Roundcube Webmail/1.4.12 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: scott@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, will@kernel.org, darren@os.amperecomputing.com, patches@amperecomputing.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211216_115250_460333_2786EDD9 X-CRM114-Status: GOOD ( 16.64 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-12-16 19:16, D Scott Phillips wrote: > The erratum 1418040 workaround changes vct access trapping when > switching > between compat and non-compat threads. The workaround logic assumes > that > the hardware vct trapping state matches the previous task's > compat-ness. > However, when a non-compat task execs a compat binary or vice versa, > the > cntkctl state and task compat-ness get out of sync. Keep the hardware > trapping state in sync with the task personality. > > Fixes: d49f7d7376d0 ("arm64: Move handling of erratum 1418040 into C > code") > Signed-off-by: D Scott Phillips > Reviewed-by: Marc Zyngier > Cc: # 5.4.x > --- > > v2: - Use sysreg_clear_set instead of open coding (Marc) > - guard this_cpu_has_cap() check under IS_ENABLED() to avoid tons > of > WARN_ON(preemptible()) when built with > !CONFIG_ARM64_ERRATUM_1418040 Indeed. > arch/arm64/include/asm/elf.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/elf.h > b/arch/arm64/include/asm/elf.h > index 97932fbf973d..24036b914226 100644 > --- a/arch/arm64/include/asm/elf.h > +++ b/arch/arm64/include/asm/elf.h > @@ -160,8 +160,16 @@ typedef struct user_fpsimd_state elf_fpregset_t; > > #define SET_PERSONALITY(ex) \ > ({ \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) \ > + preempt_disable(); \ > clear_thread_flag(TIF_32BIT); \ > current->personality &= ~READ_IMPLIES_EXEC; \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) { \ > + if (this_cpu_has_cap(ARM64_WORKAROUND_1418040)) \ Probably better written as: if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) && this_cpu_has_cap(ARM64_WORKAROUND_1418040)) sysreg_clear_set(...); Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel