From patchwork Wed Feb 21 18:18:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10233805 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 2083860392 for ; Wed, 21 Feb 2018 18:20:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 155A72818E for ; Wed, 21 Feb 2018 18:20:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 096FA28210; Wed, 21 Feb 2018 18:20:25 +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=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 5BAA62818E for ; Wed, 21 Feb 2018 18:20:24 +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:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=ZBHRQTt+ET7IQOMAm+6kqA+FHS7wNqVZacJuv1ctxbU=; b=huAoBaEP0zEYO3NPUCg5N0gVaG npmndvIOSc19o3WV5EVJzNGePn1Mrg48MOQK69N/l1FuwTk1u2J4kjgm2j03e1BNt+KHZZmJWyiK9 2cEts8GG01ezYydIlD7wuV9VMGu0fXbgL2AxarLlYEQys4KOY8ohQAVY3KzZ+hmE+8TVTSb6D2Rfs FYPmqN1J3/BIgSJhZmbqqSEP5Vq1qvS/8XiQa0P/amdKyo+UJa3C/fTGKywg5SMWqHBbMOZLOra1x +HuV2PPHTn2BqYNKM9w1jgFDCBcO7/hwYzUGhunrO0fLqtXihOdyfMrhVa/CGTJpbR6jZ4vj1CATH XZYYMLJw==; 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 1eoYzp-0006jD-TO; Wed, 21 Feb 2018 18:20:01 +0000 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoYyZ-00062W-NR for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2018 18:18:45 +0000 Received: by mail-pl0-x243.google.com with SMTP id w21so1358812plp.11 for ; Wed, 21 Feb 2018 10:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0vc7g3ekbT66g8eNm/ZclteSG4BG4ohIHk8DhhpKpV4=; b=Q7rFRjPD3LEQkVy0DZB0KtQpGP4dF8VAEJXNDc95Og9BFZELGQ8xzgixhgoktGAhFF dK5jwGdBWjPx/fUf/xn25ft69wHHyb5OrgLeoXYU5Je1olBW4XC2bW1lw4uFMI7qJbNO BSntoSFLD7H+W3lO1jm4y3QTsLRzXrbdWrCO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0vc7g3ekbT66g8eNm/ZclteSG4BG4ohIHk8DhhpKpV4=; b=TrXlam1ZluK0mYidp26KiHHY/xNQz8BSwmK7qbuueib9YQcS14ewPsrplK11Kw0xSf slFzjYVTtmR/AqHwj+cli7lOMjJ+rbLYfgn4ACZRQXH1lvn2y/49nM5N8jApTF5RgSVv /5QL0zVeiPlqSy04lXlh/vyLzTL0Cpdws1xEo60+tp+OFu9ksp1Ll6gOHvxADeTnFLWa IumMqNSouLel5rHeJvWoDJwiUBJ6tcEVXEs/coQX/qDlwlrs7oih1v2djF96iChMNJVc gXLL8jY3lPZeEDETU/Ao6qDh9GWZEG/4Uzs8VO8LUhjabk/b5BjHvnHyeQyiepMS4vgA J8Eg== X-Gm-Message-State: APf1xPAGtST95m/7eOxDy+3kH2pbbhlr1z+zqToF21p0LdxMfOH/BQhG 35pGATvylREJKar54s5FHpImVA== X-Google-Smtp-Source: AH8x227ADJ4pEU9jk/DANpgB9SucaAxGaOcV49hmNOZYSSdiApAE+zGpcEVR0SaIosHw/5K2Ep9ZAw== X-Received: by 2002:a17:902:7808:: with SMTP id p8-v6mr3998166pll.161.1519237112880; Wed, 21 Feb 2018 10:18:32 -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 a66sm34305845pfc.21.2018.02.21.10.18.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 10:18:28 -0800 (PST) From: Kees Cook To: Catalin Marinas Subject: [PATCH v2 1/2] arm64: cpufeature: Relocate PAN emulation report Date: Wed, 21 Feb 2018 10:18:21 -0800 Message-Id: <1519237102-46854-2-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519237102-46854-1-git-send-email-keescook@chromium.org> References: <1519237102-46854-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180221_101843_806312_7A43ADA8 X-CRM114-Status: GOOD ( 13.20 ) 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 , Kees Cook , Suzuki K Poulose , Will Deacon , linux-kernel@vger.kernel.org, Dave Martin , linux-arm-kernel@lists.infradead.org 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 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. Before (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 feature: 32-bit EL0 Support CPU features: detected feature: 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 --- arch/arm64/kernel/cpufeature.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 29b1f873e337..61aff55245ea 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) @@ -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 */