From patchwork Thu May 24 19:09:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 10425341 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 D146A602D8 for ; Thu, 24 May 2018 19:10:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B15FF29619 for ; Thu, 24 May 2018 19:10:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A34F529667; Thu, 24 May 2018 19:10:45 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 2589429619 for ; Thu, 24 May 2018 19:10:44 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uR2BXe9rXFL9ptkjKvU9w3hQGSqQU9dNdJQFZoqiM+U=; b=NFWM5GrVWnddc4 Q1XYkZSUPyHBzcwPbIB9YLxnFiy8Cg8MKs5f8UG2rS9TBeOHqdoXw6/9McYmljxhpU+Exa0TmvLz6 Cy0aCUOPhH9vxSHXBW4xgxVa4yaPPXHLIAM2jUW2aL4xTp5AEg9pEdXB33TNnuIq7S2IeIbgi3RGH Ef2IZFzAEmjycg6yQEIhDR0OivRX0HBSivbfcoMz2lfj2Ni6d11rIpk3mX1icmBsrqTE2DULyGOsv XGVmhAn/rbyFVqwLhNFYRDBZcRQ6aBFGpEgKR8UnwN9lleyg60KW+FWvb82FHKpI12vEAUu7evlV2 SttdGuhRPOlFhjEKHScg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLvdD-0004g3-4W; Thu, 24 May 2018 19:10:35 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLvck-0003GJ-VW for linux-arm-kernel@bombadil.infradead.org; Thu, 24 May 2018 19:10:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TgeshvMXj4Lq/RZRS3wVUEsH7tnsJBTEglF2E6qN5og=; b=2UsQ6FL0e13uDBHJWEmWRpQhW mU+RM2W14DGrh35FtJ6UI4jPmbsqPbtastidiFGdXupP3EMvx20KVVhOvzK3lLBbocSL/V33MtIti AoV3jK5ljBk1JmJ8gdsf/+wwmL6gzfQTUXTbmssDqL2MtIlp2WC8tV5ayPHcG34bu3bpMTttQo1RQ imiByobDR2cqyFLM01/ai0b7t1l7oJaBcyNsA4A7dTveHxgMx6J5K/b/hcEv+bEoh5zMIf2DDnVTH kOIuHn4ZkaulKdsBJlXPh4TEt/xq4vLJiURC/55yMapvmqnnN7c5KwFVjpB7ZahZdpIMgfUxKxZSJ Quw6qQqkw==; Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLvch-0004D5-T8 for linux-arm-kernel@lists.infradead.org; Thu, 24 May 2018 19:10:04 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CD498EA29 for ; Thu, 24 May 2018 19:09:37 +0000 (UTC) Received: from redhatnow.redhat.com (ovpn-116-144.phx2.redhat.com [10.3.116.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E93367663 for ; Thu, 24 May 2018 19:09:37 +0000 (UTC) From: Mark Langsdorf To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] arm64: cpufeature: always log KPTI setting on boot Date: Thu, 24 May 2018 14:09:32 -0500 Message-Id: <20180524190932.32118-5-mlangsdo@redhat.com> In-Reply-To: <20180524190932.32118-1-mlangsdo@redhat.com> References: <20180524190932.32118-1-mlangsdo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 24 May 2018 19:09:37 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180524_151004_046290_B03B4F9F X-CRM114-Status: GOOD ( 16.76 ) 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: , MIME-Version: 1.0 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 Always log KPTI setting at boot time, whether or not KPTI was forced by a kernel parameter. Signed-off-by: Mark Langsdorf --- arch/arm64/kernel/cpufeature.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 697a6ef..e50bf3c 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -889,16 +889,20 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, __pti_enabled = __kpti_forced > 0; pr_info_once("kernel page table isolation forced %s by %s\n", __pti_enabled ? "ON" : "OFF", str); + } else { + /* Useful for KASLR robustness */ + if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) + __pti_enabled = true; + /* Don't force KPTI for CPUs that are not vulnerable */ + else if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) + __pti_enabled = false; + /* Defer to CPU feature registers */ + else + __pti_enabled = !has_cpuid_feature(entry, scope); + + pr_info_once("kernel page table isolation %s by %s\n", + __pti_enabled ? "ON" : "OFF", str); } - /* Useful for KASLR robustness */ - else if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) - __pti_enabled = true; - /* Don't force KPTI for CPUs that are not vulnerable */ - else if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) - __pti_enabled = false; - /* Defer to CPU feature registers */ - else - __pti_enabled = !has_cpuid_feature(entry, scope); return __pti_enabled; }