summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepthi Hemraj <Deepthi.Hemraj@windriver.com>2024-02-05 04:31:09 -0800
committerSteve Sakoman <steve@sakoman.com>2024-02-09 03:46:50 -1000
commitd35f65d419d97b948d1c8ca9a6535afd691120ea (patch)
treeb74b5bfda20e47909a3fe9e928e9febd9ff9ab2f
parent698ba6a8eda42cb6d17aae227cf8298b9a87ab9b (diff)
downloadpoky-d35f65d419d97b948d1c8ca9a6535afd691120ea.tar.gz
gdb: Fix CVE-2023-39129
CVE: CVE-2023-39129 (From OE-Core rev: 67b62fd57d7073b42db2747227d07841d0d064e3) Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/gdb/gdb.inc1
-rw-r--r--meta/recipes-devtools/gdb/gdb/0012-CVE-2023-39129.patch50
2 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc
index 099bd2d8f5..ad2b3ad4b7 100644
--- a/meta/recipes-devtools/gdb/gdb.inc
+++ b/meta/recipes-devtools/gdb/gdb.inc
@@ -15,5 +15,6 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
15 file://0009-Fix-invalid-sigprocmask-call.patch \ 15 file://0009-Fix-invalid-sigprocmask-call.patch \
16 file://0010-gdbserver-ctrl-c-handling.patch \ 16 file://0010-gdbserver-ctrl-c-handling.patch \
17 file://0011-CVE-2023-39128.patch \ 17 file://0011-CVE-2023-39128.patch \
18 file://0012-CVE-2023-39129.patch \
18 " 19 "
19SRC_URI[sha256sum] = "1497c36a71881b8671a9a84a0ee40faab788ca30d7ba19d8463c3cc787152e32" 20SRC_URI[sha256sum] = "1497c36a71881b8671a9a84a0ee40faab788ca30d7ba19d8463c3cc787152e32"
diff --git a/meta/recipes-devtools/gdb/gdb/0012-CVE-2023-39129.patch b/meta/recipes-devtools/gdb/gdb/0012-CVE-2023-39129.patch
new file mode 100644
index 0000000000..63fb44d59a
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0012-CVE-2023-39129.patch
@@ -0,0 +1,50 @@
1From: Keith Seitz <keiths@...>
2Date: Wed, 2 Aug 2023 15:35:11 +0000 (-0700)
3Subject: Verify COFF symbol stringtab offset
4X-Git-Tag: gdb-14-branchpoint~473
5X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=58abdf887821a5da09ba184c6e400a3bc5cccd5a
6
7Verify COFF symbol stringtab offset
8
9This patch addresses an issue with malformed/fuzzed debug information that
10was recently reported in gdb/30639. That bug specifically deals with
11an ASAN issue, but the reproducer provided by the reporter causes a
12another failure outside of ASAN:
13
14Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=58abdf887821a5da09ba184c6e400a3bc5cccd5a]
15
16CVE: CVE-2023-39129
17
18Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
19
20diff --git a/gdb/coffread.c b/gdb/coffread.c
21--- a/gdb/coffread.c
22+++ b/gdb/coffread.c
23@@ -159,6 +160,7 @@ static file_ptr linetab_offset;
24 static file_ptr linetab_size;
25
26 static char *stringtab = NULL;
27+static long stringtab_length = 0;
28
29 extern void stabsread_clear_cache (void);
30
31@@ -1303,6 +1298,7 @@ init_stringtab (bfd *abfd, file_ptr offset, gdb::unique_xmalloc_ptr<char> *stora
32 /* This is in target format (probably not very useful, and not
33 currently used), not host format. */
34 memcpy (stringtab, lengthbuf, sizeof lengthbuf);
35+ stringtab_length = length;
36 if (length == sizeof length) /* Empty table -- just the count. */
37 return 0;
38
39@@ -1322,8 +1318,9 @@ getsymname (struct internal_syment *symbol_entry)
40
41 if (symbol_entry->_n._n_n._n_zeroes == 0)
42 {
43- /* FIXME: Probably should be detecting corrupt symbol files by
44- seeing whether offset points to within the stringtab. */
45+ if (symbol_entry->_n._n_n._n_offset > stringtab_length)
46+ error (_("COFF Error: string table offset (%ld) outside string table (length %ld)"),
47+ symbol_entry->_n._n_n._n_offset, stringtab_length);
48 result = stringtab + symbol_entry->_n._n_n._n_offset;
49 }
50 else