From patchwork Tue Feb 20 22:46:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10230965 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 57E5160392 for ; Tue, 20 Feb 2018 22:46:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 446DE28964 for ; Tue, 20 Feb 2018 22:46:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 384EC2897C; Tue, 20 Feb 2018 22:46:52 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable 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 AD3ED28964 for ; Tue, 20 Feb 2018 22:46:51 +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:Message-ID:Subject:To:From :Date: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=x8c9ogiYsY0nmK7ls41xtdfqLcZgiAeGlHt6GYv9iCQ=; b=ZhCCZIuNiTAIcs 6m5/RDhSqBf/HfzU2bXl+OrXDCHbQiyxzU5bXZrGcPaxbEH/97lIaZULoVBsOy0g2t7TCGb7zO7Wt +tYAYKdaLk6r+W0nOsz8iDybaaSh+qFsVzJCFmVYudBsjJ5eq9uanxa+DkE5cXAVNMBp8YzyOhq9u fLddRmIM/7udqjRV2V5TMbgnLOXoHDuJT59rMPJnYt6CV8oN9Pq3Rlc5gtV1tJVkq8FyrngNLEogN FkoOHEzedpxXtSBvm5fbT+97Z+ykXd78TbJlOYOR7Dw6Gj9Yq5yDiawy6lmWRPeypvShWZip1ZI5h knRC8y5vi2MAUEA3EAyg==; 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 1eoGgM-0002sA-Ac; Tue, 20 Feb 2018 22:46:42 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoGgI-0002qY-MC for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2018 22:46:40 +0000 Received: by mail-pf0-x243.google.com with SMTP id z14so3128494pfe.10 for ; Tue, 20 Feb 2018 14:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=oHPNvxJ9iVcwQjr7a49rkeRAx3s5nUXxu81PRKuwbmo=; b=chazEaUGgyY8iRncxW7GttD/tBD0u26Xandq3wQWvnNK6k+ezNrBzFxGN0coMMkTR4 5w9KM6wOj03zcTa8Hxzub7Xb8q9bfcRtVryM0HYYpcj5yYSl+gDkwmKFGIKqrAJN/+yw piSCVGIxMR6ECfler/4L/4+gXWocMBhgrgG44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=oHPNvxJ9iVcwQjr7a49rkeRAx3s5nUXxu81PRKuwbmo=; b=PaTlArQZFK1PZz6u3gCnR15OvYi0L/TNtwmpXXgOBApy5o84VvH6cpE5PBFF6C83DY 6QozmMwDYI3N7ytfM4jTv5HuUGI8ww/T33vBjRct0t1BBqt8FfEY99f+yjVNoNxc2DuQ eGiv3CCABgdNu8Fmgx4IQV+JWLkbt7CyXjv7XBXsEmh1js2xYl+uPKeokdvn3WNU6c12 SNY0lr9shy/7ssv5Ag8iIE1SogDH1dKRRm2ESWAJrTVFO8DgpTltVEv4SYGfNFqIkgDN R77H5+4dhzFNZffnPL1j+N7+d+MU4evz5YCD+fTOeyS4XUv4o7UeheLMJrhjOFD8OuV1 jeVw== X-Gm-Message-State: APf1xPA5sqS0OyFs9nrQhT5m4dXWorDxWZb18yp94sM3bxgo6Vkx3AcA lE2Ah2eHBORL94DaB3qEtWkxhA== X-Google-Smtp-Source: AH8x226orPH4l1F1TsyqrFiEO6UIjPNRV/JSbl22aj4s36sgxC+GXk+glF0eYQGnoPBUKVjti6sOZA== X-Received: by 10.101.81.76 with SMTP id g12mr987102pgq.24.1519166786587; Tue, 20 Feb 2018 14:46:26 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id o62sm77795305pfk.177.2018.02.20.14.46.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 14:46:25 -0800 (PST) Date: Tue, 20 Feb 2018 14:46:24 -0800 From: Kees Cook To: Catalin Marinas Subject: [PATCH] arm64: cpufeature: Trim feature reporting and include PAN emulation Message-ID: <20180220224624.GA28218@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180220_144638_751260_A41C8BE9 X-CRM114-Status: GOOD ( 13.84 ) 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: Mark Rutland , Suzuki K Poulose , Will Deacon , linux-kernel@vger.kernel.org, Dave Martin , linux-arm-kernel@lists.infradead.org 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 The PAN emulation notification was only happening for non-boot CPUs if CPU capabilities had already been configured. This seems to be the wrong place, as it's system-wide and isn't attached to capabilities, so its reporting didn't normally happen. Instead, report it once from the boot CPU. Additionally removes the redundant "feature" word from the "CPU features:" line. Before (redundant "feature", and missing PAN emulation report): SMP: Total of 4 processors activated. CPU features: detected feature: 32-bit EL0 Support CPU features: detected feature: Kernel page table isolation (KPTI) CPU: All CPU(s) started at EL2 After: SMP: Total of 4 processors activated. CPU features: detected: 32-bit EL0 Support CPU features: detected: Kernel page table isolation (KPTI) CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching CPU: All CPU(s) started at EL2 Signed-off-by: Kees Cook Acked-by: Mark Rutland Acked-by: Mark Rutland --- arch/arm64/kernel/cpufeature.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 29b1f873e337..6c799ca58b53 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1333,9 +1333,6 @@ static void verify_local_cpu_capabilities(void) if (system_supports_sve()) verify_sve_features(); - - if (system_uses_ttbr0_pan()) - pr_info("Emulating Privileged Access Never (PAN) using TTBR0_EL1 switching\n"); } void check_local_cpu_capabilities(void) @@ -1360,7 +1357,7 @@ void check_local_cpu_capabilities(void) static void __init setup_feature_capabilities(void) { - update_cpu_capabilities(arm64_features, "detected feature:"); + update_cpu_capabilities(arm64_features, "detected:"); enable_cpu_capabilities(arm64_features); } @@ -1394,6 +1391,9 @@ void __init setup_cpu_features(void) if (system_supports_32bit_el0()) setup_elf_hwcaps(compat_elf_hwcaps); + if (system_uses_ttbr0_pan()) + pr_info("emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching\n"); + sve_setup(); /* Advertise that we have computed the system capabilities */