some follow-up patches of CVE-2023-39129

This commit is contained in:
Wizard Howl 2023-11-21 22:10:39 +08:00
parent a2bac5d642
commit 456cd89a6e
3 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 91df9a6f810bca02883dae9275715b4960ea02f0 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 25 Aug 2023 23:09:18 +0200
Subject: [PATCH] Fix gdb/coffread.c build on 32bit architectures
Reference:https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=91df9a6f810bca02883dae9275715b4960ea02f0
Conflict:NA
The getsymname function tries to emit an error using %ld for an
uintptr_t argument. Use PRIxPTR instead. Which works on any architecture
for uintptr_t.
---
gdb/coffread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index ae7632d49cb..c609c963453 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1325,7 +1325,7 @@ getsymname (struct internal_syment *symbol_entry)
if (symbol_entry->_n._n_n._n_zeroes == 0)
{
if (symbol_entry->_n._n_n._n_offset > stringtab_length)
- error (_("COFF Error: string table offset (%ld) outside string table (length %ld)"),
+ error (_("COFF Error: string table offset (%" PRIxPTR ") outside string table (length %ld)"),
symbol_entry->_n._n_n._n_offset, stringtab_length);
result = stringtab + symbol_entry->_n._n_n._n_offset;
}
--
2.33.0

View File

@ -0,0 +1,34 @@
From a6ce491c3d926650407927a338d9678ca983bee4 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Mon, 28 Aug 2023 16:30:14 +0200
Subject: [PATCH] Use hex_string in gdb/coffread.c instead of PRIxPTR
Reference:https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a6ce491c3d926650407927a338d9678ca983bee4
Conflict:NA
The getsymname function uses PRIxPTR to print and uintptr_t value in
an error message. Use hex_string instead.
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/coffread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index c609c963453..c2fe9fa1761 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1325,8 +1325,8 @@ getsymname (struct internal_syment *symbol_entry)
if (symbol_entry->_n._n_n._n_zeroes == 0)
{
if (symbol_entry->_n._n_n._n_offset > stringtab_length)
- error (_("COFF Error: string table offset (%" PRIxPTR ") outside string table (length %ld)"),
- symbol_entry->_n._n_n._n_offset, stringtab_length);
+ error (_("COFF Error: string table offset (%s) outside string table (length %ld)"),
+ hex_string (symbol_entry->_n._n_n._n_offset), stringtab_length);
result = stringtab + symbol_entry->_n._n_n._n_offset;
}
else
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: gdb Name: gdb
Version: 12.1 Version: 12.1
Release: 8 Release: 9
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL-1.3 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL-1.3
Source: https://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.xz Source: https://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.xz
@ -96,6 +96,8 @@ Patch83: gdb-Handle-Python-3.11-deprecation-of-PySys_SetPath-and-.patch
Patch84: gdb-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch Patch84: gdb-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch
Patch85: backport-CVE-2023-39128.patch Patch85: backport-CVE-2023-39128.patch
Patch86: backport-CVE-2023-39129.patch Patch86: backport-CVE-2023-39129.patch
Patch87: backport-Fix-gdb-coffread.c-build-on-32bit-architectures.patch
Patch88: backport-Use-hex_string-in-gdb-coffread.c-instead-of-PRIxPTR.patch
%global gdb_src gdb-%{version} %global gdb_src gdb-%{version}
%global gdb_build build-%{_target_platform} %global gdb_build build-%{_target_platform}
@ -371,6 +373,9 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py
%{_infodir}/ctf-spec.info.gz %{_infodir}/ctf-spec.info.gz
%changelog %changelog
* Tue Nov 21 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.1-9
- some follow-up patches of CVE-2023-39129
* Thu Oct 12 2023 liningjie <liningjie@xfusion.com> - 12.1-8 * Thu Oct 12 2023 liningjie <liningjie@xfusion.com> - 12.1-8
- fix CVE-2023-39129 - fix CVE-2023-39129