Skip to contentSkip to conversation

binutils: Fix CVE-2022-44840

PATCH In review virendra thakur 2 participants 5 messages Apr 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 binutils: Fix CVE-2022-44840

Add patch file to fix CVE-2022-44840

Reference: https://answers.launchpad.net/ubuntu/+archive/primary/+sourcefiles/binutils/2.34-6ubuntu1.8/binutils_2.34-6ubuntu1.8.debian.tar.xz

---
 .../binutils/binutils-2.34.inc                |   1 +
 .../binutils/binutils/CVE-2022-44840.patch    | 162 ++++++++++++++++++
 2 files changed, 163 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2022-44840.patch
meta/recipes-devtools/binutils/binutils-2.34.inc +1 -0
index 032263fe63..64f66a30a9 100644
@@ -62,5 +62,6 @@ SRC_URI = "\
      file://CVE-2022-47011.patch \
      file://CVE-2022-48063.patch \
      file://CVE-2022-47695.patch \
+     file://CVE-2022-44840.patch \
 "
 S  = "${WORKDIR}/git"
meta/recipes-devtools/binutils/binutils/CVE-2022-44840.patch new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/4 binutils: Fix CVE-2022-45703

Add patch file to fix CVE-2022-45703

Reference: https://answers.launchpad.net/ubuntu/+archive/primary/+sourcefiles/binutils/2.34-6ubuntu1.8/binutils_2.34-6ubuntu1.8.debian.tar.xz

---
 .../binutils/binutils-2.34.inc                |   2 +
 .../binutils/binutils/CVE-2022-45703-0.patch  | 148 ++++++++++++++++++
 .../binutils/binutils/CVE-2022-45703-1.patch  |  36 +++++
 3 files changed, 186 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2022-45703-0.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2022-45703-1.patch
meta/recipes-devtools/binutils/binutils-2.34.inc +2 -0
index 64f66a30a9..fd6138be1e 100644
@@ -63,5 +63,7 @@ SRC_URI = "\
      file://CVE-2022-48063.patch \
      file://CVE-2022-47695.patch \
      file://CVE-2022-44840.patch \
+     file://CVE-2022-45703-0.patch \
+     file://CVE-2022-45703-1.patch \
 "
 S  = "${WORKDIR}/git"
meta/recipes-devtools/binutils/binutils/CVE-2022-45703-0.patch new file +148 -0

148 lines not on this page · raw message

