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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F32FC6194 for ; Fri, 8 Nov 2019 12:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1790A22459 for ; Fri, 8 Nov 2019 12:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573216651; bh=Ca+swxUne5094XJJEE7lFqR5cpfTzFMekV2HDV41a+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QgHsjCBv9wXYqdIwfjwAbZfSHusoNXh2ds4n2v4ApN/1n8byc7OL6kceAY4a4GUim SY6nklQPSBAuUBhdhSJgptFYiIciHG3uCfKYmOTPIfSNCRxS4GeeSunstl2HDCh1Pw TtMa2unuQycmZUxk1I57aWIWg4RjzBF+DOBbrYR8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbfKHMha (ORCPT ); Fri, 8 Nov 2019 07:37:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:45140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfKHMha (ORCPT ); Fri, 8 Nov 2019 07:37:30 -0500 Received: from localhost.localdomain (lfbn-mar-1-550-151.w90-118.abo.wanadoo.fr [90.118.131.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB96E224BF; Fri, 8 Nov 2019 12:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573216649; bh=Ca+swxUne5094XJJEE7lFqR5cpfTzFMekV2HDV41a+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c6DF3qB2QX5Y8REFzQqyll3kvJlKx/zreDBF1kWTx6aBR5hrwaCNPWWeEgcqQCYG4 dEbrNAfWISglNG96xTE7PCSJlZEkKdPR5SIGS2ikskAgZBsC+fRpm4txFOlqzJ8Q1K 5rrd/gZUsBl1LNTi943OOWXQGorCiDtoqmrZVBUU= From: Ard Biesheuvel To: stable@vger.kernel.org Cc: linus.walleij@linaro.org, rmk+kernel@armlinux.org.uk, Ard Biesheuvel Subject: [PATCH for-stable-4.4 49/50] ARM: ensure that processor vtables is not lost after boot Date: Fri, 8 Nov 2019 13:35:53 +0100 Message-Id: <20191108123554.29004-50-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191108123554.29004-1-ardb@kernel.org> References: <20191108123554.29004-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Russell King Commit 3a4d0c2172bcf15b7a3d9d498b2b355f9864286b upstream. Marek Szyprowski reported problems with CPU hotplug in current kernels. This was tracked down to the processor vtables being located in an init section, and therefore discarded after kernel boot, despite being required after boot to properly initialise the non-boot CPUs. Arrange for these tables to end up in .rodata when required. Reported-by: Marek Szyprowski Tested-by: Krzysztof Kozlowski Fixes: 383fb3ee8024 ("ARM: spectre-v2: per-CPU vtables to work around big.Little systems") Signed-off-by: Russell King Signed-off-by: David A. Long Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin Signed-off-by: Ard Biesheuvel --- arch/arm/mm/proc-macros.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 212147c78f4b..d36a283b4099 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -259,6 +259,13 @@ .endm .macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 +/* + * If we are building for big.Little with branch predictor hardening, + * we need the processor function tables to remain available after boot. + */ +#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .section ".rodata" +#endif .type \name\()_processor_functions, #object .align 2 ENTRY(\name\()_processor_functions) @@ -294,6 +301,9 @@ ENTRY(\name\()_processor_functions) .endif .size \name\()_processor_functions, . - \name\()_processor_functions +#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .previous +#endif .endm .macro define_cache_functions name:req -- 2.20.1