From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IBR+OW7wRWIcEwAAWB0awg (envelope-from ) for ; Thu, 31 Mar 2022 14:18:22 -0400 Received: by simark.ca (Postfix, from userid 112) id E81A71F163; Thu, 31 Mar 2022 14:18:22 -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.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=unavailable 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 976821ED17 for ; Thu, 31 Mar 2022 14:18:22 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 094E93839406 for ; Thu, 31 Mar 2022 18:18:22 +0000 (GMT) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id 3D04A383943F for ; Thu, 31 Mar 2022 18:17:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D04A383943F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f52.google.com with SMTP id p26-20020a05600c1d9a00b0038ccbff1951so2299911wms.1 for ; Thu, 31 Mar 2022 11:17:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=Hf1NXI0xqq317PWfskCLkiISgTp8hwLKcSxKsZr7BRE=; b=vrEPisc3Xfe+rkOq3b1kxFJxHZCUqMBWIOPl9xYW/mek1JnR2FLIS1jLexUBAJWFZy OrjQGt3GPC/sX7tD1IVaVY6eQ7x6ff2aFxfXC0RgFwyvD1DdgRoYee3R/Ax0vuu3+Mj8 u5cGZ2NbBGGa1L2I8WrSFxbz0a2WOFCEC53cSmpzB2ked6igVz9DWjxqqiXoK5TBCBQx mc5oPMGBGN6dr8eZqUUphI+ofWzsqpAHvbKMRpzePdyLTZ6adnL/SuTO/ZLv9A4Zu6+l IQwzWQiQX9PNGAaTgUbmqmvfy5rdHOzHcNFz5uozxzgqNZhBYS+jYpF3Z3X5UupYmT6w 45Rw== X-Gm-Message-State: AOAM5308vx54Hrn8LroUE/Mpa1luFAbF9KdRb/9JMw6R58Kpjv1jXU3f y/vEvFvmCZ7rDArM918SfUI= X-Google-Smtp-Source: ABdhPJxcKr0QeXImmiQgUUotxmAPzfVY/RjA7qW1WDTfK/Rw11QlbOmnELMN+9dHlxMLmzVdBT6rgQ== X-Received: by 2002:a7b:cb84:0:b0:382:a9b9:2339 with SMTP id m4-20020a7bcb84000000b00382a9b92339mr5858245wmi.91.1648750629918; Thu, 31 Mar 2022 11:17:09 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id e12-20020a5d6d0c000000b001a65e479d20sm148019wrq.83.2022.03.31.11.17.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Mar 2022 11:17:08 -0700 (PDT) Message-ID: <866792ef-2f13-c6d5-2d2e-555f5f0d4695@palves.net> Date: Thu, 31 Mar 2022 19:17:07 +0100 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: Simon Marchi , gdb-patches@sourceware.org References: <20220117162742.524350-1-simon.marchi@polymtl.ca> <20220117162742.524350-4-simon.marchi@polymtl.ca> From: Pedro Alves In-Reply-To: <20220117162742.524350-4-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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.