From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id B5510385189F for ; Fri, 16 Dec 2022 16:47:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B5510385189F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B24021E0CD; Fri, 16 Dec 2022 11:47:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1671209235; bh=HT+lsAR/QUTNglLREY+XRlfHZ1HUpttRorB0my7wV40=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=p0NGTosC3217KJco1QoTlZfvBREyRhnOdnLUIMUHTgdLkFppxCZRBei2F9n2K/cKt pjnFlR8wnTJ8QeeNNuOEPl2mz7b3Kt0QrGlSKe+RJQ/A+g49ur5A+bo9xOeAArvHQR DiG/khBpVQ6Z29dMyw1sjNBcWP91TdFHoGTObDjI= Message-ID: <62f3a8a8-7074-59c9-c03f-f6a69a26e20e@simark.ca> Date: Fri, 16 Dec 2022 11:47:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] gdb: fix command lookup in execute_command () Content-Language: en-US To: =?UTF-8?Q?Jan_Vran=c3=bd?= , "gdb-patches@sourceware.org" Cc: "tom@tromey.com" , "luis.machado@arm.com" References: <1a96057b-afd6-1e90-15c9-ee106a2998c7@arm.com> <20221213112241.621889-1-jan.vrany@labware.com> <878rjbfinm.fsf@tromey.com> <4dc13e01-2fd8-a63e-24f2-a1f7c7650d3b@simark.ca> From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 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