From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 0/6] Improved error handling for .gdb_index parsing
Date: Sun, 18 Oct 2026 21:50:29 +0100 [thread overview]
Message-ID: <cover.1792356284.git.aburgess@redhat.com> (raw)
This started with Simon pointing out that one of my patches would
create an invalid .gdb_index, which when read back in would cause GDB
to crash.
After fixing my original patch, my second take away from Simon's
review was that GDB really shouldn't be crashing when presented with
an invalid .gdb_index.
Having looking through our .gdb_index code the error handling is
pretty minimal, we mostly assume that the incoming .gdb_index is
correctly formed, which we really shouldn't be doing -- it's extenal
input to GDB and we should treat it as untrusted.
I certainly don't claim that this series fixes all the bugs in our
.gdb_index parsing code, but it does fix a number of pretty obvious
ones, and adds a mechanism for generating .gdb_index sections to our
DWARF assembler, so future bug fixes should be easier to write tests
for.
Feedback welcome,
Thanks,
Andrew
---
Andrew Burgess (6):
gdb: a number of fixes for .gdb_index parsing
gdb: handle incorrect CU size in .gdb_index
gdb: validate the CU vector offset when loading the .gdb_index
gdb: address table parsing fixes and tests for .gdb_index
gdb: handle corrupted .gdb_index header offsets
gdb: extend .gdb_index tests to skip all data blocks
gdb/dwarf2/read-gdb-index.c | 212 +++++-
.../gdb.dwarf2/gdb-index-corrupted.c | 47 ++
.../gdb.dwarf2/gdb-index-corrupted.exp | 679 +++++++++++++++++
.../gdb.dwarf2/gdb-index-tiny-header.S | 49 ++
.../gdb.dwarf2/gdb-index-tiny-header.exp | 121 +++
gdb/testsuite/lib/dwarf.exp | 709 ++++++++++++++++++
6 files changed, 1802 insertions(+), 15 deletions(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/gdb-index-corrupted.c
create mode 100644 gdb/testsuite/gdb.dwarf2/gdb-index-corrupted.exp
create mode 100644 gdb/testsuite/gdb.dwarf2/gdb-index-tiny-header.S
create mode 100644 gdb/testsuite/gdb.dwarf2/gdb-index-tiny-header.exp
base-commit: abcacfa2875d31480637ac082ce4862d518992f2
--
2.25.4
next reply other threads:[~2026-10-18 20:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 20:50 Andrew Burgess [this message]
2026-10-18 20:50 ` [PATCH 1/6] gdb: a number of fixes " Andrew Burgess
2026-10-20 18:39 ` Simon Marchi
2026-10-18 20:50 ` [PATCH 2/6] gdb: handle incorrect CU size in .gdb_index Andrew Burgess
2026-10-20 18:50 ` Simon Marchi
2026-10-18 20:50 ` [PATCH 3/6] gdb: validate the CU vector offset when loading the .gdb_index Andrew Burgess
2026-10-20 19:00 ` Simon Marchi
2026-10-18 20:50 ` [PATCH 4/6] gdb: address table parsing fixes and tests for .gdb_index Andrew Burgess
2026-10-20 19:09 ` Simon Marchi
2026-10-18 20:50 ` [PATCH 5/6] gdb: handle corrupted .gdb_index header offsets Andrew Burgess
2026-10-20 19:23 ` Simon Marchi
2026-10-18 20:50 ` [PATCH 6/6] gdb: extend .gdb_index tests to skip all data blocks Andrew Burgess
2026-10-20 19:32 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1792356284.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox