From patchwork Fri Jan 19 12:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jayachandran C X-Patchwork-Id: 10175175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE5C560386 for ; Fri, 19 Jan 2018 12:36:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B15A528669 for ; Fri, 19 Jan 2018 12:36:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3E932868D; Fri, 19 Jan 2018 12:36:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E60B28669 for ; Fri, 19 Jan 2018 12:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ryyiIvmVnMGnBRjrcpOHEPZwtl4QtSpvNfzk4+kF6FA=; b=KgSL1Wx7lnVjgz 5kcB56RL+fzYkrK6YLBg6hMVx3be8vuaUqwdBd/V5jUCLLuHfxmr+y2hkDKagFlvmiqzHie7NPClZ s/VbL+CjXb4k3H7j++IjvsbVWk7TuJVdhv/SqYWOB/6MHB24s8kYCTCWweRI4VjMlP5s32rxMVd1o Q7OME8TKJ4LrcId92KFx+stffDTTF78QSq4eErukE3CfnRHejyVlDIIyIL7zpGFjVc/KGFX6YqFmS hnttM1Khyk0ydU9tH+xybMf3DrQTaObb8xftRW8V9v1g6sfUsY8lawsZkkmgxZMPRfokNxfRJ04cc CeHZpbOzdbl2On7VEf3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecVuQ-0002Mg-QY; Fri, 19 Jan 2018 12:36:38 +0000 Received: from mail-dm3nam03on0609.outbound.protection.outlook.com ([2a01:111:f400:fe49::609] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ecVhU-0004PI-8w for linux-arm-kernel@lists.infradead.org; Fri, 19 Jan 2018 12:23:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=11jpJ+2AJLykVH7TWNShFOVqaSyMY1EvV87FLFMToFI=; b=ablUrsOsNvXF2C4cTeKSmwvs6e7FpoczbN5ByVFyftnE4/RFGrPO3g8vF98IiZUVzK/DhjseLu/eSP0x9/Bvl7CWIr9+zs0WFisW0cT+jTQF+dKYCMiY3HBZHHVx+8DMwVOyjKNllPROYdJluOYD9iLWGLWcLABy6XzZZMRkKmA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jayachandran.Nair@cavium.com; Received: from jc-sabre.caveonetworks.com (50.233.148.156) by DM2PR0701MB1068.namprd07.prod.outlook.com (2a01:111:e400:2472::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 19 Jan 2018 12:23:07 +0000 From: Jayachandran C To: Will Deacon , Jon Masters Subject: [PATCH v3 2/2] arm64: Turn on KPTI only on CPUs that need it Date: Fri, 19 Jan 2018 04:22:48 -0800 Message-Id: <1516364568-95577-2-git-send-email-jnair@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516364568-95577-1-git-send-email-jnair@caviumnetworks.com> References: <20180118135354.GB20783@arm.com> <1516364568-95577-1-git-send-email-jnair@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: DM5PR2001CA0021.namprd20.prod.outlook.com (2603:10b6:4:16::31) To DM2PR0701MB1068.namprd07.prod.outlook.com (2a01:111:e400:2472::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 661b13ce-692a-480b-4b33-08d55f3765ab X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR0701MB1068; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1068; 3:ZeFfoW/hTcd7RS4+WBzh+0B0pQc3dFFtC0diW1ZMcTA1kZqYHxt+jJsfg2YMH81BFXbm4dHM3PRCEFubi7a/+RjRKDIVR+UYko4+lOz/gCjMlMdWohxE2TIo4w0zRytsAnycJsFVfMNdTCRCkmb0t7N+SEg8mC7LOuWfyPZLlHJ8jfIGSnqYbQFtqDpXrMIOV/p/U8iiQRJ+nh0kjjhjmCIc2E8oV2mmSSM8PxosC9v97w48nGpdymEFBldDFOsQ; 25:bUkJ/dCir2vgTVednIjtJUgxF++ilVqCO6BBgieX/194F1oIjrBnDC/e3v50pIuuJ5jIATm0+yM5WLVq2rAJUt5E3L7lYIsJROChQ+Cpr3VybAonHyxuN/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i04/yr2X7F7dX46zMEApVzTnTJEheMg3fAMe6LO0KPiKm8O2+kmOyuVzMegmNNmIjy+W29Nc3wDXVVorg4CVCgAjRwHc=; 4:wsw9OpESTGmP9JRv1D4wF208grEFWEd58YMLGmDb+Weo2kX48plEOgjdtJ8AuMpFPX6ODZuiJwkDlii9Jj4qGmVMJqN7Ce9mKc6/nzeNvY1Nd7JEcUu1IqCKruxlESWetwL4CohzNa4YkQf/VCNSh1NO4SgvSxlYVQhGzBiO5sgxeSO0KfVl45t86voy8xEqcwnUwIc39sJNx2lc2xhNJNBQj644/+dlWivrLX4690UNpz28AfplppAuGmX1IW4K1/yaHy/+1XozOIu7JSJ2Ug== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040495)(2401047)(8121501046)(5005006)(10201501046)(3231023)(2400077)(944501161)(93006095)(3002001)(6041282)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR0701MB1068; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM2PR0701MB1068; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(366004)(39860400002)(396003)(199004)(189003)(7736002)(53936002)(110136005)(5660300001)(8676002)(50466002)(81166006)(48376002)(81156014)(6512007)(305945005)(386003)(6506007)(16586007)(42882006)(2950100002)(68736007)(69596002)(51416003)(72206003)(76176011)(316002)(52116002)(6486002)(8936002)(6666003)(105586002)(26005)(107886003)(25786009)(47776003)(53416004)(66066001)(478600001)(36756003)(16526018)(2906002)(97736004)(7416002)(6116002)(3846002)(4326008)(106356001)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0701MB1068; H:jc-sabre.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0701MB1068; 23:Ib5ACZAJ4nnzMjCqtaDjRXLC2RatDcRu9C+4uV7?= =?us-ascii?Q?kxa8QqK25d0U7f+cMbkaHJ942GP4VCQRMkQM1A9eUYrSey8/sROYKitaVtAt?= =?us-ascii?Q?CbdYizMzQFDWFLxksFdHGJ4i0lu1r9LLd90o3o+uSLgsTUdeYlgdP1BANB10?= =?us-ascii?Q?Zd159Ee72cklWQu2HFV7150x/NcGIX5f0bygQC0k4drB5o4u4Nh7y6SUQBT/?= =?us-ascii?Q?V8072+T3gjfLJ80RxeHuEuE9v433Oyo363Ac8cny9el4wzNUIwMJhGeOmNpL?= =?us-ascii?Q?bOsExBkw7kuQ0XF+AqhveYRha++u6MMMAzzg1ylD/OjKbp1rBAyNDjRz023u?= =?us-ascii?Q?9ncNhJ+X4AwKbiSSEbYmnG721l3JBlJpixGA+QOHLTDKOY8brofta+Kbxrv8?= =?us-ascii?Q?GNkIK/lP0AqjF+P+lAevp/oLmZfUFeRjxLXAVjrr2NPznLxrfVil9q0Al/EL?= =?us-ascii?Q?Irjgr5Oz6AId5sbVd+xbia1NDcQ8SHIGD2GxmXHdICSL/qVCLFWoofQQ06pS?= =?us-ascii?Q?eBBUm8zo3TnL0gupI1DWTbajIqMFXNu0+UBnXytTWJhiSBLtxkFuaAwrD5lJ?= =?us-ascii?Q?auJOKHC3N/OB2SnbJlkxJOxCv1/G6S3Mdc2VUAITnNNhjf+M+//n4oUOU3e5?= =?us-ascii?Q?Z+gXUJwEy5E5N4PoLTAULGZUTUtrMktZFDSPPkflP4k+vwFs/VGVAFxKLZai?= =?us-ascii?Q?VXndPGfSXXwHmbcGMniJIJO3SuSkKlnDcLVqT/ujOhc4rF66JwmKEBne5vlT?= =?us-ascii?Q?uWb66KDa0Wj8vVZ6q1m2PfHS6pZ9/bu0ki4wBaPCtSzpqLo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5xigPaGxiRjPMu1ofsbC1qIrkwx6wYJYxVhl06K5I05FoCAReNj7OMBe08oPk0eFySXr9c9AuPbnClseGGgb1sk0gR0sIZyl7sXZPeEJ7Es=; 7:JAMGd+3srp5mt49mmnbh7eboefcpF7HXdVz60gKAvvxVwah2Nw3fIHJ5nqUt5n1/nsgUMCNndm9YwlAo0iFG3jm8Ac7MW1ZslQhBnu12SHyQM6XYU7nw1haXQYGXu+x1ZRw4StK0IPmrHTNkbgZTThLVDy8peeWcT/fKuzI3tvmQ6W2qcqldqDCjU1RXXWwHfWaHNm7iLhR7FKKBtG7YCQzhVoKlVk1hRv7QPhTHzcShn6X1A/WGQznySLDeDn2u SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 12:23:07.0107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 661b13ce-692a-480b-4b33-08d55f3765ab X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0701MB1068 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lorenzo.pieralisi@arm.com, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@linaro.org, labbott@redhat.com, linux-arm-kernel@lists.infradead.org, Jayachandran C Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Whitelist Broadcom Vulcan/Cavium ThunderX2 processors in unmap_kernel_at_el0(). These CPUs are not vulnerable to CVE-2017-5754 and do not need KPTI when KASLR is off. Signed-off-by: Jayachandran C Acked-by: Will Deacon --- arch/arm64/kernel/cpufeature.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 647d44b..fb698ca 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -866,6 +866,13 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) return true; + /* Don't force KPTI for CPUs that are not vulnerable */ + switch (read_cpuid_id() & MIDR_CPU_MODEL_MASK) { + case MIDR_CAVIUM_THUNDERX2: + case MIDR_BRCM_VULCAN: + return false; + } + /* Defer to CPU feature registers */ return !cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_CSV3_SHIFT);