[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v3][PATCH 16/16] xen/vtd: prevent from assign the device with shared rmrr



>>> On 11.06.15 at 03:15, <tiejun.chen@xxxxxxxxx> wrote:
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2277,13 +2277,37 @@ static int intel_iommu_assign_device(
>      if ( list_empty(&acpi_drhd_units) )
>          return -ENODEV;
>  
> +    seg = pdev->seg;
> +    bus = pdev->bus;
> +    /*
> +     * In rare cases one given rmrr is shared by multiple devices but
> +     * obviously this would put the security of a system at risk. So
> +     * we should prevent from this sort of device assignment.
> +     *
> +     * TODO: actually we can group these devices which shared rmrr, and
> +     * then allow all devices within a group to be assigned to same domain.
> +     */
> +    for_each_rmrr_device( rmrr, bdf, i )
> +    {
> +        if ( rmrr->segment == seg &&
> +             PCI_BUS(bdf) == bus &&
> +             PCI_DEVFN2(bdf) == devfn )
> +        {
> +            if ( rmrr->scope.devices_cnt > 1 )
> +            {
> +                ret = -EPERM;
> +                printk(XENLOG_G_ERR VTDPREFIX
> +                       " cannot assign this device with shared RMRR for 
> Dom%d (%d)\n",
> +                       d->domain_id, ret);
> +                return ret;

return -EPERM. No need to assign the value to ret, and no need to
add the constant error code to the log entry. What's missing otoh
is what "this device" is - you should print SBDF instead.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.