Received: by 10.213.65.68 with SMTP id h4csp642737imn; Fri, 6 Apr 2018 06:39:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/64dXxcSat3wttfgYoOESNyHM5CUnusSb8XT3bEhHioC10YdABeHIJEmGZwxnJhqYbYScA X-Received: by 2002:a17:902:7084:: with SMTP id z4-v6mr28257427plk.395.1523021945054; Fri, 06 Apr 2018 06:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523021945; cv=none; d=google.com; s=arc-20160816; b=S7HCnYgjlkXtIt0UDnfwopNpk30PMDydf55+Eo2HMWUgRuQAMsPOUsnvdb4AOVPu8N pYe8PO7pEl9gQqDv/i4CluHozsNNuB0oVgvBDwA/oUD9GOTuxp3eVRCOav1363UuEvOd zDufBWwizb8jtzNnixcAnbV0uA/h+2WG2vvZmhSrrcNf+PMplSTyvwhWea1+2euYa47a lDhF5S5mJ2wt+QRlnwOoR7UiNmje74UkJUItLmYkcE0TH7/qpdUu9zsFaMuhCqVMe9gH /eV7k0M5/rL2ndvsMKUi8/TEZdysekn5r/J6RwFkoogP/R4OToAb4yqy59QtiWUEFgPN E9SQ== 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=7xmF2HzUa2Mzvqpk8nDLoCqDNY4O0053JiYHLhpU0TY=; b=q2hpWN54nwpHnWSfPBWvJVFyRxjTfQ2ym4zUX4gtDdtgqxH2vCynuF2onNOBUWjyoA cUT75ExoJFbcje02hgb93hjdVqDibXgwiPfkFDv3uQsqC2pXSyGXrCCB6Dpq7SEVhDkP 415NyjR4VBoaoBiDq1zalpo+u1Hqtp3/NZHfSA4v8vE62DCH0pQwrzkDft7tczJ64oqD r3h6N5D3IkKi7wuLkBsvSSXlZW4/Y1/epN3FU9Vf9iDUPicEs58n5QVHwunQc1NPpd1l 7cXPcY6QTPo0UrJ7cSB6NCjwS7cobvvfNdGACtxciFuNzMcrvNfw2QoQxZVVSgdJmTtB spxw== 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 b9si7344645pgn.191.2018.04.06.06.38.51; Fri, 06 Apr 2018 06:39:05 -0700 (PDT) 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 S932288AbeDFNhi (ORCPT + 99 others); Fri, 6 Apr 2018 09:37:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32884 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932231AbeDFNhe (ORCPT ); Fri, 6 Apr 2018 09:37:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7EDBFCED; Fri, 6 Apr 2018 13:37:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Marc Zyngier , Will Deacon , Catalin Marinas , Greg Hackmann , Alex Shi , Mark Rutland Subject: [PATCH 4.9 074/102] arm64: Force KPTI to be disabled on Cavium ThunderX Date: Fri, 6 Apr 2018 15:23:55 +0200 Message-Id: <20180406084341.914967207@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.9-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 [Alex: use cpus_have_cap as cpus_have_const_cap doesn't exist in v4.9] Signed-off-by: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Will Deacon Tested-by: Greg Hackmann 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 @@ -753,12 +753,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_system_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_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; }