CVE-2018-1000205-1.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 7346c1e192d63cd35f99c7e845e53c5d4d0bdc24 Mon Sep 17 00:00:00 2001
  2. From: Teddy Reed <teddy.reed@gmail.com>
  3. Date: Sat, 9 Jun 2018 11:45:20 -0400
  4. Subject: [PATCH] vboot: Do not use hashed-strings offset
  5. The hashed-strings signature property includes two uint32_t values.
  6. The first is unneeded as there should never be a start offset into the
  7. strings region. The second, the size, is needed because the added
  8. signature node appends to this region.
  9. See tools/image-host.c, where a static 0 value is used for the offset.
  10. Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
  11. Reviewed-by: Simon Glass <sjg@chromium.org>
  12. Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
  13. h=7346c1e192d63cd35f99c7e845e53c5d4d0bdc24]
  14. CVE: CVE-2018-1000205
  15. Signed-off-by: Changqing Li <changqing.li@windriver.com>
  16. ---
  17. common/image-sig.c | 7 +++++--
  18. tools/image-host.c | 1 +
  19. 2 files changed, 6 insertions(+), 2 deletions(-)
  20. diff --git a/common/image-sig.c b/common/image-sig.c
  21. index 8d2fd10..5a269d3 100644
  22. --- a/common/image-sig.c
  23. +++ b/common/image-sig.c
  24. @@ -377,8 +377,11 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode,
  25. /* Add the strings */
  26. strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
  27. if (strings) {
  28. - fdt_regions[count].offset = fdt_off_dt_strings(fit) +
  29. - fdt32_to_cpu(strings[0]);
  30. + /*
  31. + * The strings region offset must be a static 0x0.
  32. + * This is set in tool/image-host.c
  33. + */
  34. + fdt_regions[count].offset = fdt_off_dt_strings(fit);
  35. fdt_regions[count].size = fdt32_to_cpu(strings[1]);
  36. count++;
  37. }
  38. diff --git a/tools/image-host.c b/tools/image-host.c
  39. index 8e43671..be2d59b 100644
  40. --- a/tools/image-host.c
  41. +++ b/tools/image-host.c
  42. @@ -135,6 +135,7 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value,
  43. ret = fdt_setprop(fit, noffset, "hashed-nodes",
  44. region_prop, region_proplen);
  45. + /* This is a legacy offset, it is unused, and must remain 0. */
  46. strdata[0] = 0;
  47. strdata[1] = cpu_to_fdt32(string_size);
  48. if (!ret) {
  49. --
  50. 2.7.4