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 D0F563857419 for ; Mon, 21 Mar 2022 20:21:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0F563857419 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (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 448A31F0BB; Mon, 21 Mar 2022 16:21:25 -0400 (EDT) Message-ID: <1a80930b-0bf3-9147-2065-e1bf474990d0@simark.ca> Date: Mon, 21 Mar 2022 16:21:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3] [gdb/testsuite] test a function call by hand from pretty printer Content-Language: tl To: Bruno Larsen , gdb-patches@sourceware.org References: <20220223185729.25609-1-blarsen@redhat.com> <20220314203926.58662-1-blarsen@redhat.com> From: Simon Marchi In-Reply-To: <20220314203926.58662-1-blarsen@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3639.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 20:21:27 -0000 On 2022-03-14 16:39, Bruno Larsen via Gdb-patches wrote: > The test case added here is testing the bug gdb/28856, where calling a > function by hand from a pretty printer makes GDB crash. There are 6 > mechanisms to trigger this crash in the current test, using the commands > backtrace, up, down, finish, step and continue. Since the failure happens > because of use-after-free (more details below) the tests will always > have a chance of passing through sheer luck, but anecdotally they seem > to fail all of the time. > > The reason GDB is crashing is a use-after-free problem. The above > mentioned functions save a pointer to the current frame's information, > then calls the pretty printer, and uses the saved pointer for different > reasons, depending on the function. The issue happens because > call_function_by_hand needs to reset the obstack to get the current > frame, invalidating the saved pointer. > --- > > Changes from v2: > * Make .c follow GDB's coding style 2 - electric boogaloo > * .exp tests outputs, not just if GDB breaks or not > * added copyright header to .py file > > Changes from v1: > * make .c follow GDB's coding guidelines more closely > * Documented .exp file better > * renamed and refactored TCL proc to make it less confusing Hi, Having the test without the fix is annoying, because it crashes GDB on an ASan-enabled build, and causes failures that did not exist before, and the setup_kfails don't help for that. This is something we generally don't want, as we try to strictly progress towards less failures. Does the test actually test anything right now, given that everything is broken? If not, I'd suggest attaching the test case to the bug, and it can be merged along with the fix. Simon