IOMMU: make DMA containment of quarantined devices optional
PATCH v2 1/1 IOMMU: make DMA containment of quarantined devices optional
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit ea38867831da ("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" in domain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.
In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the allocate_domain_resources() invocation from reassign_device() to amd_iommu_setup_domain_device() (or else reassign_device() would allocate a root page table anyway); this is benign to the second caller of the latter function.
---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revert ea38867831da from the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
I'm happy to take better suggestions to replace "full".
---
v2: Don't use true/false. Introduce QUARANTINE_SKIP() (albeit I'm not
really convinced this is an improvement). Add comment.
docs/misc/xen-command-line.pandoc +8 -6
@@ -1232,7 +1232,7 @@ detection of systems known to misbehave > Default: `new` unless directed-EOI is supported ### iommu - = List of [ <bool>, verbose, debug, force, required, quarantine, + = List of [ <bool>, verbose, debug, force, required, quarantine[=full], sharept, intremap, intpost, crash-disable, snoop, qinval, igfx, amd-iommu-perdev-intremap, dom0-{passthrough,strict} ]
@@ -1270,11 +1270,13 @@ 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 - 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. +* The `quarantine` option can be used to control Xen's behavior when + de-assigning devices from guests. If 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 set to "full", still + active DMA will additionally be directed to a "sink" page. If set to + false, Xen will only quarantine devices the toolstack has arranged for + getting quarantined. * The `sharept` boolean controls whether the IOMMU pagetables are shared with the CPU-side HAP pagetables, or allocated separately. Sharing
xen/drivers/passthrough/amd/pci_amd_iommu.c +32 -21
111 lines not on this page · raw message
xen/drivers/passthrough/iommu.c +8 -2
@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable; +#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic; + static bool __hwdom_initdata iommu_hwdom_none; bool __hwdom_initdata iommu_hwdom_strict;bool __read_mostly iommu_hwdom_passthrough;
@@ -81,6 +85,8 @@ static int __init parse_iommu_param(cons force_iommu = val; else if ( (val = parse_boolean("quarantine", s, ss)) >= 0 ) iommu_quarantine = val; + else if ( ss == s + 15 && !strncmp(s, "quarantine=full", 15) ) + iommu_quarantine = IOMMU_quarantine_full; else if ( (val = parse_boolean("igfx", s, ss)) >= 0 ) iommu_igfx = val; else if ( (val = parse_boolean("verbose", s, ss)) >= 0 )
@@ -451,7 +457,7 @@ static int __init iommu_quarantine_init( dom_io->options |= XEN_DOMCTL_CDF_iommu; rc =iommu_domain_init (dom_io,0 ); -if ( rc ) +if ( rc || iommu_quarantine < IOMMU_quarantine_full )return rc;if ( !hd->platform_ops->quarantine_init )
xen/drivers/passthrough/vtd/iommu.c +17 -12
@@ -41,6 +41,9 @@#include "vtd.h" #include "../ats.h" +/* dom_io is used as a sentinel for quarantined devices */ +#define QUARANTINE_SKIP (d) ((d) == dom_io && !dom_iommu(d)->arch.pgd_maddr) +struct mapped_rmrr {struct list_head list;u64 base, end;
@@ -1291,6 +1294,9 @@ int domain_context_mapping_one(int agaw, rc, ret;bool_t flush_dev_iotlb; +if (QUARANTINE_SKIP (domain) ) +return 0 ; +ASSERT (pcidevs_locked ());spin_lock (&iommu->lock); maddr =bus_to_context_maddr (iommu, bus);
@@ -1537,6 +1543,9 @@ int domain_context_unmap_one(int iommu_domid, rc, ret;bool_t flush_dev_iotlb; +if (QUARANTINE_SKIP (domain) ) +return 0 ; +ASSERT (pcidevs_locked ());spin_lock (&iommu->lock);
@@ -1598,7 +1607,7 @@ static int domain_context_unmap(struct d {struct acpi_drhd_unit *drhd;struct vtd_iommu *iommu; -int ret =0 ; +int ret;u8 seg = pdev->seg, bus = pdev->bus, tmp_bus, tmp_devfn, secbus;int found =0 ;
@@ -1614,14 +1623,12 @@ static int domain_context_unmap(struct dprintk (VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u unmap\n" , domain->domain_id, seg, bus,PCI_SLOT (devfn),PCI_FUNC (devfn)); -if ( !is_hardware_domain (domain) ) -return -EPERM ; - goto out; +return is_hardware_domain (domain) ?0 : -EPERM ;case DEV_TYPE_PCIe_BRIDGE:case DEV_TYPE_PCIe2PCI_BRIDGE:case DEV_TYPE_LEGACY_PCI_BRIDGE : - goto out; +return 0 ;case DEV_TYPE_PCIe_ENDPOINT:if ( iommu_debug )
@@ -1665,10 +1672,12 @@ static int domain_context_unmap(struct d dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n", domain->domain_id, pdev->type, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - ret = -EINVAL ; - goto out; +return -EINVAL ; } +if (QUARANTINE_SKIP (domain) ) +return ret; +/* * if no other devices under the same iommu owned by this domain, * clear iommu in iommu_bitmap and clear domain_id in domid_bitmp
@@ -1694,16 +1703,12 @@ static int domain_context_unmap(struct d iommu_domid =domain_iommu_domid (domain, iommu);if ( iommu_domid ==-1 ) - { - ret = -EINVAL ; - goto out; - } +return -EINVAL ;clear_bit (iommu_domid, iommu->domid_bitmap); iommu->domid_map[iommu_domid] =0 ; } -out:return ret; }
xen/include/xen/iommu.h +3 -1
@@ -53,8 +53,10 @@ static inline bool_t dfn_eq(dfn_t x, dfn }extern bool_t iommu_enable, iommu_enabled; -extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; +extern bool force_iommu, iommu_verbose, iommu_igfx;extern bool_t iommu_snoop, iommu_qinval, iommu_intremap, iommu_intpost; +/* Boolean except for the specific purposes of drivers/passthrough/iommu.c. */ +extern uint8_t iommu_quarantine;#if defined(CONFIG_IOMMU_FORCE_PT_SHARE )#define iommu_hap_pt_share true
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.
Quoted 8 lines
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
I'm not really sure we really need to revert ea38867831da before the 4.13 release. It might not be optimal, but I'm quite sure the number of cases where this could be an issue is rather small already, and I tend to agree with Paul that admins who really care will more likely want to select the option where the system will "just work". IMO the "noticeable failure" is something which will be selected mostly by developers. But I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.
In case we have a successful OSStest run soon I planned to do the release without this patch.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 31 lines · Jürgen Groß
Quoted 21 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Quoted 8 lines
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
Quoted 8 lines
I'm not really sure we really need to revert
ea38867831dabefore the 4.13 release. It might not be optimal, but I'm quite sure the number of cases where this could be an issue is rather small already, and I tend to agree with Paul that admins who really care will more likely want to select the option where the system will "just work". IMO the "noticeable failure" is something which will be selected mostly by developers. But I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.
An admin not wanting to know is, to me, the same as them not wanting to know about security issues, and hence not subscribing to our announcements lists. I can accept this being a reasonable thing to do when it is an _informed_ decision. But with the current arrangements there's no way whatsoever for an admin to know.
Furthermore, once we ship a release with the defaults as they currently are, changing the defaults again may be perceived as a regression, which I think we should (want to) avoid.
Quoted 2 lines
In case we have a successful OSStest run soon I planned to do the release without this patch.
I very much disagree - the patch shouldn't have been put in without having heard back from Kevin. But yes, you're the release manager.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 41 lines · Jan Beulich
Quoted 31 lines · Jürgen Groß
Quoted 21 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Quoted 8 lines
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)Quoted 8 lines
I'm not really sure we really need to revert
ea38867831dabefore the 4.13 release. It might not be optimal, but I'm quite sure the number of cases where this could be an issue is rather small already, and I tend to agree with Paul that admins who really care will more likely want to select the option where the system will "just work". IMO the "noticeable failure" is something which will be selected mostly by developers. But I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.
Quoted 5 lines
An admin not wanting to know is, to me, the same as them not wanting to know about security issues, and hence not subscribing to our announcements lists. I can accept this being a reasonable thing to do when it is an _informed_ decision. But with the current arrangements there's no way whatsoever for an admin to know.
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 48 lines · Jürgen Groß
Quoted 41 lines · Jan Beulich
Quoted 31 lines · Jürgen Groß
Quoted 21 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Quoted 8 lines
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)Quoted 8 lines
I'm not really sure we really need to revert
ea38867831dabefore the 4.13 release. It might not be optimal, but I'm quite sure the number of cases where this could be an issue is rather small already, and I tend to agree with Paul that admins who really care will more likely want to select the option where the system will "just work". IMO the "noticeable failure" is something which will be selected mostly by developers. But I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.Quoted 5 lines
An admin not wanting to know is, to me, the same as them not wanting to know about security issues, and hence not subscribing to our announcements lists. I can accept this being a reasonable thing to do when it is an _informed_ decision. But with the current arrangements there's no way whatsoever for an admin to know.
Quoted 4 lines
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 54 lines · Jan Beulich
Quoted 48 lines · Jürgen Groß
Quoted 41 lines · Jan Beulich
Quoted 31 lines · Jürgen Groß
Quoted 21 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Quoted 8 lines
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)Quoted 8 lines
I'm not really sure we really need to revert
ea38867831dabefore the 4.13 release. It might not be optimal, but I'm quite sure the number of cases where this could be an issue is rather small already, and I tend to agree with Paul that admins who really care will more likely want to select the option where the system will "just work". IMO the "noticeable failure" is something which will be selected mostly by developers. But I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.Quoted 5 lines
An admin not wanting to know is, to me, the same as them not wanting to know about security issues, and hence not subscribing to our announcements lists. I can accept this being a reasonable thing to do when it is an _informed_ decision. But with the current arrangements there's no way whatsoever for an admin to know.
Quoted 4 lines
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
So what are the security problems which are added by this behavior?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 99 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Jürgen Groß
Sent: 13 December 2019 13:47
To: Jan Beulich <[email protected]>
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Paul Durrant <[email protected]>; Ian Jackson <[email protected]>; xen- [email protected]; Roger Pau Monné <[email protected]>
Subject: Re: [Xen-devel] [PATCH v2] IOMMU: make DMA containment of quarantined devices optionalQuoted 8 lines · Jan Beulich
Quoted 7 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Jürgen Groß
Quoted 4 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
a mode where admins may not even become aware of issues with devices
can
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be considered undesirable. Therefore convert this mode of operation
to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu:set
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
up a scratch page in the quarantine domain") did remove, in a
slightly
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
extended and abstracted fashion. Here, instead of reintroducing a
pretty
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
pointless use of "goto" in
domain_context_unmap(), and instead ofmaking
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the function (at least temporarily) inconsistent, take the
opportunity
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
and replace the other similarly pointless "goto" as well.
In order to key the re-instated bypasses off of there (not) being a
root
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
page table this further requires moving the
allocate_domain_resources()Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
invocation from
reassign_device()toamd_iommu_setup_domain_device()(or
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
else
reassign_device()would allocate a root page table anyway);this is
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
benign to the second caller of the latter function.
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to anagreement
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
here, the only other option is to revert
ea38867831dafrom thebranch,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
for having been committed prematurely (I'm not so much worried about
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
master branch, where we have ample time until 4.14). What I surely
want
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to see us avoid is a back and forth in behavior of released
versions.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(Note that 4.12.2 is similarly blocked on a decision either way
here.)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I'm not really sure we really need to revert
ea38867831dabefore the 4.13 release. It might not be optimal, but I'm quite sure the numberof
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cases where this could be an issue is rather small already, and I
tend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to agree with Paul that admins who really care will more likely want
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
select the option where the system will "just work". IMO the
"noticeable
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
failure" is something which will be selected mostly by developers.
But
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
I'm not an expert in that area, so I don't want to influence the decision regarding the to be selected default too much.
An admin not wanting to know is, to me, the same as them not wanting to know about security issues, and hence not subscribing to our announcements lists. I can accept this being a reasonable thing to do when it is an _informed_ decision. But with the current arrangements there's no way whatsoever for an admin to know.
Quoted 4 lines
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
That's right.
Quoted 3 lines
So what are the security problems which are added by this behavior?
Since *not* having the 'sink' page allows a guest pull off a host DoS in the presence of such h/w, security is surely increased by having it?
Paul
Quoted 7 lines
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Paul
Since *not* having the 'sink' page allows a guest pull off a host DoS in the presence of such h/w, security is surely increased by having it?
host device result w/o sink result w/ sink
good good good good
good babbling good good
wedge on fault good DoS (runtime) DoS (runtime)
wedge on fault babbling DoS (runtime/late) DoS (runtime only, silent)
I wouldn't call it an increase of security to fully hide post- deassignment issues without doing anything about issues that can arise while the device is still assigned.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Jan Beulich
Quoted 2 lines · Paul
Since *not* having the 'sink' page allows a guest pull off a host DoS in the presence of such h/w, security is surely increased by having it?
host device result w/o sink result w/ sink
good good good good
good babbling good good
wedge on fault good DoS (runtime) DoS (runtime)
I guess the DoS cases here are due to malicious guest actions?
Quoted 1 line
wedge on fault babbling DoS (runtime/late) DoS (runtime only, silent)
And why is the sink page resulting in a silent DoS here?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Jürgen Groß
Quoted 8 lines · Jan Beulich
Quoted 2 lines · Paul
Since *not* having the 'sink' page allows a guest pull off a host DoS in the presence of such h/w, security is surely increased by having it?
host device result w/o sink result w/ sink
good good good good
good babbling good good
wedge on fault good DoS (runtime) DoS (runtime)I guess the DoS cases here are due to malicious guest actions?
Yes.
Quoted 3 lines
Quoted 1 line
wedge on fault babbling DoS (runtime/late) DoS (runtime only, silent)
And why is the sink page resulting in a silent DoS here?
Sorry, space restrictions may have lead to this being ambiguous:
There's still the runtime DoS; the would-be-DoS after deassignment will go entirely silent (i.e. without making the admin aware of the situation, not allowing them to take precautions against the runtime aspects of this).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 1 line
So what are the security problems which are added by this behavior?
There are no problems added; there are problems hidden from admins.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 24 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
Quoted 9 lines
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
The malicious guest case would be caught without your patch as well. And most cases of device unassignment would be fine, too, as a normal guest shutdown/reboot includes stopping I/O activity.
Quoted 4 lines
Quoted 2 lines
So what are the security problems which are added by this behavior?
There are no problems added; there are problems hidden from admins.
In my understanding in some corner cases, yes.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 35 lines · Jürgen Groß
Quoted 24 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
Quoted 9 lines
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 42 lines · Jan Beulich
Quoted 35 lines · Jürgen Groß
Quoted 24 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
Quoted 9 lines
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 53 lines · Jürgen Groß
Quoted 42 lines · Jan Beulich
Quoted 35 lines · Jürgen Groß
Quoted 24 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
Quoted 6 lines
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 8 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to happen resulting in a more stable system.
Quoted 9 lines
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
Quoted 6 lines
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
I'm afraid this way we can debate endlessly, because it's not like there's a clear winner here.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 57 lines
From: Jürgen Groß <[email protected]>
Sent: Friday, December 13, 2019 11:36 PMQuoted 17 lines · Jan Beulich
Quoted 16 lines · Jürgen Groß
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 12 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to
happen
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
Quoted 1 line
resulting in a more stable system.
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
Quoted 7 lines
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
I'd suggest separating run-time DoS from original quarantine purpose of this patch.
For quarantine, I'm with Jan that giving admin the chance of knowing whether quarantine is required is important. Say an admin just gets a sample device from a new vendor and needs to decide whether his employer should put such device in their production system. It's essential to have a default configuration which can warn on any possible violation of the expectations on a good assignable device. Then the admin can look at Xen user guide to find out what the warning information means and then does whatever required (usually means more scrutinization than the warning itself) to figure out whether identified problems are safe (e.g. by enabling quarantine) or are real indicators of bogus implementation (then should not use it). Having quarantine default on means that every admin should remember that Xen already enables some band-aids on benign warnings so he should explicitly turn off those options to do evaluation which, to me is not realistic.
On the other hand, although a sink page can help mitigate run-time DoS, how to handle it should be an admin policy. If DoS is caused by malicious guest, it makes more sense to warn the admin and then switch to sink page after meeting a DoS detection condition (e.g. number of faults within a timing window exceeds a threshold). Lots of such warnings from multiple VMs may imply a massive attack then the admin may adopt more comprehensive analysis or defensive means. Then it's also possible that DoS is caused by a vulnerability within the guest. In such case, the guest may want to contain the DoS attack itself through a virtual IOMMU. Then Xen needs to know the fault and then forward to the guest through the vIOMMU. In either case I don't think current patch is sufficient. So it's better to leave DoS improved separately (of course the sink logic can be leveraged), given the timeline of 4.13.
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 68 lines · Kevin
Quoted 57 lines
From: Jürgen Groß <[email protected]>
Sent: Friday, December 13, 2019 11:36 PMQuoted 17 lines · Jan Beulich
Quoted 16 lines · Jürgen Groß
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 12 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to
happen
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
Quoted 1 line
resulting in a more stable system.
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
Quoted 7 lines
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
I'd suggest separating run-time DoS from original quarantine purpose of this patch.
Quoted 15 lines
For quarantine, I'm with Jan that giving admin the chance of knowing whether quarantine is required is important. Say an admin just gets a sample device from a new vendor and needs to decide whether his employer should put such device in their production system. It's essential to have a default configuration which can warn on any possible violation of the expectations on a good assignable device. Then the admin can look at Xen user guide to find out what the warning information means and then does whatever required (usually means more scrutinization than the warning itself) to figure out whether identified problems are safe (e.g. by enabling quarantine) or are real indicators of bogus implementation (then should not use it). Having quarantine default on means that every admin should remember that Xen already enables some band-aids on benign warnings so he should explicitly turn off those options to do evaluation which, to me is not realistic.
This implies the admin is aware of the necessity to do that testing. And for the tests to be conclusive he probably needs to do more than just a basic "does it work" test, as the pending DMA might occur in some cases only. And that is basically my problem with Jan's default:
an admin not doing enough testing (or non at all) will end up with a DoS situation in production, while an admin knowing that he needs to test properly is probably more aware of the needed command line option for evaluation of the device's security relevance.
Its a complex problem and I think the decision for the default should not be rushed. So I think it is best to discuss it on xen-devel and leave the patch out of the initial 4.13 release (this patch is the last pending one for 4.13 now). After a decision is made the patch can easily by backported to 4.13 in case it is regarded to be important.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 94 lines · Jürgen Groß
Quoted 68 lines · Kevin
Quoted 57 lines
From: Jürgen Groß <[email protected]>
Sent: Friday, December 13, 2019 11:36 PMQuoted 17 lines · Jan Beulich
Quoted 16 lines · Jürgen Groß
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Jürgen Groß
Quoted 12 lines · Jan Beulich
Quoted 4 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I doubt we'd get many reports about those in case your patch goes in.
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Do we _know_ those devices are problematic from security standpoint? Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to
happen
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
Quoted 1 line
resulting in a more stable system.
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
Quoted 7 lines
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
I'd suggest separating run-time DoS from original quarantine purpose of this patch.
Quoted 15 lines
For quarantine, I'm with Jan that giving admin the chance of knowing whether quarantine is required is important. Say an admin just gets a sample device from a new vendor and needs to decide whether his employer should put such device in their production system. It's essential to have a default configuration which can warn on any possible violation of the expectations on a good assignable device. Then the admin can look at Xen user guide to find out what the warning information means and then does whatever required (usually means more scrutinization than the warning itself) to figure out whether identified problems are safe (e.g. by enabling quarantine) or are real indicators of bogus implementation (then should not use it). Having quarantine default on means that every admin should remember that Xen already enables some band-aids on benign warnings so he should explicitly turn off those options to do evaluation which, to me is not realistic.
This implies the admin is aware of the necessity to do that testing. And for the tests to be conclusive he probably needs to do more than just a basic "does it work" test, as the pending DMA might occur in some cases only. And that is basically my problem with Jan's default:
an admin not doing enough testing (or non at all) will end up with a DoS situation in production, while an admin knowing that he needs to test properly is probably more aware of the needed command line option for evaluation of the device's security relevance.
Quoted 10 lines
Its a complex problem and I think the decision for the default should not be rushed. So I think it is best to discuss it on xen-devel and leave the patch out of the initial 4.13 release (this patch is the last pending one for 4.13 now). After a decision is made the patch can easily by backported to 4.13 in case it is regarded to be important.
Juergen
Isn't it possible to quarantine by default, but still detect if there is any (DMA) activity on that device and (perhaps after a certain threshold or short time) print a big fat (once or rate limited) warning in Xen logs that the device could be rogue and should be checked upon by an admin ?
--
Sander
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): AADFC41AFE54684AB9EE6CBC0274A5D19D642F5B@SHSMSX104.ccr.corp.intel.com
Quoted 89 lines
From: Tian, Kevin
Sent: Monday, December 16, 2019 1:58 PMQuoted 12 lines
From: Jürgen Groß <[email protected]>
Sent: Friday, December 13, 2019 11:36 PMQuoted 8 lines · Jan Beulich
Quoted 7 lines · Jürgen Groß
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Jürgen Groß
Quoted 4 lines · Jan Beulich
Quoted 3 lines · Jürgen Groß
Maybe I have misunderstood the current state, but I thought that it would just silently hide quirky devices without imposing a security risk. We would not learn which devices are quirky, but OTOH I
doubt
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 1 line
we'd get many reports about those in case your patch goes in.
We don't want or need such reports, that's not the point. The security risk comes from the quirkiness of the devices - admins may wrongly think all is well and expose quirky devices to not sufficiently trusted guests. (I say this fully realizing that exposing devices to untrusted guests is almost always a certain level of risk.)
Do we _know_ those devices are problematic from security
standpoint?
Quoted 35 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Normally the IOMMU should do the isolation just fine. If it doesn't then its not the quirky device which is problematic, but the IOMMU.
I thought the problem was that the quirky devices would not stop all (read) DMA even when being unassigned from the guest resulting in fatal IOMMU faults. The dummy page should stop those faults to
happen
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
Quoted 1 line
resulting in a more stable system.
IOMMU faults by themselves are not impacting stability (they will add processing overhead, yes). The problem, according to Paul's description, is that the occurrence of at least some forms of IOMMU faults (not present ones as it seems, as opposed to permission violation ones) is fatal to certain systems. Irrespective of the sink page used after de-assignment a guest can arrange for IOMMU faults to occur even while it still has the device assigned. Hence it is important for the admin to know that their system (not the the particular device) behaves in this undesirable way.
Quoted 5 lines
So how does the admin learn this? Its not as if your patch would result in a system crash or hang all the time, right? This would be the case only if there either is a malicious (on purpose or due to a bug) guest which gets the device assigned, or if there happens to be a pending DMA operation when the device gets unassigned.
Quoted 3 lines
I didn't claim the change would cover all cases. All I am claiming is that it increases the chances of admins becoming aware of reasons not to pass through devices to certain guests.
So combined with your answer this means to me:
With your patch (or the original one reverted) a DoS will occur either due to a malicious guest or in case a DMA is still pending. As a result the admin will no longer pass this device to any untrusted guest.
Quoted 7 lines
With the current 4.13-staging a DoS will occur only due to a malicious guest. The admin will then no longer pass this device to any untrusted guest.
So right now without any untrusted guest no DoS, while possibly DoS with your patch. How is that better?
I'd suggest separating run-time DoS from original quarantine purpose of this patch.
For quarantine, I'm with Jan that giving admin the chance of knowing whether quarantine is required is important. Say an admin just gets a sample device from a new vendor and needs to decide whether his employer should put such device in their production system. It's essential to have a default configuration which can warn on any possible violation of the expectations on a good assignable device. Then the admin can look at Xen user guide to find out what the warning information means and then does whatever required (usually means more scrutinization than the warning itself) to figure out whether identified problems are safe (e.g. by enabling quarantine) or are real indicators of bogus implementation (then should not use it). Having quarantine default on means that every admin should remember that Xen already enables some band-aids on benign warnings so he should explicitly turn off those options to do evaluation which, to me is not realistic.
Quoted 14 lines
On the other hand, although a sink page can help mitigate run-time DoS, how to handle it should be an admin policy. If DoS is caused by malicious guest, it makes more sense to warn the admin and then switch to sink page after meeting a DoS detection condition (e.g. number of faults within a timing window exceeds a threshold). Lots of such warnings from multiple VMs may imply a massive attack then the admin may adopt more comprehensive analysis or defensive means. Then it's also possible that DoS is caused by a vulnerability within the guest. In such case, the guest may want to contain the DoS attack itself through a virtual IOMMU. Then Xen needs to know the fault and then forward to the guest through the vIOMMU. In either case I don't think current patch is sufficient. So it's better to leave DoS improved separately (of course the sink logic can be leveraged), given the timeline of 4.13.
btw I forgot that today we already have some-level of DoS detection. You can check pci_check_disable_device, which exactly does above threshold check and then disable the PCI_COMMAND register. The missing part might be, the device still issues DMAs even after the disabling. In such case, at least VT-d allows the software to disable fault reporting on a given device. Such method betters suits warn-and-disable model upon DoS attacking than blindly setting up a sink page.
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 15 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.
Quoted 7 lines
In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Signed-off-by Jan Beulich <[email protected]>
I'm however not sure if the default quarantine mode should be the basic or the full one.
At the end of day the full one does prevent hard hangs on specific systems, but a guest with a device behind such bogus IOMMU can trivially trigger those anyway.
Quoted 9 lines
---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)I'm happy to take better suggestions to replace "full".
I was going to comment on v1, but I really have no better alternative.
Quoted 7 lines
xen/drivers/passthrough/iommu.c +0
-1@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;
xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 10 lines
xen/drivers/passthrough/iommu.c +4
-0bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable; +#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;
I wonder whether the default should be to use the sink page. Not using it can lead to a hard hang on certain hardware according to the description. OTOH if such devices are actually passed through, the guest itself can trigger such page faults and hence freeze the system.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 29 lines
From: Roger Pau Monné <[email protected]>
Sent: Friday, December 13, 2019 10:13 PMQuoted 5 lines · Jan Beulich
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices
can
Quoted 10 lines
be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.Quoted 3 lines
In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or
Quoted 4 lines
else
reassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Signed-off-by Jan Beulich <[email protected]>
Quoted 8 lines
Reviewed-by Roger Pau Monné <[email protected]>I'm however not sure if the default quarantine mode should be the basic or the full one.
At the end of day the full one does prevent hard hangs on specific systems, but a guest with a device behind such bogus IOMMU can trivially trigger those anyway.
It's a bogus device behind a good IOMMU. If IOMMU is bogus, we should not pass through devices behind it. 😊
Quoted 37 lines
Quoted 5 lines
---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried aboutthe
Quoted 5 lines
master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
I'm happy to take better suggestions to replace "full".
I was going to comment on v1, but I really have no better alternative.
Quoted 7 lines
xen/drivers/passthrough/iommu.c +0
-1@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 10 lines
xen/drivers/passthrough/iommu.c +4
-0bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable; +#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;I wonder whether the default should be to use the sink page. Not using it can lead to a hard hang on certain hardware according to the description. OTOH if such devices are actually passed through, the guest itself can trigger such page faults and hence freeze the system.
Quoted 1 line
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 45 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Jan Beulich
Sent: 13 December 2019 12:53
To: [email protected]
Cc: Juergen Gross <[email protected]>; Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Paul Durrant <[email protected]>; Ian Jackson <[email protected]>; Roger Pau Monné <[email protected]>
Subject: [Xen-devel] [PATCH v2] IOMMU: make DMA containment of quarantined devices optionalContaining still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
Quoted 1 line
I'm happy to take better suggestions to replace "full".
How about simply "sink", since that's what it does?
[snip]
Quoted 7 lines
xen/drivers/passthrough/iommu.c +0
-1@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;
xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 10 lines
xen/drivers/passthrough/iommu.c +4
-0bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable; +#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;
If we have 'IOMMU_quarantine_sink' instead of 'IOMMU_quarantine_full', then how about 'IOMMU_quarantine_write_fault' instead of 'IOMMU_quarantine_basic'?
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 45 lines · Paul
Quoted 45 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Jan Beulich
Sent: 13 December 2019 12:53
To: [email protected]
Cc: Juergen Gross <[email protected]>; Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Paul Durrant <[email protected]>; Ian Jackson <[email protected]>; Roger Pau Monné <[email protected]>
Subject: [Xen-devel] [PATCH v2] IOMMU: make DMA containment of quarantined devices optionalContaining still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" indomain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or elsereassign_device()would allocate a root page table anyway); this is benign to the second caller of the latter function.Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried about the master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
Quoted 3 lines
Quoted 1 line
I'm happy to take better suggestions to replace "full".
How about simply "sink", since that's what it does?
But it's not really a "sink", as we still fault writes (which is the only thing I can see to be "sunk" if I'm getting the meaning of the word right).
Quoted 13 lines
Quoted 13 lines
xen/drivers/passthrough/iommu.c +0
-1@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable;
Quoted 8 lines
xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 4 lines
xen/drivers/passthrough/iommu.c +4
-0+#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;If we have '
IOMMU_quarantine_sink' instead of 'IOMMU_quarantine_full', then how about 'IOMMU_quarantine_write_fault' instead of 'IOMMU_quarantine_basic'?
Why "write_fault"? Even in "full" mode you only avoid read faults aiui (see also above). So if anything "write_fault" would be a replacement for "full"; "basic" could be replaced by just "fault" then.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 99 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 13 December 2019 13:26
To: Durrant, Paul <[email protected]>
Cc: [email protected]; Juergen Gross <[email protected]>; Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Paul Durrant <[email protected]>; Ian Jackson <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH v2] IOMMU: make DMA containment of quarantined devices optionalQuoted 2 lines · Paul
Quoted 2 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf OfJan
Quoted 11 lines
Quoted 11 lines
Beulich
Sent: 13 December 2019 12:53
To: [email protected]
Cc: Juergen Gross <[email protected]>; Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Paul Durrant <[email protected]>; Ian Jackson <[email protected]>; Roger Pau Monné <[email protected]>
Subject: [Xen-devel] [PATCH v2] IOMMU: make DMA containment ofquarantined
Quoted 7 lines
Quoted 7 lines
devices optional
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting an IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults to occur). Defaulting to a mode where admins may not even become aware of issues with devices
can
Quoted 6 lines
Quoted 6 lines
be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default.
This involves resurrecting code commit
ea38867831da("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing apretty
Quoted 1 line
Quoted 1 line
pointless use of "goto" in
domain_context_unmap(), and instead ofmaking
Quoted 4 lines
Quoted 4 lines
the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well.
In order to key the re-instated bypasses off of there (not) being a
root
Quoted 2 lines
Quoted 2 lines
page table this further requires moving the
allocate_domain_resources()invocation fromreassign_device()toamd_iommu_setup_domain_device()(or
Quoted 1 line
Quoted 1 line
else
reassign_device()would allocate a root page table anyway); thisis
Quoted 7 lines
Quoted 7 lines
benign to the second caller of the latter function.
Signed-off-by Jan Beulich <[email protected]>---
As far as 4.13 is concerned, I guess if we can't come to an agreement here, the only other option is to revertea38867831dafrom the branch, for having been committed prematurely (I'm not so much worried aboutthe
Quoted 7 lines
Quoted 5 lines
master branch, where we have ample time until 4.14). What I surely want to see us avoid is a back and forth in behavior of released versions. (Note that 4.12.2 is similarly blocked on a decision either way here.)
I'm happy to take better suggestions to replace "full".
How about simply "sink", since that's what it does?
But it's not really a "sink", as we still fault writes (which is the only thing I can see to be "sunk" if I'm getting the meaning of the word right).
Quoted 13 lines
Quoted 13 lines
xen/drivers/passthrough/iommu.c +0
-1@@ -30,13 +30,17 @@ bool_t __initdata iommu_enable = 1;bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose; -bool __read_mostly iommu_quarantine = true;bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ;bool_t __read_mostly iommu_crash_disable;Quoted 8 lines
xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 4 lines
xen/drivers/passthrough/iommu.c +4
-0+#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;If we have '
IOMMU_quarantine_sink' instead of 'IOMMU_quarantine_full', then how about 'IOMMU_quarantine_write_fault' instead of 'IOMMU_quarantine_basic'?
Quoted 4 lines
Why "
write_fault"? Even in "full" mode you only avoid read faults aiui (see also above). So if anything "write_fault" would be a replacement for "full"; "basic" could be replaced by just "fault" then.
Sorry, yes, I had things the wrong way round. "fault" and "write_fault" sound good.
Paul
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Paul
Quoted 17 lines
From: Jan Beulich <[email protected]>
Sent: 13 December 2019 13:26Quoted 12 lines · Paul
xen/drivers/passthrough/iommu.c bool_t __initdata iommu_enable = 1; · line 42
Quoted 8 lines
From: Xen-devel <[email protected]> On Behalf Of Jan Beulich
Sent: 13 December 2019 12:53xen/drivers/passthrough/iommu.c +4
-0+#define IOMMU_quarantine_none 0 +#define IOMMU_quarantine_basic 1 +#define IOMMU_quarantine_full 2 +uint8_t __read_mostly iommu_quarantine = IOMMU_quarantine_basic;If we have '
IOMMU_quarantine_sink' instead of 'IOMMU_quarantine_full', then how about 'IOMMU_quarantine_write_fault' instead of 'IOMMU_quarantine_basic'?
Quoted 6 lines
Quoted 4 lines
Why "
write_fault"? Even in "full" mode you only avoid read faults aiui (see also above). So if anything "write_fault" would be a replacement for "full"; "basic" could be replaced by just "fault" then.Sorry, yes, I had things the wrong way round. "fault" and "
write_fault" sound good.
But the resulting command line option (iommu=quarantine=write-fault) would then be quite a bit less nice imo, compare to the brief "full". (I'm tempted to suggest "nrf" for "no read fault", but I guess that's too ugly an acronym.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel