xsa395.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 4cc924c3e3a0d53306d08b04720c427d1c298ba8 Mon Sep 17 00:00:00 2001
  2. From: Julien Grall <jgrall@amazon.com>
  3. Date: Wed, 5 Jan 2022 18:09:20 +0000
  4. Subject: [PATCH] passthrough/x86: stop pirq iteration immediately in case of
  5. error
  6. pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
  7. loop will bail out if 'rc' is non-zero but the inner loop will continue.
  8. This means 'rc' will get clobbered and we may miss any errors (such as
  9. -ERESTART in the case of the callback pci_clean_dpci_irq()).
  10. This is CVE-2022-23035 / XSA-395.
  11. Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
  12. Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
  13. Signed-off-by: Julien Grall <jgrall@amazon.com>
  14. Signed-off-by: Jan Beulich <jbeulich@suse.com>
  15. Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
  16. ---
  17. xen/drivers/passthrough/x86/hvm.c | 4 ++++
  18. 1 file changed, 4 insertions(+)
  19. diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
  20. index 351daafdc9bf..0b37cd145b60 100644
  21. --- a/xen/drivers/passthrough/x86/hvm.c
  22. +++ b/xen/drivers/passthrough/x86/hvm.c
  23. @@ -732,7 +732,11 @@ int pt_pirq_iterate(struct domain *d,
  24. pirq = pirqs[i]->pirq;
  25. if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
  26. + {
  27. rc = cb(d, pirq_dpci, arg);
  28. + if ( rc )
  29. + break;
  30. + }
  31. }
  32. } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
  33. --
  34. 2.32.0