From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id nS9pDmcLR2JRVwAAWB0awg (envelope-from ) for ; Fri, 01 Apr 2022 10:25:43 -0400 Received: by simark.ca (Postfix, from userid 112) id 2B9401F1F4; Fri, 1 Apr 2022 10:25:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AADF71E150 for ; Fri, 1 Apr 2022 10:25:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36DAE3947429 for ; Fri, 1 Apr 2022 14:25:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36DAE3947429 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648823142; bh=vvKECluFd4YcEYYByXcgy9dWg5kikgLXK5SUuLfSQOo=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YXcNx1W2wtwxIL1ok0eP5PgEVr+vTcTPZ9KFXBAu2MfJ9ZCsEsyBw7HFle8YCg9X9 xbLr3HUGDS2cVPGuCxnSVJ4xz4XxL7XP4cgK0Og50cTKhtYTmdB2hHy+M8uSgO6wPs kGDIj3iuiYQdhToT/TGQcSFF+l/0Pd9A3C2LLAc4= 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> 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-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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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