From: Simon Marchi <simark@simark.ca>
To: "Jan Vraný" <Jan.Vrany@labware.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "tom@tromey.com" <tom@tromey.com>,
"luis.machado@arm.com" <luis.machado@arm.com>
Subject: Re: [PATCH] gdb: fix command lookup in execute_command ()
Date: Fri, 16 Dec 2022 11:47:15 -0500 [thread overview]
Message-ID: <62f3a8a8-7074-59c9-c03f-f6a69a26e20e@simark.ca> (raw)
In-Reply-To: <d467a1a4a2f967087cbae787d801cdeab3b98a2d.camel@labware.com>
On 12/16/22 09:07, Jan Vraný wrote:
> On Tue, 2022-12-13 at 14:29 -0500, Simon Marchi wrote:
>> On 12/13/22 13:48, Jan Vraný wrote:
>>> On Tue, 2022-12-13 at 08:05 -0700, Tom Tromey wrote:
>>>>>>>>> "Jan" == Jan Vrany via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>>
>>>> Jan> The below patch should fix this case - with it on my system
>>>> Jan> gdb.base/define.exp passes.
>>>>
>>>> Jan> Alternatively I may just revert the commit until better solution
>>>> Jan> is found.
>>>>
>>>> This patch looks ok to me, but could you say whether you ran all the
>>>> tests or just define.exp? Given the history I think a full regression
>>>> test is warranted.
>>>
>>> I did use try-build which succeeded (build #28) but it seems to me it
>>> runs only very limited number of tests.
>>>
>>> I did run all of gdb.base and did not spot any new regression compared
>>> to master with my (previous, broken) patch reverted. I did not run more
>>> than gdb.base mainly because just gdb.base takes about an hour on my machine.
>>> Also I get weird intermittent failures when running testsuite.
>>>
>>> Jan
>>
>> Here are the unexpected failures I saw:
>>
>> UNRESOLVED: gdb.base/bp-cmds-execution-x-script.exp: run to end
>> UNRESOLVED: gdb.base/bp-cmds-run-with-ex.exp: execute bp commands
>> UNRESOLVED: gdb.base/bp-cmds-sourced-script.exp: source the script
>> ...
>> UNRESOLVED: gdb.trace/save-trace.exp: absolute: read back saved tracepoints
>> UNRESOLVED: gdb.trace/save-trace.exp: absolute: verify recovered tracepoints
>> DUPLICATE: gdb.trace/save-trace.exp: absolute: verify recovered tracepoints
>> UNRESOLVED: gdb.trace/save-trace.exp: absolute: verify default-collect
>> UNRESOLVED: gdb.trace/save-trace.exp: verify help save tracepoints
>>
>>
>
> I just rebased the below fix atop of Simon's buffer patch
> (f8631e5e "gdb: remove static buffer in command_line_input")
> and on my machine with ASan-enabled gdb:
>
> * all of gdb.base pass except 8 tests are shaky (they failed
> even before any of these changes)
> * gdb.python/py-cmd.exp passes
>
> But given the history, I'm far from being sure...
>
> Jan
>
> -- >8 --
> Subject: [PATCH] gdb: fix command lookup in execute_command ()
>
> Commit b5661ff2 ("gdb: fix possible use-after-free when
> executing commands") used lookup_cmd_exact () to lookup
> command again after its execution to avoid possible
> use-after-free error.
>
> However this change broke test gdb.base/define.exp which
> defines a post-hook for subcommand ("target testsuite").
> In this case, lookup_cmd_exact () returned NULL because
> there's no command 'testsuite' in top-level commands.
>
> This commit fixes this case by looking up the command again
> using the original command line via lookup_cmd ().
I ran the patch through my CI job, looks good. You can add my
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
next prev parent reply other threads:[~2022-12-16 16:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 14:20 [PATCH] gdb: fix possible use-after-free when executing commands Jan Vrany
2022-12-09 17:55 ` Tom Tromey
2022-12-12 15:05 ` Luis Machado
2022-12-12 15:08 ` Jan Vraný
2022-12-12 15:09 ` Luis Machado
2022-12-13 11:22 ` [PATCH] gdb: fix command lookup in execute_command () Jan Vrany
2022-12-13 15:05 ` Tom Tromey
2022-12-13 16:43 ` Simon Marchi
2022-12-13 18:48 ` Jan Vraný
2022-12-13 19:29 ` Simon Marchi
2022-12-14 11:07 ` [PATCH] gdb: fix command lookup in execute_command () commands" Jan Vrany
2022-12-14 15:35 ` Simon Marchi
2022-12-14 15:41 ` Jan Vraný
2022-12-14 15:59 ` Tom Tromey
2022-12-14 16:01 ` Simon Marchi
2022-12-14 18:05 ` Tom Tromey
2022-12-14 18:30 ` Simon Marchi
2022-12-14 22:01 ` Simon Marchi
2022-12-16 14:07 ` [PATCH] gdb: fix command lookup in execute_command () Jan Vraný
2022-12-16 16:47 ` Simon Marchi [this message]
2022-12-19 11:48 ` Jan Vraný
2022-12-19 14:46 ` Tom Tromey
2022-12-19 15:51 ` Jan Vraný
2022-12-20 19:10 ` Tom Tromey
2022-12-14 19:52 ` [PATCH] gdb: fix possible use-after-free when executing commands Simon Marchi
2022-12-14 20:39 ` Jan Vraný
2022-12-14 20:42 ` Simon Marchi
2022-12-15 12:57 ` Jan Vrany
2022-12-15 13:53 ` Simon Marchi
2022-12-15 14:51 ` Jan Vrany
2022-12-15 16:00 ` 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=62f3a8a8-7074-59c9-c03f-f6a69a26e20e@simark.ca \
--to=simark@simark.ca \
--cc=Jan.Vrany@labware.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@arm.com \
--cc=tom@tromey.com \
/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).