Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E39C5519F for ; Mon, 30 Nov 2020 07:36:07 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF2FB20731 for ; Mon, 30 Nov 2020 07:36:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="RcYanMpn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF2FB20731 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.40674.73602 (Exim 4.92) (envelope-from ) id 1kjdih-00073T-E1; Mon, 30 Nov 2020 07:35:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 40674.73602; Mon, 30 Nov 2020 07:35:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kjdih-00073M-B4; Mon, 30 Nov 2020 07:35:35 +0000 Received: by outflank-mailman (input) for mailman id 40674; Mon, 30 Nov 2020 07:35:34 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kjdig-00073H-1B for xen-devel@lists.xenproject.org; Mon, 30 Nov 2020 07:35:34 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id be8e66e1-26ce-42d9-b49d-adc60253e2c2; Mon, 30 Nov 2020 07:35:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 75E43AC8F; Mon, 30 Nov 2020 07:35:31 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: be8e66e1-26ce-42d9-b49d-adc60253e2c2 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606721731; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2lNdcgcw4Oq/TdpjNWbuo+EE/TpgKTTUxuSiEeo+3Dg=; b=RcYanMpn7DNoZNiOlzmIJ7rbb97UIeoFattq2DiIlmk9ZFbdr0YxYJKa9cno3Happd/0vH XkiK6zmtqDlyWKKu2mzUScIUbPIsPrJ9yQb0bJ0stEu1FwDiSQxdjxwKqG4Mn1ITGU+t5+ phpGdMknzganw4Mhtfgl+tfHkJb+pt4= Subject: Re: [PATCH v4] IOMMU: make DMA containment of quarantined devices optional To: "Tian, Kevin" Cc: "Cooper, Andrew" , Paul Durrant , "xen-devel@lists.xenproject.org" References: From: Jan Beulich Message-ID: <9ad2b898-16d8-9f80-b6ef-8f618419d369@suse.com> Date: Mon, 30 Nov 2020 08:35:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 30.11.2020 07:13, Tian, Kevin wrote: >> From: Jan Beulich >> Sent: Saturday, November 28, 2020 12:46 AM >> >> @@ -1316,11 +1316,32 @@ boolean (e.g. `iommu=no`) can override t >> will prevent Xen from booting if IOMMUs aren't discovered and enabled >> successfully. >> >> -* The `quarantine` boolean can be used to control Xen's behavior when >> - de-assigning devices from guests. If enabled (the default), Xen always >> +* The `quarantine` option can be used to control Xen's behavior when >> + de-assigning devices from guests. >> + >> + When a PCI device is assigned to an untrusted domain, it is possible >> + for that domain to program the device to DMA to an arbitrary address. >> + The IOMMU is used to protect the host from malicious DMA by making >> + sure that the device addresses can only target memory assigned to the >> + guest. However, when the guest domain is torn down, assigning the >> + device back to the hardware domain would allow any in-flight DMA to >> + potentially target critical host data. To avoid this, quarantining >> + should be enabled. Quarantining can be done in two ways: In its basic >> + form, all in-flight DMA will simply be forced to encounter IOMMU >> + faults. Since there are systems where doing so can cause host lockup, >> + an alternative form is available where writes to memory will be made >> + fault, but reads will be directed to a dummy page. The implication >> + here is that such reads will go unnoticed, i.e. an admin may not >> + become aware of the underlying problem. >> + >> + Therefore, if this option is set to true (the default), Xen always >> quarantines such devices; they must be explicitly assigned back to Dom0 >> - before they can be used there again. If disabled, Xen will only >> - quarantine devices the toolstack hass arranged for getting quarantined. >> + before they can be used there again. If set to "scratch-page", still >> + active DMA reads will additionally be directed to a "scratch" page. If >> + set to false, Xen will only quarantine devices the toolstack has arranged >> + for getting quarantined. > > Here let's be clear about the quarantine policy when the quarantine > devices are arranged by toolstack. Based on this patch it is the 'basic' > form i.e. always getting IOMMU faults for such devices. Well, the policy is always as chosen via command line. Therefore do you perhaps merely mean the default mode to be spelled out? This is already the case at the beginning of the 2nd paragraph. > One may further ask whether we should allow toolstack to specify > the quarantine form for such devices. I don't have a strong opinion > here, as imo the users should be encouraged to always do quarantine > then the toolstack way is more like a niche thing and could be kept > simple like this patch. That's certainly a further option, but none I'd like to pursue right away. Jan