From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>, Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 0/4] Some alloca removal and a printf bug fix
Date: Thu, 1 Jun 2023 10:27:49 +0100 [thread overview]
Message-ID: <cover.1685611212.git.aburgess@redhat.com> (raw)
I previously posted this series in an attempt to remove lots of alloca use:
https://inbox.sourceware.org/gdb-patches/cover.1677533215.git.aburgess@redhat.com/
there was some push back against that complete series, however, I
think the problem that was pointed out doesn't apply to one of the
original patches, so this series started with me trying to upstream
that one patch (this is patch #2 in this series).
However, while reviewing the patch again I spotted a bug I'd
introduced. Which means we have a gap in our testing, as the bug was
not exposed during testing. So I started to write a test, and hit
another bug (not one introduced by me), this is fixed in patch #1 in
this series.
My original series didn't remove all the uses of alloca from
printcmd.c, I don't recall why. But on review it's actually pretty
easy to remove the final alloca from printcmd.c, so that's what
patch #3 in this series does.
And finally, while working on patch #2 I realised that a badly formed
inferior (e.g. one that needed debugging due to memory corruption)
could cause GDB to try and allocate a huge ammount of memory,
potentially crashing GDB. This is mitigated in patch #4.
---
Andrew Burgess (4):
gdb: fix printf of wchar_t early in a gdb session
gdb: remove two uses of alloca from printcmd.c
gdb: remove last alloca call from printcmd.c
gdb: check max-value-size when reading strings for printf
gdb/c-lang.c | 3 -
gdb/gdbtypes.c | 11 ++-
gdb/gdbtypes.h | 14 ++-
gdb/printcmd.c | 102 +++++++++++++---------
gdb/testsuite/gdb.base/printcmds.c | 2 +
gdb/testsuite/gdb.base/printcmds.exp | 5 ++
gdb/testsuite/gdb.base/printf-wchar_t.c | 28 ++++++
gdb/testsuite/gdb.base/printf-wchar_t.exp | 32 +++++++
gdb/testsuite/lib/gdb.exp | 30 +++++++
gdb/value.c | 10 ++-
gdb/value.h | 5 ++
11 files changed, 192 insertions(+), 50 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.c
create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.exp
base-commit: e9683acf5e51c2bac8aa68d30d9ac3683dddcc7d
--
2.25.4
next reply other threads:[~2023-06-01 9:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 9:27 Andrew Burgess [this message]
2023-06-01 9:27 ` [PATCH 1/4] gdb: fix printf of wchar_t early in a gdb session Andrew Burgess
2023-06-02 16:54 ` Tom Tromey
2023-06-01 9:27 ` [PATCH 2/4] gdb: remove two uses of alloca from printcmd.c Andrew Burgess
2023-06-01 9:27 ` [PATCH 3/4] gdb: remove last alloca call " Andrew Burgess
2023-06-01 9:27 ` [PATCH 4/4] gdb: check max-value-size when reading strings for printf Andrew Burgess
2023-06-02 17:05 ` Tom Tromey
2023-06-05 9:43 ` Andrew Burgess
2023-07-04 13:20 ` Andrew Burgess
2023-07-04 13:24 ` Eli Zaretskii
2023-06-02 17:06 ` [PATCH 0/4] Some alloca removal and a printf bug fix Tom Tromey
2023-07-07 14:34 ` Andrew Burgess
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.1685611212.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).