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 AEC22C433F5 for ; Mon, 28 Mar 2022 13:53:50 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JejWIHMuXwaNnRnr/Li/C9y1vbe+0s/oLdP1dA52yyQ=; b=dnKRN/fTtvp62I v01rhZa5OxaLpNXOlp+Ir6WrRcoFSuvN6hUnx48pqIM8WoE/inlnyWAv0hq8Ap9oM/lr/g6+dhkVs mbRBR5VEtvNg+m5ne7au2+2G83i1N2HYd+FiJ2SPa+TD9n5E8IDRRwTEycSrTiLvu5etDkZJyEIhR SZ+GSOfVF0sxjIJiRx/z/FrpZFu++20oigdKgaDo4WMJ1u3C1Sr0wpzqOxUxXP9pUBP2AsaIsa4F7 2pOqzYH5oy4m1dgH/Mv5p4Y5RruqzHd6+QkxyAg4Bz2VIGhrMNus3YLVGh8LaDAZN1ZjfT8cZR7rM cln3qw81n3UOm6s432TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYpnI-008vQt-U2; Mon, 28 Mar 2022 13:52:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYpiV-008tWj-Dc for linux-arm-kernel@lists.infradead.org; Mon, 28 Mar 2022 13:47:35 +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 7B1CE61197; Mon, 28 Mar 2022 13:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B690DC004DD; Mon, 28 Mar 2022 13:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648475249; bh=Gt5jbJeNVwHMPLNq8hAlJ8KAPfofAahjl9HI2TEJpEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twxIzTX89vltvlMt1woOwN1oIdVFcIp9zsPOQb3288G/qXfD7ah3K87+5MiUbNndK MnwwlgaWG58mDg9pb/mpMg4yxacNHJewsq3/MwKYmrUnk1SNGF8++0hFiCUwi1BLxX HWagBqaj+3sp7dA12txnGbf4c0AiPFwSWrx+ktYKW9Rb3XDA5LrbsATLB+MbBga2Wn 7bNil9DEbxwzynsr5WPlA6tGEuNh7Cm6Z5F3rnk9Pg1pOe1v2mkxjZItUIxU6skdQZ HLO4PdC+ggLjx4+t3CUNb5y2kdNbt3kce5NFx8xC/iJCqTlAadqGren6M71/UqiQux k6qy0FyOx+3jw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: arnd@arndb.de, linus.walleij@linaro.org, Ard Biesheuvel Subject: [PATCH 3/6] ARM: spectre-bhb: simplify BPIALL vector macro Date: Mon, 28 Mar 2022 15:47:11 +0200 Message-Id: <20220328134714.205342-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220328134714.205342-1-ardb@kernel.org> References: <20220328134714.205342-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1554; h=from:subject; bh=Gt5jbJeNVwHMPLNq8hAlJ8KAPfofAahjl9HI2TEJpEc=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBiQbxcg2iODNttKLnRNje1pmEcPaWPwYCr1QBDkvwn nqiFODmJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYkG8XAAKCRDDTyI5ktmPJHViDA Cye4k537ds/iUJTncbljVjvIBF9PiFLRGDD0L89Qv8Y5PHgN+HvOyPhgZyUAnVH1qN1SPag8FsoTxK YWTMPgyuFoW4+MzIJns6lyCvB1R3LXjsZATEP+ib3yMsH3j5VdVTo99SpMcxHZbRHGWhnDUo4FqEkk uHJ98cRMYnGtj7TqIVFgbo7nvkMlSigTnryucnF6MXiUn8uIpTWOzHvHaAvov917yYXrDb7nlILlDa qH8fDeXYrSrjGC+rK/KLLpyqHB6ilHwdB2dBhAecTV7IdM/LqCMIEWQB3eir7eYD2PkOpgWjvgYgQf HO2jmTPmv4jOMrop+hUeuAfTRSHAllIjdOOSYK4FhP1s+0WDe7woJlc/P9bTXrk6fDSzISk+ph5GsR wg/NnumrM+B7YmMZfuLYqqGPoK1G/DymWlwfUXG2Zf7zzV9eXJ1qU4hBRBwb/pT021usIppBHEqbbh XtDzQ/enuKEq+dyto/T7B/O92T4YGJWb7GOSlIsALSGmE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220328_064731_573241_C7C8D566 X-CRM114-Status: GOOD ( 10.61 ) 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 The BPIALL mitigation for Spectre-BHB adds a single instruction to the handler sequence that doesn't clobber any registers. Given that these sequences are 10 instructions long, they don't fit neatly into a cacheline anyway, so we can simply move that single instruction to the start of it, and rearrange the symbol names accordingly. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/entry-armv.S | 21 ++++++-------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 4bbd92d41031..a5725e82addc 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -996,6 +996,12 @@ __kuser_helper_end: */ .macro vector_stub, name, mode, correction=0 .align 5 +#ifdef CONFIG_HARDEN_BRANCH_HISTORY +vector_bhb_bpiall_\name: + mcr p15, 0, r0, c7, c5, 6 @ BPIALL + @ isb not needed due to "movs pc, lr" in the vector stub + @ which gives a "context synchronisation". +#endif vector_\name: .if \correction @@ -1047,21 +1053,6 @@ vector_bhb_loop8_\name: isb b 2b ENDPROC(vector_bhb_loop8_\name) - -vector_bhb_bpiall_\name: - .if \correction - sub lr, lr, #\correction - .endif - - @ Save r0, lr_ (parent PC) - stmia sp, {r0, lr} - - @ bhb workaround - mcr p15, 0, r0, c7, c5, 6 @ BPIALL - @ isb not needed due to "movs pc, lr" in the vector stub - @ which gives a "context synchronisation". - b 2b -ENDPROC(vector_bhb_bpiall_\name) .previous #endif -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel