From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id B32393858D28 for ; Fri, 1 Apr 2022 14:25:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B32393858D28 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 231EPFuI016824 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 1 Apr 2022 10:25:20 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 231EPFuI016824 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 962921E150; Fri, 1 Apr 2022 10:25:15 -0400 (EDT) Message-ID: Date: Fri, 1 Apr 2022 10:25:15 -0400 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 3/8] gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done Content-Language: en-US To: Pedro Alves , gdb-patches@sourceware.org References: <20220117162742.524350-1-simon.marchi@polymtl.ca> <20220117162742.524350-4-simon.marchi@polymtl.ca> <866792ef-2f13-c6d5-2d2e-555f5f0d4695@palves.net> From: Simon Marchi In-Reply-To: <866792ef-2f13-c6d5-2d2e-555f5f0d4695@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 1 Apr 2022 14:25:15 +0000 X-Spam-Status: No, score=-3032.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Fri, 01 Apr 2022 14:25:24 -0000 On 2022-03-31 14:17, Pedro Alves wrote: > On 2022-01-17 16:27, Simon Marchi via Gdb-patches wrote: >> The inferior::waiting_for_vfork_done flag indicates that some thread in >> that inferior is waiting for a vfork-done event. Subsequent patches >> will need to know which thread is waiting for that event. >> >> I think there is a latent buglet in that waiting_for_vfork_done is >> currently not reset on inferior exec or exit. I could imagine that if a >> thread in the parent process calls exec or exit while another thread of >> the parent process is waiting for its vfork child to exec or exit, we >> could end up with inferior::waiting_for_vfork_done without a thread >> actually waiting for a vfork-done event anymore. And since that flag is >> checked in resume_1, things could misbehave there. >> >> Since the new field points to a thread_info object, and those are >> destroyed on exec or exit, it could be worse now since we could try to >> access freed memory, if thread_waiting_for_vfork_done were to point to a >> stale thread_info. To avoid this, clear the field in >> infrun_inferior_exit and infrun_inferior_execd. > > This is OK, please mention explicitly in the body of the commit log that this > is replacing the boolean with a thread_info pointer. Not having that > actually gave me pause. Ok, done locally. Simon