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

Re: [PATCH] IOMMU: make domctl handler tolerate NULL domain


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Tue, 19 Apr 2022 15:48:53 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CN7iJu3+WgRtQBoa4LugFHQmLBVb+qeMz0d7acpQ1DI=; b=n1HBYqmTlk0UyyhytHQE5nkR8x1UhR2L4FFCRC9tVZUXLsxDDxalK20CAyTJVfxETLGJcq1KqmHRg5gNPdVLgfsVkKSNyKQgBaTRRmBTctQW2l24jdt/cwQSH501mTVuWm8ySPWOaJhefZG0QxVCVvdykIWDKXF2VGzKBngXtlt5n3IwA9KoDDRxC7wAoarjUrwUyH76rnoxseXOXTAxdSK2yD3kHCeIEJwa9VOyyQFXq277ydeyLRaGRi+JW+L0FBfdvVJxGalC+tZzZRVMzHVtaavDcqoUlnmzmxRQ++rrplzKHvwrGNqkPSe2yfkmshJF3UU8vy/KZa/LfE8kng==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OviiamYew0XevVa7kSZTlDjT6mAbIBF8Kxlr0GNS1ACqap7J7ykc9y/e//LkWleoWUfN/8KB9mMK9YB1P4/+hNzifW/pWYdBQ5SI4b+XM/tKn1IBqoqhJBIyLvMF5pf6ijKvN6bECFxQGgEgs7EGRwmX6Y+jkgWGxFks7NJ2LiT2MgDkZTho9mdL9xj0yGqBe7cWpo1asGOjhnxutugnh7II7eZ5AbBfexabyLRsy/HKv9g7cmdxrSO0vUr+ZqPnkeNaEtNECIXgCSTAQcq1epe5l++8l360KVl2n1RbKtDYsbB5+4dML8B7mzoCOvknaO4QjjulFTfB66BGWplYqw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 19 Apr 2022 15:49:03 +0000
  • Ironport-data: A9a23:CsnKHq6SztKQmqu33Ly11wxRtDfGchMFZxGqfqrLsTDasY5as4F+v jBKC23VPPnYamKmfN0gaYW1pB9T7JOEn99mTQdk/y08Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0XqPp8Zj2tQy2YTgUlvX0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurSyTTkvD62dyd86WjJ7CDpPJ6BL2aP+dC3XXcy7lyUqclPK6tA3VAQaGNNd/ex6R2ZT6 fYfNTYBKAiZgP67y666Te8qgdk/KM7sP8UUvXQIITPxVK56B8ycBfiao4YAhl/chegXdRraT +MfZSBic1LrZBpXN01MIJk/gP2plj/0dDgwRFe9+/ttsjmNkVYZPL7FEerFW4Cqd8Fsp3nDh CXj2lbIXwlZDYnKodaC2jf27gPVpgv5Uo8PELyz9tZxnUaegGcUDXU+RVa95PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yFactwMYc8pdFas98g7l4qjb+QGCHUAfUyVMLtchsacLqScC0 1aIm5blAGJpubjMEXaFrO7M93W1JDQfKnIEaWkcVwwZ7tL/oYY1yBXSUtJkF63zhdrwcd3t/ w23QOEFr+17paY2O2+TpAmvb+6EznQRcjMI2w==
  • Ironport-hdrordr: A9a23:1wZtF6/9yPQnoX/qZwRuk+GBdr1zdoMgy1knxilNoENuH/Bwxv rFoB1E73TJYW4qKQodcdDpAtjifZtFnaQFrbX5To3SJjUO31HYY72KjLGSjgEIfheTygcz79 YGT0ETMrzN5B1B/L7HCWqDYpgdKbu8gcaVbI7lph8DIz2CKZsQljuRYTzrcHGeMTM2YabRY6 Dsg/avyQDBRV0nKuCAQlUVVenKoNPG0Lj8ZwQdOhIh4A6SyRu19b/TCXGjr1cjegIK5Y1n3X nOkgT/6Knmmeq80AXg22ja6IkTsMf9y+FEGNeHhqEuW3bRY0eTFcZcso+5zXQISdKUmREXeR 730lEd1vFImjbsl6eO0ELQMkfboW4TAjTZuCKlaDPY0LDErXQBeot8bMtiA2XkAwBLhqAC7I tbm22erJZZFhXGgWD04MXJTQhjkg6urWMlivN7tQ0WbWIyUs4mkWUkxjIdLH7AJlOJ1Kk3VO 11SM3M7vdfdl2XK3jfo2l02dSpGnA+BA2PTEQOstGcl2E+pgEy82IIgMgE2nsQ/pM0TJdJo+ zCL6RzjblLCssbd7h0CusNSda+TmbNXRXPOmSPJkmPLtBNB1vd75rspLkl7uCjf5IFiJM0hZ TaSVtd8XU/fkr/YPf+q6GjMiq9NFlVcQ6duv22vaIJy4EUbICbQhGrWRQpj9aqpekZD4nSR+ uzUagmdsPeEQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYU9FUwjuogeCS0EWgGeBVFIanqKz3Yk2A
  • Thread-topic: [PATCH] IOMMU: make domctl handler tolerate NULL domain

On 19/04/2022 10:39, Jan Beulich wrote:
> Besides the reporter's issue of hitting a NULL deref when !CONFIG_GDBSX,
> XEN_DOMCTL_test_assign_device can legitimately end up having NULL passed
> here, when the domctl was passed DOMID_INVALID.
>
> Fixes: 71e617a6b8f6 ("use is_iommu_enabled() where appropriate...")
> Reported-by: Cheyenne Wills <cheyenne.wills@xxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -558,7 +558,7 @@ int iommu_do_domctl(
>  {
>      int ret = -ENODEV;
>  
> -    if ( !is_iommu_enabled(d) )
> +    if ( !(d ? is_iommu_enabled(d) : iommu_enabled) )
>          return -EOPNOTSUPP;

Having spent the better part of a day debugging this mess, this patch is
plain broken.

It depends on Juergen's "xen/iommu: cleanup iommu related domctl
handling" patch, because otherwise it erroneously fails non-IOMMU subops.

~Andrew

 


Rackspace

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