meta/recipes-devtools/binutils/binutils/CVE-2022-45703-1.patch new file +36 -0
new file mode 100644
index 0000000000..0ed1c4e55b
@@ -0,0 +1,36 @@
+[Ubuntu note: print_dwarf_vma was used instead of print_hex in this version of
+ the code.
+ -- Camila Camargo de Matos <[email protected]>]
+
+Origin: backport, https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=69bfd1759db41c8d369f9dcc98a135c5a5d97299
+
+From 69bfd1759db41c8d369f9dcc98a135c5a5d97299 Mon Sep 17 00:00:00 2001
+From: Alan Modra <[email protected]>
+Date: Fri, 18 Nov 2022 11:29:13 +1030
+Subject: [PATCH] PR29799 heap buffer overflow in display_gdb_index
+ dwarf.c:10548
+
+	PR 29799
+	* dwarf.c (display_gdb_index): Typo fix.
+Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=69bfd1759db41c8d369f9dcc98a135c5a5d97299]
+
+CVE: CVE-2022-45703
+
+Signed-off-by: Virendra Thakur <[email protected]>
+---
+ binutils/dwarf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: binutils-2.34/binutils/dwarf.c
+===================================================================
+--- binutils-2.34.orig/binutils/dwarf.c
++++ binutils-2.34/binutils/dwarf.c
+@@ -9307,7 +9307,7 @@ display_gdb_index (struct dwarf_section
+     {
+       uint64_t low = byte_get_little_endian (address_table + i * 20, 8);
+       uint64_t high = byte_get_little_endian (address_table + i * 20 + 8, 8);
+-      uint32_t cu_index = byte_get_little_endian (address_table + i + 20 + 16, 4);
++      uint32_t cu_index = byte_get_little_endian (address_table + i * 20 + 16, 4);
+ 
+       print_dwarf_vma (low, 8);
+       print_dwarf_vma (high, 8);
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 binutils: Fix CVE-2022-48065

In reply to virendra thakur

Add patch file to fix CVE-2022-48065

Reference: https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/binutils/2.34-6ubuntu1.9/binutils_2.34-6ubuntu1.9.debian.tar.xz

---
 .../binutils/binutils-2.34.inc                |   1 +
 .../binutils/binutils/CVE-2022-48065.patch    | 115 ++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2022-48065.patch
meta/recipes-devtools/binutils/binutils-2.34.inc +1 -0
index fd6138be1e..5ebc7c6f34 100644
@@ -61,6 +61,7 @@ SRC_URI = "\
      file://CVE-2022-47010.patch \
      file://CVE-2022-47011.patch \
      file://CVE-2022-48063.patch \
+     file://CVE-2022-48065.patch \
      file://CVE-2022-47695.patch \
      file://CVE-2022-44840.patch \
      file://CVE-2022-45703-0.patch \
meta/recipes-devtools/binutils/binutils/CVE-2022-48065.patch new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 binutils: Mark CVE-2022-47673 as patch

In reply to virendra thakur

the fix for this issue seems to be the same as the one for the issue described by CVE-2023-25584.

Reference: https://ubuntu.com/security/CVE-2022-47673

---
 meta/recipes-devtools/binutils/binutils/CVE-2023-25584.patch | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/binutils/binutils/CVE-2023-25584.patch +2 -1
index 732ea43210..f85e9c08de 100644
@@ -1,6 +1,7 @@
-CVE: CVE-2023-25584
+CVE: CVE-2023-25584 CVE-2022-47673
 Upstream-Status: Backport [ import from ubuntu http://archive.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.34-6ubuntu1.7.debian.tar.xz  upstream  https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=77c225bdeb410cf60da804879ad41622f5f1aa44 ]
 Signed-off-by: Lee Chee Yang <[email protected]>
+Signed-off-by: Virendra Thakur <[email protected]>
 
 [Ubuntu note: this is backport of the original patch, no major changes just
  fix this patch for this release]
Signature · 1 line
2.25.1
#4 lore raw
In reply to virendra thakur

Dunfell has reached end of life and we are no longer taking changes. The final build was done on April 15.

Steve

Quoted 203 lines · virendra thakur via lists.openembedded.org

Add patch file to fix CVE-2022-44840

Reference: https://answers.launchpad.net/ubuntu/+archive/primary/+sourcefiles/binutils/2.34-6ubuntu1.8/binutils_2.34-6ubuntu1.8.debian.tar.xz

---
 .../binutils/binutils-2.34.inc                |   1 +
 .../binutils/binutils/CVE-2022-44840.patch    | 162 ++++++++++++++++++
 2 files changed, 163 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2022-44840.patch
meta/recipes-devtools/binutils/binutils-2.34.inc +1 -0
index 032263fe63..64f66a30a9 100644
@@ -62,5 +62,6 @@ SRC_URI = "\
      file://CVE-2022-47011.patch \
      file://CVE-2022-48063.patch \
      file://CVE-2022-47695.patch \
+     file://CVE-2022-44840.patch \
 "
 S  = "${WORKDIR}/git"
meta/recipes-devtools/binutils/binutils/CVE-2022-44840.patch new file +162 -1
new file mode 100644
index 0000000000..288219871d
@@ -0,0 +1,162 @@
+[Ubuntu note: commit af2ddf69ab85 is not included in this version of the code,
+ so adjustments had to be made to the 2nd hunk in order for it to apply
+ cleanly and in order to have the added code match correct macro usage for
+ this version of binutils (SAFE_BYTE_GET64 is called with signature_high and
+ signature_low in this version of the code, but not in the added lines of the
+ original patch).
+ -- Camila Camargo de Matos <[email protected]>]
+
+Origin: backport, https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=28750e3b967da2207d51cbce9fc8be262817ee59
+
+From 28750e3b967da2207d51cbce9fc8be262817ee59 Mon Sep 17 00:00:00 2001
+From: Alan Modra <[email protected]>
+Date: Sun, 30 Oct 2022 19:08:51 +1030
+Subject: [PATCH] Pool section entries for DWP version 1
+
+Ref: https://gcc.gnu.org/wiki/DebugFissionDWP?action=recall&rev=3
+
+Fuzzers have found a weakness in the code stashing pool section
+entries.  With random nonsensical values in the index entries (rather
+than each index pointing to its own set distinct from other sets),
+it's possible to overflow the space allocated, losing the NULL
+terminator.  Without a terminator, find_section_in_set can run off the
+end of the shndx_pool buffer.  Fix this by scanning the pool directly.
+
+binutils/
+       * dwarf.c (add_shndx_to_cu_tu_entry): Delete range check.
+       (end_cu_tu_entry): Likewise.
+       (process_cu_tu_index): Fill shndx_pool by directly scanning
+       pool, rather than indirectly from index entries.
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=28750e3b967da2207d51cbce9fc8be262817ee59]
+
+CVE: CVE-2022-44840
+
+Signed-off-by: Virendra Thakur <[email protected]>
+---
+ binutils/dwarf.c | 90 ++++++++++++++++++++++--------------------------
+ 1 file changed, 41 insertions(+), 49 deletions(-)
+
+Index: binutils-2.34/binutils/dwarf.c
+===================================================================
+--- binutils-2.34.orig/binutils/dwarf.c
++++ binutils-2.34/binutils/dwarf.c
+@@ -9454,22 +9454,12 @@ prealloc_cu_tu_list (unsigned int nshndx
+ static void
+ add_shndx_to_cu_tu_entry (unsigned int shndx)
+ {
+-  if (shndx_pool_used >= shndx_pool_size)
+-    {
+-      error (_("Internal error: out of space in the shndx pool.\n"));
+-      return;
+-    }
+   shndx_pool [shndx_pool_used++] = shndx;
+ }
+
+ static void
+ end_cu_tu_entry (void)
+ {
+-  if (shndx_pool_used >= shndx_pool_size)
+-    {
+-      error (_("Internal error: out of space in the shndx pool.\n"));
+-      return;
+-    }
+   shndx_pool [shndx_pool_used++] = 0;
+ }
+
+@@ -9578,54 +9568,55 @@ process_cu_tu_index (struct dwarf_sectio
+
+   if (version == 1)
+     {
++      unsigned char *shndx_list;
++      unsigned int shndx;
++
+       if (!do_display)
+-      prealloc_cu_tu_list ((limit - ppool) / 4);
+-      for (i = 0; i < nslots; i++)
+       {
+-        unsigned char *shndx_list;
+-        unsigned int shndx;
+-
+-        SAFE_BYTE_GET64 (phash, &signature_high, &signature_low, limit);
+-        if (signature_high != 0 || signature_low != 0)
++         prealloc_cu_tu_list ((limit - ppool) / 4);
++         for (shndx_list = ppool + 4; shndx_list <= limit - 4; shndx_list += 4)
+           {
+-            SAFE_BYTE_GET (j, pindex, 4, limit);
+-            shndx_list = ppool + j * 4;
+-            /* PR 17531: file: 705e010d.  */
+-            if (shndx_list < ppool)
+-              {
+-                warn (_("Section index pool located before start of section\n"));
+-                return 0;
+-              }
+-
+-            if (do_display)
++            shndx = byte_get (shndx_list, 4);
++            add_shndx_to_cu_tu_entry (shndx);
++          }
++        end_cu_tu_entry ();
++      }
++      else
++      for (i = 0; i < nslots; i++)
++        {
++          SAFE_BYTE_GET64 (phash, &signature_high, &signature_low, limit);
++          if (signature_high != 0 || signature_low != 0)
++            {
++              SAFE_BYTE_GET (j, pindex, 4, limit);
++              shndx_list = ppool + j * 4;
++              /* PR 17531: file: 705e010d.  */
++              if (shndx_list < ppool)
++                {
++                  warn (_("Section index pool located before start of section\n"));
++                  return 0;
++                }
+               printf (_("  [%3d] Signature:  0x%s  Sections: "),
+                       i, dwarf_vmatoa64 (signature_high, signature_low,
+                                          buf, sizeof (buf)));
+-            for (;;)
+-              {
+-                if (shndx_list >= limit)
+-                  {
+-                    warn (_("Section %s too small for shndx pool\n"),
+-                          section->name);
+-                    return 0;
+-                  }
+-                SAFE_BYTE_GET (shndx, shndx_list, 4, limit);
+-                if (shndx == 0)
+-                  break;
+-                if (do_display)
++              for (;;)
++                {
++                  if (shndx_list >= limit)
++                    {
++                      warn (_("Section %s too small for shndx pool\n"),
++                            section->name);
++                      return 0;
++                    }
++                  SAFE_BYTE_GET (shndx, shndx_list, 4, limit);
++                  if (shndx == 0)
++                    break;
+                   printf (" %d", shndx);
+-                else
+-                  add_shndx_to_cu_tu_entry (shndx);
+-                shndx_list += 4;
+-              }
+-            if (do_display)
++                  shndx_list += 4;
++                }
+               printf ("\n");
+-            else
+-              end_cu_tu_entry ();
+-          }
+-        phash += 8;
+-        pindex += 4;
+-      }
++            }
++          phash += 8;
++          pindex += 4;
++        }
+     }
+   else if (version == 2)
+     {
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198606): https://lists.openembedded.org/g/openembedded-core/message/198606
Mute This Topic: https://lists.openembedded.org/mt/105685930/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-