Received: by 10.223.148.5 with SMTP id 5csp7867807wrq; Thu, 18 Jan 2018 10:29:13 -0800 (PST) X-Google-Smtp-Source: ACJfBos4PKa3iECKHZoYVgRoM5ZmFd+7AREBQIxhj6xx5sVqVfiU3CT0jsaPa8UAG9tsoU9OcLgb X-Received: by 2002:a17:902:6d09:: with SMTP id s9-v6mr222736plk.176.1516300153156; Thu, 18 Jan 2018 10:29:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516300153; cv=none; d=google.com; s=arc-20160816; b=vdPAV3THqR2DhOp/fM8IxMyy4N3TVq7yS3sT1tiHJfjbg3PxKVqj1cWlBLknYv7sW3 G+uONnt4/97ksj6sJalA7HQZ+5CdGMr4L8nKbkh5j1E2PNYhpLqDjxYl0R+HEyiIa7Zv xz4GVKLPyBoH9g8qb3QQttn9oHXWrz0wboDjlR0gCERNpOAwkYV7zkgTf9FR0Ulai8R1 fS44rCkGeyZK2ddBQq3z+wnMFrc+y+jMDHx8ts3GgTYxGbZRuQ7ySSD1mJXhTdmKRDha zAJ/YNTUrI072ytGD0KQVF07hrUOL4QY1Z8/8i917mCNpew1g7ObMWzkkHbess/QX6W5 pnIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:cc:references:to:arc-authentication-results; bh=Swlu+pROUTNlMgWAFkHy+M7j0cE9hBDEMK4beFKV/Ec=; b=EQ37opoAZdNkGID615TTVh8nZGaTmxlouHIIdPv81E2F7bSWak4OgN6Ofxi4wGczIj jUVL+90NUsacKwkVSjW7sW/By4ZzRlxVcbG5Xy3V941Z3tfwb1N1nmIKXDKDBJIg+ryH Cm4cMbImvpW/v6ZjI2wTLIyqQCKY1BLjZsRbRssu6kfBVJXfnUGWJw/tenIJEFEUkbV0 ex9iZWZzfvzzO9jUoLPS+n1taR87pLf3cKs17Cnwbm3oYSOaHg3qDdUzhGOILyUc5hpY 4wPuz+nr6DzN+Vzkpnxv35rnnxiLKFxOHkbeeROGPBmAkuk6z9wgsWMSa4uoxF4BPBOK IC+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si6544741pgu.565.2018.01.18.10.28.58; Thu, 18 Jan 2018 10:29:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755338AbeARS1T (ORCPT + 99 others); Thu, 18 Jan 2018 13:27:19 -0500 Received: from edison.jonmasters.org ([173.255.233.168]:33922 "EHLO edison.jonmasters.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228AbeARS1R (ORCPT ); Thu, 18 Jan 2018 13:27:17 -0500 Received: from boston.jonmasters.org ([74.92.29.237] helo=washington.bos.jonmasters.org) by edison.jonmasters.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecEuC-0006Pe-AP; Thu, 18 Jan 2018 18:27:16 +0000 To: Jayachandran C , Will Deacon References: <20180108164651.GQ25869@arm.com> <1515502022-7376-1-git-send-email-jnair@caviumnetworks.com> <20180116234554.GA38392@jc-sabre> <20180118135354.GB20783@arm.com> <20180118175615.GF38392@jc-sabre> Cc: marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, lorenzo.pieralisi@arm.com, ard.biesheuvel@linaro.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, labbott@redhat.com, christoffer.dall@linaro.org From: Jon Masters Organization: World Organi{s,z}ation Of Broken Dreams Message-ID: Date: Thu, 18 Jan 2018 13:27:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20180118175615.GF38392@jc-sabre> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 74.92.29.237 X-SA-Exim-Mail-From: jcm@jonmasters.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on edison.jonmasters.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 Subject: Re: [PATCH v2] arm64: Branch predictor hardening for Cavium ThunderX2 X-SA-Exim-Version: 4.2.1 (built Sun, 08 Nov 2009 07:31:22 +0000) X-SA-Exim-Scanned: Yes (on edison.jonmasters.org) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/18/2018 12:56 PM, Jayachandran C wrote: > On Thu, Jan 18, 2018 at 01:53:55PM +0000, Will Deacon wrote: >> Hi JC, >> >> On Tue, Jan 16, 2018 at 03:45:54PM -0800, Jayachandran C wrote: >>> On Tue, Jan 16, 2018 at 04:52:53PM -0500, Jon Masters wrote: >>>> On 01/09/2018 07:47 AM, Jayachandran C wrote: >>>> >>>>> Use PSCI based mitigation for speculative execution attacks targeting >>>>> the branch predictor. The approach is similar to the one used for >>>>> Cortex-A CPUs, but in case of ThunderX2 we add another SMC call to >>>>> test if the firmware supports the capability. >>>>> >>>>> If the secure firmware has been updated with the mitigation code to >>>>> invalidate the branch target buffer, we use the PSCI version call to >>>>> invoke it. >>>> >>>> What's the status of this patch currently? Previously you had suggested >>>> to hold while the SMC got standardized, but then you seemed happy with >>>> pulling in. What's the latest? >>> >>> My understanding is that the SMC standardization is being worked on >>> but will take more time, and the KPTI current patchset will go to >>> mainline before that. >>> >>> Given that, I would expect arm64 maintainers to pick up this patch for >>> ThunderX2, but I have not seen any comments so far. >>> >>> Will/Marc, please let me know if you are planning to pick this patch >>> into the KPTI tree. >> >> Are you really sure you want us to apply this? If we do, then you can't run >> KVM guests anymore because your IMPDEF SMC results in an UNDEF being >> injected (crash below). >> >> I really think that you should just hook up the enable_psci_bp_hardening >> callback like we've done for the Cortex CPUs. We can optimise this later >> once the SMC standarisation work has been completed (which is nearly final >> now and works in a backwards-compatible manner). > > I think Marc's patch here: > https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=kvm-arm64/kpti&id=d35e77fae4b70331310c3bc1796bb43b93f9a85e > handles returning for undefined smc calls in guest. > > I think in this case we have to choose between crashing or giving a false > sense of security when a guest compiled with HARDEN_BRANCH_PREDICTOR is > booted on an hypervisor that does not support hardening. Crashing maybe > a reasonable option. Crashing is a completely unreasonable option and is totally unacceptable. We never do this in enterprise, period. It's reasonable to give an output in dmesg that a system isn't hardened, but it's not reasonable to crash. On x86, we added a new qemu machine type for those guests that would have IBRS exposed, and ask users to switch that on explicitly, but even if they boot the new kernels on unpatched infrastructure, we'll detect the lack of the branch predictor control interface and just log that. The exact same thing should happen on ARM. Jon.