diff options
author | Marian Buschsieweke <marian.buschsieweke@posteo.net> | 2023-06-21 09:48:01 +0200 |
---|---|---|
committer | alice <alice@ayaya.dev> | 2023-06-21 21:52:56 +0000 |
commit | ffbf0688735e816471e4685e8d5a2dcc6a256abf (patch) | |
tree | 34f5dce06a0183f85efc632578b295ca198b305c | |
parent | d43d83a1f025567616c0d2311eb617b96e3d97f6 (diff) | |
download | aports-ffbf0688735e816471e4685e8d5a2dcc6a256abf.zip |
main/gdb: replace patch with upstream patch
The current patch fixing the segfault when inspecting a variable with
an absolute address by adding checks before dereferencing the
`the_bfd_section` member. The upstream patch instead makes sure to just
always provide the member even for variables with absolute addresses.
This replaces the patch with the solution handed in for inclusion in
upstream, see [1] and [2].
[1]: https://sourceware.org/pipermail/gdb-patches/2023-June/200406.html
[2]: https://sourceware.org/bugzilla/show_bug.cgi?id=30431
-rw-r--r-- | main/gdb/APKBUILD | 4 | ||||
-rw-r--r-- | main/gdb/fix-segfault-dereferencing-the_bfd_section.patch | 50 |
2 files changed, 28 insertions, 26 deletions
diff --git a/main/gdb/APKBUILD b/main/gdb/APKBUILD index 107aff3dc22..0c2618745cb 100644 --- a/main/gdb/APKBUILD +++ b/main/gdb/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=gdb pkgver=13.2 -pkgrel=2 +pkgrel=3 pkgdesc="The GNU Debugger" url="https://www.gnu.org/software/gdb/" arch="all" @@ -119,5 +119,5 @@ sha512sums=" 04911f87904b62dd7662435f9182b20485afb29ddb3d6398a9d31fef13495f7b70639c77fdae3a40e2775e270d7cd40d0cfd7ddf832372b506808d33c8301e01 ppc-musl.patch ab554899bbb2aa98261fd1b6beb4a71ed7c713a714bddd3fa7ec875258e39bd5474dc96a11accb4dadd316f3834f215e8395d3b373bf3affd122dc5b4a8fe710 ppc-ptregs.patch 58aacc7cdc119eab729a3c5a5521f6a0db41c6a5bc2d09d6e32cbdd071d85dd1a31b5e6559616f8da1237c5b79ad9e04aab485211e957b4d1ca752c0c5ad660b musl-signals.patch -ae0de066cbf167b8da0c9787441c86ca2afc67e269605734b36337092a14a2e74a56e560837d17db2eec431a5f46dcf31014f0917929266b1a9e150108f1c4eb fix-segfault-dereferencing-the_bfd_section.patch +f32dadecea9d9525d9a88e923ff292b80fdc5122a9fdeafc2282f636eb46c18267700a0662506b2b7e2b5177a695fc62999fab8623d655d6bf352311a4643a6f fix-segfault-dereferencing-the_bfd_section.patch " diff --git a/main/gdb/fix-segfault-dereferencing-the_bfd_section.patch b/main/gdb/fix-segfault-dereferencing-the_bfd_section.patch index 6c14c6afe85..17d9ad52192 100644 --- a/main/gdb/fix-segfault-dereferencing-the_bfd_section.patch +++ b/main/gdb/fix-segfault-dereferencing-the_bfd_section.patch @@ -1,25 +1,27 @@ -Fixes a segfault when printing a variable with obj_section->the_bfd_section -being NULL. +A user supplied an executable and a remote logfile that could be used +to crash gdb. The problem is that the BFD section for a particular +symbol was null, because the section was not marked "allocated". +Digging deeper, the problem was that elfread.c dropped the section for +absolute symbols. This patch fixes the crash. -See https://sourceware.org/bugzilla/show_bug.cgi?id=30431 for details. ---- a/gdb/findvar.c -+++ b/gdb/findvar.c -@@ -752,15 +752,15 @@ - obj_section = bmsym.minsym->obj_section (bmsym.objfile); - /* Relocate address, unless there is no section or the variable is - a TLS variable. */ -- if (obj_section == NULL -- || (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) -+ if (obj_section == NULL || -+ (obj_section->the_bfd_section && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)) - addr = bmsym.minsym->value_raw_address (); - else - addr = bmsym.value_address (); - if (overlay_debugging) - addr = symbol_overlayed_address (addr, obj_section); - /* Determine address of TLS variable. */ -- if (obj_section -+ if (obj_section && obj_section->the_bfd_section - && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) - addr = target_translate_tls_address (obj_section->objfile, addr); - } +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30431 +--- + gdb/elfread.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/elfread.c b/gdb/elfread.c +index 799e3b914f8..7697106e9b6 100644 +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -216,7 +216,8 @@ record_minimal_symbol (minimal_symbol_reader &reader, + ELF is malformed then this might not be the case. In that case don't + create an msymbol that references an uninitialised section object. */ + int section_index = 0; +- if ((bfd_section_flags (bfd_section) & SEC_ALLOC) == SEC_ALLOC) ++ if ((bfd_section_flags (bfd_section) & SEC_ALLOC) == SEC_ALLOC ++ || bfd_section == bfd_abs_section_ptr) + section_index = gdb_bfd_section_index (objfile->obfd.get (), bfd_section); + + struct minimal_symbol *result +-- +2.39.2 |