Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp401282ybb; Wed, 8 Apr 2020 02:04:53 -0700 (PDT) X-Google-Smtp-Source: APiQypKx3/DeY2H3110SkKUaEcEL3JvCRx9/dDbON5N14EmDqd7IoP9WJRnqJ5hGDgVAV4jy59ny X-Received: by 2002:a9d:4c8d:: with SMTP id m13mr372399otf.258.1586336692606; Wed, 08 Apr 2020 02:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586336692; cv=none; d=google.com; s=arc-20160816; b=MdrIY5mxvcNbWiv1g4+Fut6zyOUfm1uOSnRgTSiyTn14Qc+nDEXaY8KItiVxkG31+X kRSSC6fW8w+KsMMZNnSuN85HRMs+iyiSCnh+pPeoUkzEcbjoEyRyrzZyQM/1J5hku37X RzZuhE0GdcmJTns1Q6Pb1sFnUeuqeHuvwJZCUBZqkGzW2rdANhmkRu7L/aC2fWTPaklS p8pibV1tXyxWgdY0SqwUQGiBesscOG0hCzRagXRuhO5pyvLrVt0CzXDEpnHACzZOO1Sq e46FSeyU8A72w9r1FlnbDQKYfaBAILy32M7WReSQuMblLu+lObUYFW4ZVHw8VUnS1QX8 1CLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=5qCpvPW1FTnWyJFzXG8fIzft16iLqTfuHYxmGpAAwDo=; b=AH/209X921QzWcgE3WcWI+27LugWMfaVmS8c2PFdYJo2E1c2QLUxfDXAfT7Mwv29xv wZLSUubt/4fuu0F99OY1bbnI4HU9LQowyFZighSJv1x+Vp+6hMGAL7CVdX1VznxbX6Cx sJ3UXd3AgntamS4ovoay40QTUgNXrBnG51ViUAKqkdyaXGeDskgn8vKqualzJFJ/GwPf +ZAw9Z0hZ9f0JHa2S5LTdxkifRzDbWLSpoDgsxeU5YnjGNFzAtjfdGuRf1loKi7uINnp I+KxghMFsYPrPCOH7NpKffSO9GUx0deCPS+9n4Ybrbuk0myG4tl31C8DFYxQFo3A+qTs EqEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=oSXlxd0A; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c67si2208735oif.5.2020.04.08.02.04.37; Wed, 08 Apr 2020 02:04:52 -0700 (PDT) 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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=oSXlxd0A; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727824AbgDHJDH (ORCPT + 99 others); Wed, 8 Apr 2020 05:03:07 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:26841 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgDHJDH (ORCPT ); Wed, 8 Apr 2020 05:03:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1586336587; x=1617872587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=5qCpvPW1FTnWyJFzXG8fIzft16iLqTfuHYxmGpAAwDo=; b=oSXlxd0AK7RuK/zqJhAe/hYRZQNT2Emk2EDpT5ApHcWewfecESCNtjTE WZHCzRtL02RJqIlXY5GvoQGlcpbXHL5FDPza6CtAgxgFbiI5M6Rae89hW nzKiq2eIhJWS5Yogb6fwSwUmXUhqm50UlI9DqrxQlHBa5mqeiJdOb5i23 U=; IronPort-SDR: DCFeKtUu9ilBreICB13Oh/Zhb5hZSIvq+YJkPAwdpXzceCYA9aRJxuxhbZuyWLIneLQN1OdUHm qECqENbWwTqA== X-IronPort-AV: E=Sophos;i="5.72,357,1580774400"; d="scan'208";a="37342120" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-69849ee2.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 08 Apr 2020 09:03:07 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-69849ee2.us-west-2.amazon.com (Postfix) with ESMTPS id DD724A3D25; Wed, 8 Apr 2020 09:03:05 +0000 (UTC) Received: from EX13D01UWB004.ant.amazon.com (10.43.161.157) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Apr 2020 09:02:57 +0000 Received: from EX13MTAUEA002.ant.amazon.com (10.43.61.77) by EX13d01UWB004.ant.amazon.com (10.43.161.157) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Apr 2020 09:02:56 +0000 Received: from localhost (10.85.0.235) by mail-relay.amazon.com (10.43.61.169) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 8 Apr 2020 09:02:55 +0000 From: Balbir Singh To: , CC: , , , , , , "Balbir Singh" Subject: [PATCH v3 5/5] arch/x86: Add L1D flushing Documentation Date: Wed, 8 Apr 2020 19:02:29 +1000 Message-ID: <20200408090229.16467-6-sblbir@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200408090229.16467-1-sblbir@amazon.com> References: <20200408090229.16467-1-sblbir@amazon.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/index.rst b/Documentation/admin-guide/hw-vuln/index.rst index 0795e3c2643f..35633b299d45 100644 --- a/Documentation/admin-guide/hw-vuln/index.rst +++ b/Documentation/admin-guide/hw-vuln/index.rst @@ -14,3 +14,4 @@ are configurable at compile, boot or run time. mds tsx_async_abort multihit.rst + l1d_flush 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..7d515b8c29f1 --- /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 a prctl (implemented only +for x86 at the moment). + +Related 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 ``prctl(2)`` with one of these two arguments + +1. PR_SET_L1D_FLUSH - flush the L1D cache on context switch (out) +2. PR_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 +opt into the feature to enable it. + +Mitigation +---------- +When PR_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. -- 2.17.1