From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 0/5] gdbserver: fix memory bugs in x, X, m, and M packet handling
Date: Fri, 20 Nov 2026 15:12:45 +0000 [thread overview]
Message-ID: <cover.1795186852.git.aburgess@redhat.com> (raw)
Fix a number of bugs in the handling of x, X, m, and M packets on the gdbserver
side. These include buffer overflows, allowing the debug client (GDB) to
request allocation of huge memory buffers in gdbserver, which could cause
crashes or slow down, and writing uninitialised memory from gdbserver into the
inferior.
As part of this series I've merged two similar packet handling loops in
gdbserver/remote-utils.cc which removes some duplicate code.
Thanks,
Andrew
---
Andrew Burgess (5):
gdbserver: avoid buffer overflow from 'm' and 'x' packets
gdbserver: merge look_up_one_symbol and relocate_instruction packet
handling
gdbserver: fix buffer overflow in more m/x packet handling
gdbserver: reject X packets with an invalid declared length
gdbserver: reject M packets with an invalid declared length
gdb/doc/gdb.texinfo | 16 +
gdb/testsuite/gdb.server/mx-packet-overflow.c | 71 ++++
.../gdb.server/mx-packet-overflow.exp | 306 +++++++++++++++
gdbserver/remote-utils.cc | 364 ++++++++++--------
gdbserver/remote-utils.h | 10 +-
gdbserver/server.cc | 19 +-
6 files changed, 624 insertions(+), 162 deletions(-)
create mode 100644 gdb/testsuite/gdb.server/mx-packet-overflow.c
create mode 100644 gdb/testsuite/gdb.server/mx-packet-overflow.exp
base-commit: 5678a7bfceb3a6ea18bcde1ae68f7e96c43c998b
--
2.56.0
next reply other threads:[~2026-11-20 15:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 15:12 Andrew Burgess [this message]
2026-11-20 15:12 ` [PATCH 1/5] gdbserver: avoid buffer overflow from 'm' and 'x' packets Andrew Burgess
2026-11-20 15:37 ` Eli Zaretskii
2026-11-23 5:26 ` Kevin Buettner
2026-11-20 15:12 ` [PATCH 2/5] gdbserver: merge look_up_one_symbol and relocate_instruction packet handling Andrew Burgess
2026-11-25 5:55 ` Kevin Buettner
2026-11-26 14:58 ` Andrew Burgess
2026-11-20 15:12 ` [PATCH 3/5] gdbserver: fix buffer overflow in more m/x " Andrew Burgess
2026-11-25 7:24 ` Kevin Buettner
2026-11-20 15:12 ` [PATCH 4/5] gdbserver: reject X packets with an invalid declared length Andrew Burgess
2026-11-25 7:48 ` Kevin Buettner
2026-11-25 7:48 ` Kevin Buettner
2026-11-20 15:12 ` [PATCH 5/5] gdbserver: reject M " Andrew Burgess
2026-11-25 8:03 ` Kevin Buettner
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.1795186852.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