Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3608288ybk; Tue, 19 May 2020 08:42:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhu7S8tWMkYBanRyaAbAjhMEYyI1sFdDaWy0lWu9iCmLkQ1os0ldCFdfp0kbTMeSku94eu X-Received: by 2002:a05:6402:3128:: with SMTP id dd8mr18738519edb.156.1589902923032; Tue, 19 May 2020 08:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589902923; cv=none; d=google.com; s=arc-20160816; b=fMu154WrzfUC9Yc9zAH190WyzQl1PNGAT+2OMUaXNZoLofB0YgmnYsuBTvJeyLN9Bs NO+cwsttt4oBu++B01ML2YYkurCaSTkZ8yf3wT5qfunJJzencHL/Nk5Bhn3GkXb4HbVX Ez6pMkbiV9O9dIejJffYH1Y16UxLlfCCAhbk9XZG5m1hKnkg96us5d02opVOCJvqVdYB i2DKCEt/5WxWp6+vzRHsQeit6+ExpmUTMbyPsuM3lUqYnU19vTtgaNKvN0qkI4XZBKzH odI5FY47tfJA1NUDiH8mxXPU7jvE7kto0uPZaIckfVd3kSZxHP6mfHX5zcasbvVGfC9V zYgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Aa9gF0hDhcPwg63zlVfnviiqmzwslNvVPcnx2YFTytA=; b=TMAAFeDNyVPKZbf6CSyi7MbcZXByS01IQMnDr9f9dNETwBr+kAYK0kyZcZFiHBWSsi KgiVJDBtm8GEcagYlEuxJyQMcqp92HNK7Ol231IaEPXcUAkptLyZm40QZmbHWFspCt1Y vJYHoZlpBCXg4GMc3JIvUVhTMuYPkvmuo8MGf1JiRb3SpoOZauzkCP2wPPRux3sJzScb 8O2qCr17jfkSuoPKR81snb+vwbmoqxSYTF/6mewXl+fODRRXs6k/2wgNfq8Cxxeqpz7I SDon248g3q9MNfr5kbKG5Vrd+/3z/Hssy5+cZ9VGNUUXqQ4bGpwbyFIKzp7PeZLiajoj ruwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=TYqT8GKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si104748ejh.293.2020.05.19.08.41.39; Tue, 19 May 2020 08:42:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=TYqT8GKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbgESPjz (ORCPT + 99 others); Tue, 19 May 2020 11:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728633AbgESPjz (ORCPT ); Tue, 19 May 2020 11:39:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009EAC08C5C0 for ; Tue, 19 May 2020 08:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=Aa9gF0hDhcPwg63zlVfnviiqmzwslNvVPcnx2YFTytA=; b=TYqT8GKOoN0wLlBBymPjw/5+YN /1xXDv2Ropz+PJ4l4dHuQVH14ACICh4pMthZzFd1AuC56uYZQ3BaESj9LAVIgrG8qyPo3lYTBTRB/ J2WwNFNJrLkRtT0eI43AM3NLSi+u3rmUeqirED0rTEUVKdjeSRb2+vtDhVUE3TNbKhOEx/YghAPai ypUhCemSb7ZW+ePbaswZ4OUUU3dI4NlvEO7YUofV5TPshkBmij5EPfZv/rqc2DvIr6Nt9gv92n1mP e9FoygA7Y98vxvvOpKYYfFkos24ctGIct8Hgg7jUCrcXYn/g6dahwDU59uDiymGfZrbXlG0ZWO3ok f/IYierA==; Received: from [2601:1c0:6280:3f0::19c2] by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jb4LO-00010w-BL; Tue, 19 May 2020 15:39:50 +0000 Subject: Re: [PATCH v2 4/4] arch/x86: Add L1D flushing Documentation To: Balbir Singh , tglx@linutronix.de, linux-kernel@vger.kernel.org Cc: jpoimboe@redhat.com, tony.luck@intel.com, keescook@chromium.org, benh@kernel.crashing.org, x86@kernel.org, dave.hansen@intel.com References: <20200406031946.11815-1-sblbir@amazon.com> <20200406031946.11815-5-sblbir@amazon.com> From: Randy Dunlap Message-ID: <5def424d-c7d5-c6fa-60b9-363f6bca6bc6@infradead.org> Date: Tue, 19 May 2020 08:39:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200406031946.11815-5-sblbir@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi-- Comments below. Sorry about the delay. On 4/5/20 8:19 PM, Balbir Singh wrote: > Add documentation of l1d flushing, explain the need for the > feature and how it can be used. > > Signed-off-by: Balbir Singh > --- > Documentation/admin-guide/hw-vuln/index.rst | 1 + > .../admin-guide/hw-vuln/l1d_flush.rst | 40 +++++++++++++++++++ > 2 files changed, 41 insertions(+) > create mode 100644 Documentation/admin-guide/hw-vuln/l1d_flush.rst > diff --git a/Documentation/admin-guide/hw-vuln/l1d_flush.rst b/Documentation/admin-guide/hw-vuln/l1d_flush.rst > new file mode 100644 > index 000000000000..73ee9e491a74 > --- /dev/null > +++ b/Documentation/admin-guide/hw-vuln/l1d_flush.rst > @@ -0,0 +1,40 @@ > +L1D Flushing for the paranoid > +============================= > + > +With an increasing number of vulnerabilities being reported around data > +leaks from L1D, a new user space mechanism to flush the L1D cache on > +context switch is added to the kernel. This should help address > +CVE-2020-0550 and for paranoid applications, keep them safe from any > +yet to be discovered vulnerabilities, related to leaks from the L1D > +cache. > + > +Tasks can opt in to this mechanism by using an architecture specific > +prctl (x86 only at the moment). > + > +Related CVES CVEs > +------------ > +At the present moment, the following CVEs can be addressed by this > +mechanism > + > + ============= ======================== ================== > + CVE-2020-0550 Improper Data Forwarding OS related aspects > + ============= ======================== ================== > + > +Usage Guidelines > +---------------- > +Applications can call ``arch_prctl(2)`` with one of these two arguments end above sentence with period or colon (colon might require the following bullet items to be indented -- I'm not sure about that). > + > +1. ARCH_SET_L1D_FLUSH - flush the L1D cache on context switch (out) > +2. ARCH_GET_L1D_FLUSH - get the current state of the L1D cache flush, returns 1 > + if set and 0 if not set. > + > +**NOTE**: The feature is disabled by default, applications to need to specifically default; applications need to > +opt into the feature to enable it. > + > +Mitigation > +---------- > +When ARCH_SET_L1D_FLUSH is enabled for a task, on switching tasks (when > +the address space changes), a flush of the L1D cache is performed for > +the task when it leaves the CPU. If the underlying CPU supports L1D > +flushing in hardware, the hardware mechanism is used, otherwise a software > +fallback, similar to the mechanism used by L1TF is used. > thanks. -- ~Randy