Received: by 10.223.185.116 with SMTP id b49csp2233208wrg; Thu, 15 Feb 2018 08:29:36 -0800 (PST) X-Google-Smtp-Source: AH8x224fjL9OOpRLEb0S+HdegCI0U/Qewu0xfSTRNErRZrAue2GLSEynnkIpoQS72VhI5StNWBsj X-Received: by 10.98.161.7 with SMTP id b7mr3174864pff.68.1518712176019; Thu, 15 Feb 2018 08:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518712175; cv=none; d=google.com; s=arc-20160816; b=pFD6B3izQ0RJQ/ow3SvvfWgD3Jydk1JfJYlea3jfxQqFq9ZshvAJ9V1uz3nlDD6RPD BLMXss4JBDn0DWavJxDRPoO+UajT56dMUW+bbVVEZZdWLchomiggNPpRfHGDSF0Jruw7 4OjpHhCnb+kHV776OPO+vXoSTVsX1ijt9u3sBIOZTWdrZ0CAs2YD7/RoyP1gsYAYnvPb gO4omn9L8thYUEChcfFch+sHDO01wu+WLyQvGm0q0PdrfSQoJYEr1G8zvzSE8qBG8kMu +6irt3OjSY5G4p1wZeam3HmubB+nwZnZcT8HlQ8+yM4SD2kvyoSPXilaEYCSRHkfhYGh IYcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rPWffbwFQlGkxi+AHCWHAVqK/g7ck5daxcHldF8CQOw=; b=ke9Cxr4NyOAvaTYDhG+BoCRCTFNCjh3N35v5oEoM59rPKjXlpQ/MYk/H5nae8JMjca et7LZih2up44Kk0RRL9mvdnrPd6MqMGuH5W6iYt6GdlFHNtquKSKdv+cUKxwzktmuCIE 5H1g+LWIYsUvHQePri69b1fQ3ZZnydMtldqBFSqaTk4gd2vxtd2YVLjpMWEqARmTR+qW 2MPU0G/cWcGCtzv24tDSowsYsfSgl1cSxR/cg0YRrGFp12FG/s7pwvkE9shxIetDNnrj 9eyT9OclpcUNQQmWcPz4kJPUMeu7zeDdt7R7Sj8Qb7h492ClXdq8BV3N6oABlMG21n1m jdbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si71416plo.2.2018.02.15.08.29.19; Thu, 15 Feb 2018 08:29:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424225AbeBOPmp (ORCPT + 99 others); Thu, 15 Feb 2018 10:42:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33406 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424093AbeBOPmm (ORCPT ); Thu, 15 Feb 2018 10:42:42 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 156321076; Thu, 15 Feb 2018 15:42:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Will Deacon , Catalin Marinas Subject: [PATCH 4.15 045/202] [Variant 3/Meltdown] arm64: Force KPTI to be disabled on Cavium ThunderX Date: Thu, 15 Feb 2018 16:15:45 +0100 Message-Id: <20180215151715.543034010@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier Commit 6dc52b15c4a4 upstream. Cavium ThunderX's erratum 27456 results in a corruption of icache entries that are loaded from memory that is mapped as non-global (i.e. ASID-tagged). As KPTI is based on memory being mapped non-global, let's prevent it from kicking in if this erratum is detected. Signed-off-by: Marc Zyngier [will: Update comment] Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpufeature.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -853,12 +853,23 @@ static int __kpti_forced; /* 0: not forc static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, int __unused) { + char const *str = "command line option"; u64 pfr0 = read_sanitised_ftr_reg(SYS_ID_AA64PFR0_EL1); - /* Forced on command line? */ + /* + * For reasons that aren't entirely clear, enabling KPTI on Cavium + * ThunderX leads to apparent I-cache corruption of kernel text, which + * ends as well as you might imagine. Don't even try. + */ + if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456)) { + str = "ARM64_WORKAROUND_CAVIUM_27456"; + __kpti_forced = -1; + } + + /* Forced? */ if (__kpti_forced) { - pr_info_once("kernel page table isolation forced %s by command line option\n", - __kpti_forced > 0 ? "ON" : "OFF"); + pr_info_once("kernel page table isolation forced %s by %s\n", + __kpti_forced > 0 ? "ON" : "OFF", str); return __kpti_forced > 0; }