From patchwork Wed Sep 22 13:59:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dann frazier X-Patchwork-Id: 12510735 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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 7E1C9C433F5 for ; Wed, 22 Sep 2021 14:07:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 403426115A for ; Wed, 22 Sep 2021 14:07:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 403426115A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=jqx1vZDjiE3peRxOgYo+H4uBO2/U/FsfdzFki0IOry4=; b=yHb0sNG2csADVn xpVY2jLuZRbtUU9u1+5yTvItzADmJcf96eBJwNIZt1Snng/Gq1xlVGHzk11buX9SFex3t2UwGHfEL EY1lVZx55j7gYJeyAgT8caxQfvgFfpTbICPeliDam0153c2FM+5WBUzC5+5kTDgcSgHoxxqk+90Gt dtFJkaoeuLPHY0tRHWyi1ABQEe5hAiwJKNmMUABCpTWGEaYM3UzbBfh5JtCglrKtUBhq3LuwXNGSg 65eWfynwG93/rU0CFWnYlQOTfRR1saqMTVdU48IAYXer4V9mf92CYZJlW5ZFEn/ULgYJi0qsYBdkJ 5spFk3iFJ6R4nY5sseJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT2rc-008kNR-Ab; Wed, 22 Sep 2021 14:04:45 +0000 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT2pg-008jtZ-I2 for linux-arm-kernel@lists.infradead.org; Wed, 22 Sep 2021 14:02:46 +0000 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id DA9FE3F226 for ; Wed, 22 Sep 2021 14:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632319362; bh=AfVQlMUwpdYSYyQYjL4NIO/t0G/O34Fcogh6zWl1wsc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ejzAqMYfC3kdS/ttPORN3q543GY2snGLys8V7Uy7LHmcxE674mn4QmoODuBOxowig PLQKLiKR7hnpzdD1RuFYGVfdUqrDMjHkk5h9Z7uctKMbW+Uu2+SVpV/5z3V4gnRVhm +bwmXsyDzpHPaBytVrH1skLAtHv+Cr0SaOR4WdxIZy7IZ4bh0ZBL1HrbV1xtYnKI8H SLYBs0/EN/WKr7LWDYWJQURrmELKI0lYmgrtq4oX2r9maD/rjcfppxK68ZA0In/gh8 zJ5ae6NQkun5LJPjQIlvg7S+MdpuuVKDnKC/R6tjvA39idZUH05tZQ4JR613AiuAOT E2CERArOT9c6g== Received: by mail-io1-f69.google.com with SMTP id n6-20020a056602340600b005d56a34dea8so2778960ioz.19 for ; Wed, 22 Sep 2021 07:02:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AfVQlMUwpdYSYyQYjL4NIO/t0G/O34Fcogh6zWl1wsc=; b=4wjgpIvT5wVa9MXKb68wf6Yrs905yTktFnyZ4PfW2sI4BiaZx9X0fDA6lmE2ApKm9U EDNkhyCR4kKmZ1wM+soJwym/wMQ+Ry2mnCifAZPc15th/eiw7KSQxvwN5DqsHJjuSr8V ggERe6OPpGm3o/umI/qs5WGYGChlcKYdxqJP6coBXSTTkjNAk5nLn2/cj7siAXQ4p2Gs 0Z7AWbHkWTJqrhmoePIpCPFVaJdhTGbiE6jp1z5HAe+iz9bclhg2pqQKnagZGpxFkMx8 HiZgXd8X5lhiNgDDfO05dv8kHDSyAaLaUDCwIqFYg8zsHYt5mRGFRkngRkVFeLM+DOKx lKZw== X-Gm-Message-State: AOAM533o8grbdJeWSbczA1LZ2ykQIJZho97dc7GD8ppKcGsBLA7nx5g7 +IS/ly7jY1fHp6Zu+PJdX2Qgod1JQ/GptpxP5lVcDeog5rkHq520p4lkMoODyVxOoREQSlJwIdk TOObMq920wvL/L2vgbaHQWMQ3bwpjsO0/eubfbtXMpc5MXekp4DH9 X-Received: by 2002:a6b:4f04:: with SMTP id d4mr4373360iob.95.1632319361647; Wed, 22 Sep 2021 07:02:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRKqt+q4W2ec56nDU1+n4AZ9yvbGWAJLOtaLlScVH4O82zHB86aK45M7lDVQYEKQ1FIvafIA== X-Received: by 2002:a6b:4f04:: with SMTP id d4mr4373329iob.95.1632319361358; Wed, 22 Sep 2021 07:02:41 -0700 (PDT) Received: from localhost (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id f5sm1120865ils.3.2021.09.22.07.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 07:02:40 -0700 (PDT) From: dann frazier To: Catalin Marinas , Will Deacon Cc: Suzuki K Poulose , Mark Brown , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Mark Rutland Subject: [PATCH] arm64: Restore forced disabling of KPTI on ThunderX Date: Wed, 22 Sep 2021 07:59:24 -0600 Message-Id: <20210922135924.3109291-1-dann.frazier@canonical.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_070244_880631_84186E74 X-CRM114-Status: GOOD ( 16.43 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A noted side-effect of commit 0c6c2d3615ef ("arm64: Generate cpucaps.h") is that cpucaps are now sorted, changing the enumeration order. This assumed no dependencies between cpucaps, which turned out not to be true in one case. UNMAP_KERNEL_AT_EL0 currently needs to be processed after WORKAROUND_CAVIUM_27456. ThunderX systems are incompatible with KPTI, so unmap_kernel_at_el0() bails if WORKAROUND_CAVIUM_27456 is set. But because of the sorting, WORKAROUND_CAVIUM_27456 will not yet have been considered when unmap_kernel_at_el0() checks for it, so the kernel tries to run w/ KPTI - and quickly falls over. Because all ThunderX implementations have homogeneous CPUs, we can remove this dependency by just checking the current CPU for the erratum. Fixes: 0c6c2d3615ef ("arm64: Generate cpucaps.h") Suggested-by: Suzuki K Poulose Cc: stable@vger.kernel.org # 5.13+ Signed-off-by: dann frazier Acked-by: Marc Zyngier Reviewed-by: Suzuki K Poulose --- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index f8a3067d10c6..7275b49034f3 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1528,7 +1528,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, * 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)) { + if (this_cpu_has_cap(ARM64_WORKAROUND_CAVIUM_27456)) { str = "ARM64_WORKAROUND_CAVIUM_27456"; __kpti_forced = -1; }