On Mon, Nov 07, 2022 at 11:05:08AM -0700, Alex Williamson wrote: > After further consideration... I don't think the option on vfio-main > makes sense, basically for the same reason that the original option > existed on the IOMMU backend rather than vfio-core. The option > describes a means to relax a specific aspect of IOMMU isolation, which > makes more sense to expose via the IOMMU provider, imo. For example, > vfio-main cannot generate an equivalent error message as provided in > type1 today, it's too far removed from the IOMMU feature support. vfio-main can do it, we just have to be strict that the EPERM code is always going to be this case. > > > If vdpa doesn't allow full device access such that it can guarantee > > > that a device cannot generate a DMA that can spoof MSI, then it > > > sounds like the flag we pass when attaching a device to iommfd > > > should to reflect this difference in usage. > > > > VDPA allows arbitary DMA just like VFIO. At most VDPA limits the MMIO > > touches. > > So why exactly isn't this an issue for VDPA? Are we just burying our > head in the sand that such platforms exists and can still be useful > given the appropriate risk vs reward trade-off? Simply that nobody has asked for it, and might never ask for it. This is all support for old platforms, and there just doesn't seem to be a "real" use case for very new (and actually rare) NIC hardware stuck into ancient platforms with this security problem. So I'd rather leave this in the past than carry forward a security exception as some ongoing 1st class thing. > > and IMHO we don't actually want to enable this more > > widely. So I don't want to see a global kernel wide flag at this point > > until we get reason to make more than just VFIO insecure. > > But this brings into question the entire existence of the opt-in. Do > we agree that there are valid use cases for such an option? I think it is something VFIO has historically allowed and I think we can continue to allow it, but I don't think we should encourage its use or encourage it to propogate to wider areas given that the legitimate use cases are focused on fairly old hardware at this point. So, I'd rather wait for someone to ask for it, and explain why they need to use a combination of stuff where we need to have a true global option. > Unlike things like ACS overrides, lack of interrupt isolation really > requires a malicious actor. We're not going to inadvertently overlap > DMA to interrupt addresses like we might to a non-isolated MMIO ranges. > Therefore an admin can make a reasonable determination relative to the > extent to which the userspace is trusted. This is not unlike opt-outs > to CPU vulnerability mitigation imo, there are use cases where the > performance or functionality is more important than the isolation. > Hand waving this away as a vfio-unique insecurity is a bad precedent > for iommufd. I agree with this, which is why I think it should come from the actual user facing subsystem not be a system wide flag. The "is userspace trusted" for VFIO may be quite different than from VDPA or whatever else comes next. I'd be much more comfortable with this as a system wide iommufd flag if we also tied it to do some demonstration of privilege - eg a requirement to open iommufd with CAP_SYS_RAWIO for instance. That is the usual protocol for these kinds of insecurities.. I think right now we can leave this as-is and we can wait for some more information to decide how best to proceed. Thanks, Jason