Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3821471pxu; Mon, 30 Nov 2020 10:57:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcVd4uw3td2rXeH3vfp8hGRE1pb+z27DcohfR93ZESmVUTc+cVbam602XVlh/IiYThjDWR X-Received: by 2002:a05:6402:895:: with SMTP id e21mr9909093edy.284.1606762674745; Mon, 30 Nov 2020 10:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606762674; cv=none; d=google.com; s=arc-20160816; b=FTg/VbXIFkeohR86dNR67e3QsdZXziqOIu3ZtL+51reeOMAwy15nYVpqi9xwsH9gg7 U0CbqQazZnuoFSXDFW98YUgpTDWVu6/uMq2pZzBe1TW4K4FZVerw4bHkjdWr6DgH13hl nb9vKHxEU98RFyzubWRyGW8gSvq4uo0dcVP4HrdH2MMNKmTGZbQwOSKURHKYe6RmNIjL bdvo6+p5sbNd7eoc11Btg6qUr1WCoIcjsr+UYRagVu1JEuJaxm5lPdZRKsOvCILxhIUS QLRjP18XQN7jfkpnDa5lierVACO3jzaDQJ5ODqUinjNIUmwtsAIKNtSeW1DLBYiqHiI8 NjdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Vx4/FiJNN1SrwnDdCOvxazqKVfbLGSmLYwYBmUjLLI=; b=FdMI0aMyb8NWU5c1uYPe830bZjViEVZVFjl4+pzCEIx+Qhr3WkARsJbAfYilBmcLum ylUDOjeIQ8ebhHnM0uLx0qQVYJvKpqv6iZh8GysJMXUZ8TvwLr5r1uzrHPCi1VL3oDNj Be/2wKwyeKzAgzsa7Z1SQruU4V4sc3OtjvARplgIGFrCDliM/RXVzDbYDX0gd/q5afq7 MYKxvLiI6ySZAiwAzBDicrMdw8ZoJMZBYx2lxnXwvCaUJ4mK/q+j5M0jgXULq2FIKe9C yCS8BwEkb089fiI5ubiAb5HtdXmobAqj+8BIB1qFYWBsihy3HRGRNzNS1ONiWrwDwtjv JsDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IxPlmO7G; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si11544523edt.49.2020.11.30.10.57.32; Mon, 30 Nov 2020 10:57:54 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=IxPlmO7G; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728764AbgK3Szq (ORCPT + 99 others); Mon, 30 Nov 2020 13:55:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgK3Szp (ORCPT ); Mon, 30 Nov 2020 13:55:45 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D326C0613CF for ; Mon, 30 Nov 2020 10:55:05 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id n137so11021990pfd.3 for ; Mon, 30 Nov 2020 10:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0Vx4/FiJNN1SrwnDdCOvxazqKVfbLGSmLYwYBmUjLLI=; b=IxPlmO7GPxYk8jDbcom3XunGu65QwSmt67V98TljR9QJZexOLAyVEbotoWLPxsrS6m Dnq4QqjuXfLwKLMPfQs5c0wc/yCAbtCPwg7+uZR8pWHxjz/UNzO83Wm9CTpjQCvc/ALO eeBB7PtJ4TOJiaoTkkxJbZJG37q+I2/zROTPluZYwiMWX5XlQHsZjhkxbhatEdCXeeOQ 8ohdclWfKHv8Xyf5/vXUEAl82Pk6EY87ASvTSZz/HDxWZeUT4H/YVxM0D7XeP1yWANcl excDDyuHPC6zb63K46lD5AerDoL6LsmeKOzg1r1mk3jPC+E++eEUbBwrvwhRI6dGwzIQ FxyA== 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:references :mime-version:content-disposition:in-reply-to; bh=0Vx4/FiJNN1SrwnDdCOvxazqKVfbLGSmLYwYBmUjLLI=; b=fcOeIO5mvjiCsyc2JDX4JnFxW3GkI1v4guV8NhrUGIvVrWKBsBxNlhZhQWPAYoXSyu EvR9TuG2nyxTyIsg6h+4sJ3gNyDc0gmE6J8SHoSC2FQgwcKlazq+t12i7aN4vtgX1gyL QF1YtsUawOWKl5S8Tju/QWIGcD9Zw0emEymInaJoUdkruEdxK9br1ZYry3K54h8alj0c 9IOqwc2DkXVJMXQGAlQ765xmKomsjo1D/sRLvhlPToEMYLYhC1/z+SzWudgEJcVDZOmh 4jtQi/1oEhPDqSdgICJvwEcm17lNYGkwWFkJlqPzkP2cusQKc6XkPaNcEkgp6XPggURo a0RA== X-Gm-Message-State: AOAM531fq/OJp+iN5bzAArIoRLblrOmMcAhZlAf/Rs/7KAhoRLu+3Ia0 lFWANJfZ5fbaGeuUKhr0Gjdr3g== X-Received: by 2002:a65:68cd:: with SMTP id k13mr8988005pgt.115.1606762504810; Mon, 30 Nov 2020 10:55:04 -0800 (PST) Received: from google.com ([2620:0:1008:11:7220:84ff:fe09:dc21]) by smtp.gmail.com with ESMTPSA id p127sm17718569pfp.93.2020.11.30.10.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 10:55:03 -0800 (PST) Date: Mon, 30 Nov 2020 10:55:00 -0800 From: Tom Roeder To: Keith Busch Cc: Christoph Hellwig , Jens Axboe , Sagi Grimberg , Peter Gonda , Marios Pomonis , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] nvme: Cache DMA descriptors to prevent corruption. Message-ID: <20201130185500.GB744128@google.com> References: <20201120012738.2953282-1-tmroeder@google.com> <20201120080243.GA20463@lst.de> <20201120142954.GC2855047@dhcp-10-100-145-180.wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20201120142954.GC2855047@dhcp-10-100-145-180.wdc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 06:29:54AM -0800, Keith Busch wrote: >On Fri, Nov 20, 2020 at 09:02:43AM +0100, Christoph Hellwig wrote: >> On Thu, Nov 19, 2020 at 05:27:37PM -0800, Tom Roeder wrote: >> > This patch changes the NVMe PCI implementation to cache host_mem_descs >> > in non-DMA memory instead of depending on descriptors stored in DMA >> > memory. This change is needed under the malicious-hypervisor threat >> > model assumed by the AMD SEV and Intel TDX architectures, which encrypt >> > guest memory to make it unreadable. Some versions of these architectures >> > also make it cryptographically hard to modify guest memory without >> > detection. >> >> I don't think this is a useful threat model, and I've not seen a >> discussion on lkml where we had any discussion on this kind of threat >> model either. >> >> Before you start sending patches that regress optimizations in various >> drivers (and there will be lots with this model) we need to have a >> broader discussion first. >> >> And HMB support, which is for low-end consumer devices that are usually >> not directly assigned to VMs aren't a good starting point for this. > >Yeah, while doing this for HMB isn't really a performance concern, this >method for chaining SGL/PRP lists would be. I see that this answers a question I just asked in my reply to the previous message. Sorry about that. Can you please point me to the code in question? > >And perhaps more importantly, the proposed mitigation only lets the >guest silently carry on from such an attack while the device is surely >corrupting something. I think we'd rather free the wrong address since >that may at least eventually raise an error. From a security perspective, I'd rather not free the wrong address, since that could lead to an attack on the guest (use-after-free). But I agree with the concern about fixing the problem silently. Maybe this code should instead raise an error itself in this case after comparing the cached values with the values stored in the DMA memory?