diff options
| author | Deepthi Hemraj <Deepthi.Hemraj@windriver.com> | 2024-02-05 04:31:09 -0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-02-09 03:46:50 -1000 |
| commit | d35f65d419d97b948d1c8ca9a6535afd691120ea (patch) | |
| tree | b74b5bfda20e47909a3fe9e928e9febd9ff9ab2f | |
| parent | 698ba6a8eda42cb6d17aae227cf8298b9a87ab9b (diff) | |
| download | poky-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.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gdb/gdb/0012-CVE-2023-39129.patch | 50 |
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 | " |
| 19 | SRC_URI[sha256sum] = "1497c36a71881b8671a9a84a0ee40faab788ca30d7ba19d8463c3cc787152e32" | 20 | SRC_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 @@ | |||
| 1 | From: Keith Seitz <keiths@...> | ||
| 2 | Date: Wed, 2 Aug 2023 15:35:11 +0000 (-0700) | ||
| 3 | Subject: Verify COFF symbol stringtab offset | ||
| 4 | X-Git-Tag: gdb-14-branchpoint~473 | ||
| 5 | X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=58abdf887821a5da09ba184c6e400a3bc5cccd5a | ||
| 6 | |||
| 7 | Verify COFF symbol stringtab offset | ||
| 8 | |||
| 9 | This patch addresses an issue with malformed/fuzzed debug information that | ||
| 10 | was recently reported in gdb/30639. That bug specifically deals with | ||
| 11 | an ASAN issue, but the reproducer provided by the reporter causes a | ||
| 12 | another failure outside of ASAN: | ||
| 13 | |||
| 14 | Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=58abdf887821a5da09ba184c6e400a3bc5cccd5a] | ||
| 15 | |||
| 16 | CVE: CVE-2023-39129 | ||
| 17 | |||
| 18 | Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com> | ||
| 19 | |||
| 20 | diff --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 | ||
