diff --git a/SOURCES/_gdb.spec.Patch.include b/SOURCES/_gdb.spec.Patch.include index c69b87a..a5eb526 100644 --- a/SOURCES/_gdb.spec.Patch.include +++ b/SOURCES/_gdb.spec.Patch.include @@ -290,17 +290,16 @@ Patch067: gdb-gcc-13-backport-self-move-diagnostic-fix Patch068: gdb-backport-call-check_typedef-at-beginning-of-dwarf_expr_context.patch # Backport "Fix an illegal memory access when parsing..." -# (Nick Clifton, RHBZ 2153228) -Patch069: gdb-rhbz2153228-fail-if-sh_info-is-zero.patch +# (Nick Clifton, RHBZ 2153227) +Patch069: gdb-rhbz2153227-fail-if-sh_info-is-zero.patch -# Backport Add a recursion limit to the demangle_const function in the Rust demangler. -# (Nick Clifton, RHEL-4234) -Patch070: libiberty-infinite-recursion-fix-1-of-2.patch +# Backport "Add a recursion limit to the demangle_const function +# in the Rust demangler." +# (Nick Clifton, RHEL-4237) +Patch070: gdb-rhel-4237-rust-demangler-recursion-limit-1of2.patch -# Backport Fix typo in recent code to add stack recursion limit to the Rust demangler. -# (Nick Clifton) -Patch071: libiberty-infinite-recursion-fix-2-of-2.patch - - -Patch072: libiberty-infinite-recursion-fix-3-of-3.patch +# Backport "Fix typo in recent code to add stack recursion limit to +# the Rust demangler." +# (Nick Clifton, RHEL-4327) +Patch071: gdb-rhel-4237-rust-demangler-recursion-limit-2of2.patch diff --git a/SOURCES/_gdb.spec.patch.include b/SOURCES/_gdb.spec.patch.include index b02efe8..56e7473 100644 --- a/SOURCES/_gdb.spec.patch.include +++ b/SOURCES/_gdb.spec.patch.include @@ -69,4 +69,3 @@ %patch069 -p1 %patch070 -p1 %patch071 -p1 -%patch072 -p1 diff --git a/SOURCES/gdb-rhbz2153228-fail-if-sh_info-is-zero.patch b/SOURCES/gdb-rhbz2153227-fail-if-sh_info-is-zero.patch similarity index 90% rename from SOURCES/gdb-rhbz2153228-fail-if-sh_info-is-zero.patch rename to SOURCES/gdb-rhbz2153227-fail-if-sh_info-is-zero.patch index 07c8e14..e2a3b8d 100644 --- a/SOURCES/gdb-rhbz2153228-fail-if-sh_info-is-zero.patch +++ b/SOURCES/gdb-rhbz2153227-fail-if-sh_info-is-zero.patch @@ -1,10 +1,10 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 19 Oct 2022 15:09:12 +0100 -Subject: gdb-rhbz2153228-fail-if-sh_info-is-zero.patch +Subject: gdb-rhbz2153227-fail-if-sh_info-is-zero.patch ;; Backport "Fix an illegal memory access when parsing..." -;; (Nick Clifton, RHBZ 2153228) +;; (Nick Clifton, RHBZ 2153227) PR 29699 * elf.c (_bfd_elf_slurp_version_tables): Fail if the sh_info field diff --git a/SOURCES/libiberty-infinite-recursion-fix-1-of-2.patch b/SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-1of2.patch similarity index 52% rename from SOURCES/libiberty-infinite-recursion-fix-1-of-2.patch rename to SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-1of2.patch index 4acf718..036ac45 100644 --- a/SOURCES/libiberty-infinite-recursion-fix-1-of-2.patch +++ b/SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-1of2.patch @@ -1,14 +1,15 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Nick Clifton -Date: Fri, 1 Jul 2022 15:58:52 +0100 -Subject: libiberty-infinite-recursion-fix-1-of-2.patch +From: Keith Seitz +Date: Thu, 12 Oct 2023 15:03:51 -0400 +Subject: gdb-rhel-4237-rust-demangler-recursion-limit-1of2.patch -;; Backport Add a recursion limit to the demangle_const function in the Rust demangler. -;; (Nick Clifton, RHEL-4234) +;; Backport "Add a recursion limit to the demangle_const function +;; in the Rust demangler." +;; (Nick Clifton, RHEL-4237) libiberty/ - PR demangler/105039 - * rust-demangle.c (demangle_const): Add recursion limit. +PR demangler/105039 +* rust-demangle.c (demangle_const): Add recursion limit. diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c --- a/libiberty/rust-demangle.c @@ -22,7 +23,38 @@ diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c { c = next (rdm); x *= 62; -@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm) +@@ -1082,6 +1082,18 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) + if (rdm->errored) + return open; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ { ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ rdm->errored = 1; ++ goto end_of_func; ++ } ++ } ++ + if (eat (rdm, 'B')) + { + backref = parse_integer_62 (rdm); +@@ -1107,6 +1119,11 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) + } + else + demangle_path (rdm, 0); ++ ++ end_of_func: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; ++ + return open; + } + +@@ -1148,6 +1165,15 @@ demangle_const (struct rust_demangler *rdm) if (rdm->errored) return; @@ -38,7 +70,7 @@ diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c if (eat (rdm, 'B')) { backref = parse_integer_62 (rdm); -@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm) +@@ -1158,7 +1184,7 @@ demangle_const (struct rust_demangler *rdm) demangle_const (rdm); rdm->next = old_next; } @@ -47,7 +79,7 @@ diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c } ty_tag = next (rdm); -@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm) +@@ -1167,7 +1193,7 @@ demangle_const (struct rust_demangler *rdm) /* Placeholder. */ case 'p': PRINT ("_"); @@ -56,7 +88,7 @@ diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c /* Unsigned integer types. */ case 'h': -@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm) +@@ -1200,18 +1226,20 @@ demangle_const (struct rust_demangler *rdm) break; default: diff --git a/SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-2of2.patch b/SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-2of2.patch new file mode 100644 index 0000000..9529fb4 --- /dev/null +++ b/SOURCES/gdb-rhel-4237-rust-demangler-recursion-limit-2of2.patch @@ -0,0 +1,26 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Thu, 12 Oct 2023 15:16:40 -0400 +Subject: gdb-rhel-4237-rust-demangler-recursion-limit-2of2.patch + +;; Backport "Fix typo in recent code to add stack recursion limit to +;; the Rust demangler." +;; (Nick Clifton, RHEL-4327) + + Fix typo in recent code to add stack recursion limit to the Rust demangler. + +libiberty +* rust-demangle.c (demangle_const): Add a missing goto pass_return +at the end of the function. + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -1234,6 +1234,7 @@ demangle_const (struct rust_demangler *rdm) + PRINT (": "); + PRINT (basic_type (ty_tag)); + } ++ goto pass_return; + + fail_return: + rdm->errored = 1; diff --git a/SOURCES/libiberty-infinite-recursion-fix-2-of-2.patch b/SOURCES/libiberty-infinite-recursion-fix-2-of-2.patch deleted file mode 100644 index 91deb76..0000000 --- a/SOURCES/libiberty-infinite-recursion-fix-2-of-2.patch +++ /dev/null @@ -1,23 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Nick Clifton -Date: Mon, 4 Jul 2022 16:31:18 +0100 -Subject: libiberty-infinite-recursion-fix-2-of-2.patch - -;; Backport Fix typo in recent code to add stack recursion limit to the Rust demangler. -;; (Nick Clifton) - -libiberty - * rust-demangle.c (demangle_const): Add a missing goto pass_return - at the end of the function. - -diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c ---- a/libiberty/rust-demangle.c -+++ b/libiberty/rust-demangle.c -@@ -1217,6 +1217,7 @@ demangle_const (struct rust_demangler *rdm) - PRINT (": "); - PRINT (basic_type (ty_tag)); - } -+ goto pass_return; - - fail_return: - rdm->errored = 1; diff --git a/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch b/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch deleted file mode 100644 index 9296677..0000000 --- a/SOURCES/libiberty-infinite-recursion-fix-3-of-3.patch +++ /dev/null @@ -1,40 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Guinevere Larsen -Date: Mon, 30 Oct 2023 12:48:01 +0100 -Subject: libiberty-infinite-recursion-fix-3-of-3.patch - -fix backport error in patch 1 of this series. - -diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c ---- a/libiberty/rust-demangle.c -+++ b/libiberty/rust-demangle.c -@@ -1082,6 +1082,18 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) - if (rdm->errored) - return open; - -+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) -+ { -+ ++ rdm ->recursion; -+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) -+ { -+ /* FIXME: there ought to be a way to report -+ that the recorsion limit has been reached. */ -+ rdm->errored = 1; -+ goto end_of_func; -+ } -+ } -+ - if (eat (rdm, 'B')) - { - backref = parse_integer_62 (rdm); -@@ -1107,6 +1119,10 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) - } - else - demangle_path (rdm, 0); -+ end_of_func: -+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) -+ -- rdm->recursion; -+ - return open; - } - diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec index fe10da5..14fd810 100644 --- a/SPECS/gdb.spec +++ b/SPECS/gdb.spec @@ -73,7 +73,7 @@ Version: 12.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 5%{?dist} +Release: 4%{?dist} 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 # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1205,22 +1205,18 @@ fi %endif %changelog -* Mon Oct 30 2023 Guinevere Larsen - 12.1-5.el9 -- Fix issue introduced when backporting the recursion limit to the rust demangler. +* Thu Oct 12 2023 Keith Seitz - 12.1-4.el8 +- Backport "Add a recursion limit to the demangle_const function + in the Rust demangler." + (Nick Clifton, RHEL-4237) -* Tue Oct 10 2023 Guinevere Larsen - 12.1-4.el9 -- Backport "Fix typo in recent code to add stack recursion limit to the Rust demangler." - (Nick Clifton) -- Backport "Add a recursion limit to the demangle_const function in the Rust demangler." - (Nick Clifton, RHEL-4234) - -* Tue Jun 13 2023 Keith Seitz - 12.1-3.el9 +* Tue Jun 13 2023 Keith Seitz - 12.1-3.el8 - Backport "Update gdb-add-index.sh ..." - (Andrew Burgess, RHBZ 2213228) + (Andrew Burgess, RHBZ 2214593) * Thu Apr 27 2023 Keith Seitz - 12.1-2.el9 - Backport binutls/29699 "Fix an illegal memory access when parsing..." - (Nick Clifton, RHBZ 2153228) + (Nick Clifton, RHBZ 2153227) * Tue Apr 18 2023 Keith Seitz - 12.1-1.el9 - Initial import for GTS13.