CVE-2018-18954.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 3c9fd43da473a324f6cc7a0d3db58f651a2d262c Mon Sep 17 00:00:00 2001
  2. From: Prasad J Pandit <pjp@fedoraproject.org>
  3. Date: Fri, 26 Oct 2018 18:03:58 +0530
  4. Subject: [PATCH] ppc/pnv: check size before data buffer access
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. While performing PowerNV memory r/w operations, the access length
  9. 'sz' could exceed the data[4] buffer size. Add check to avoid OOB
  10. access.
  11. Reported-by: Moguofang <moguofang@huawei.com>
  12. Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
  13. Reviewed-by: Cédric Le Goater <clg@kaod.org>
  14. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  15. CVE: CVE-2018-18954
  16. Upstream-Status: Backport
  17. [https://git.qemu.org/?p=qemu.git;a=commit;h=d07945e78eb6b593cd17a4640c1fc9eb35e3245d]
  18. Signed-off-by: Dan Tran <dantran@microsoft.com>
  19. ---
  20. hw/ppc/pnv_lpc.c | 8 +++++++-
  21. 1 file changed, 7 insertions(+), 1 deletion(-)
  22. diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
  23. index d7721320a2..172a915cfc 100644
  24. --- a/hw/ppc/pnv_lpc.c
  25. +++ b/hw/ppc/pnv_lpc.c
  26. @@ -155,9 +155,15 @@ static void pnv_lpc_do_eccb(PnvLpcController *lpc, uint64_t cmd)
  27. /* XXX Check for magic bits at the top, addr size etc... */
  28. unsigned int sz = (cmd & ECCB_CTL_SZ_MASK) >> ECCB_CTL_SZ_LSH;
  29. uint32_t opb_addr = cmd & ECCB_CTL_ADDR_MASK;
  30. - uint8_t data[4];
  31. + uint8_t data[8];
  32. bool success;
  33. + if (sz > sizeof(data)) {
  34. + qemu_log_mask(LOG_GUEST_ERROR,
  35. + "ECCB: invalid operation at @0x%08x size %d\n", opb_addr, sz);
  36. + return;
  37. + }
  38. +
  39. if (cmd & ECCB_CTL_READ) {
  40. success = opb_read(lpc, opb_addr, data, sz);
  41. if (success) {
  42. --
  43. 2.22.0.vfs.1.1.57.gbaf16c8