From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BA57E3858C50 for ; Wed, 23 Mar 2022 15:37:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA57E3858C50 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-344-07tHKNHqMbKDmprAY2qVwQ-1; Wed, 23 Mar 2022 11:37:23 -0400 X-MC-Unique: 07tHKNHqMbKDmprAY2qVwQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB94180281D; Wed, 23 Mar 2022 15:37:22 +0000 (UTC) Received: from [10.97.116.58] (ovpn-116-58.gru2.redhat.com [10.97.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD38C403D188; Wed, 23 Mar 2022 15:37:21 +0000 (UTC) Message-ID: <853f9e05-c815-d04c-371c-0fb1f31df2f2@redhat.com> Date: Wed, 23 Mar 2022 12:37:18 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v3] [gdb/testsuite] test a function call by hand from pretty printer To: Simon Marchi , gdb-patches@sourceware.org References: <20220223185729.25609-1-blarsen@redhat.com> <20220314203926.58662-1-blarsen@redhat.com> <1a80930b-0bf3-9147-2065-e1bf474990d0@simark.ca> From: Bruno Larsen In-Reply-To: <1a80930b-0bf3-9147-2065-e1bf474990d0@simark.ca> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Wed, 23 Mar 2022 15:37:28 -0000 On 3/21/22 17:21, Simon Marchi wrote: > 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 > Hi Oh sorry, I didn't think about that. My thinking was that this looked like a pretty complex issue, so I could at least get some sort conversation going in case anyone knew how to fix the problem, and could help me find the origin of the problems. It doesn't test anything new that doesn't fail, but unfortunately, I had already pushed the change when your email arrived. If you want to remove it until I have a fix, I understand it. Sorry again. -- Cheers! Bruno Larsen