From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SUxgM23TYmoHyioAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 22:52:29 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=zQQrAXTr; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CDF261E09E; Thu, 23 Jul 2026 22:52:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 31B721E033 for ; Thu, 23 Jul 2026 22:52:29 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAED04BA23DB for ; Fri, 24 Jul 2026 02:52:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAED04BA23DB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=zQQrAXTr Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id D274C4BA2E0B for ; Fri, 24 Jul 2026 02:52:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D274C4BA2E0B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D274C4BA2E0B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784861523; cv=none; b=uXcBwGtDgk9a315eNz7MAWkBug74jrQ77C6894MNVhFhfkTCwiT+jaHHwA72+xHiOTkgLXmj8/f9LlHwxZkEwpPwvcP2dfk20gu6kmmVEK/O7pFbeTGhUoMkHs0FlbQ9xY1dWwlLn6OnCFcjCBwpzb85wX40pqJL+d8FWQmYDxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784861523; c=relaxed/simple; bh=cuI+k7pSbISQXKB56+nrWGLkTJ+Gz581BPGlQnW7Cfs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=R1KbRtAwegJMI7IrPNH4rTJecQ+1L343g0eTWrN2h8hhfNo07ik2/Oe5J6B9ynk5A+exLKs35ofvlJzOrGIKUxJggqyUMyesc35E9xVJNqV/3DWRt5PqsLKbcUuVISmyj/K6AO9ImM/JHsgFSq6H3pE77zM+si0v2kbKGxgZCjk= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=zQQrAXTr DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D274C4BA2E0B Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2cad4170e8eso20625435ad.3 for ; Thu, 23 Jul 2026 19:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1784861522; x=1785466322; darn=sourceware.org; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=8gKbqmlB4cbzmDX2PqjeOzcNLqAw8O0aq7ooIqkcqSM=; b=zQQrAXTrCQznp88rOo/5TDqAeqV0PbD16CK+syzf8ZJPMix/YZ8c9Wekc9uGv4X6cT jTEyQOEg4F3UffF19szFPKKuzwWwws3Pj13fNJYH1LzQ3HSaXdH1jAj35Zv3MbkHLijL pFpfeKOQyM9UY+NZOll0oJACZZetnNcB3anrngvhZTb1vExbN6z4fmZzJRw+dXuaw66d NhMMt+GvfpCQnPzbtXJbR5CBmWEXhUxwUr9LqDKHsyf0nGmdMsKS1gfl7h4MnseMpzjh v6jQK3UAlD3uHghCq30bYTjA4rnuvTJCegDl2BVD4/UCDtP173488mOtRGkGu6AJi4Bx TyKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784861522; x=1785466322; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=8gKbqmlB4cbzmDX2PqjeOzcNLqAw8O0aq7ooIqkcqSM=; b=hf3WhkndkTG63R3mjy7P3Dgvl1f6WZw5EeNnfyWQhErSwMKSFzDgEEEJ5hHOAkVsy1 MmY1DBMs13NwVHW6N+H6KGiArZScnfX2gmNQNWf2m2WAq8oKK/UNgYgpx76GIJ+QjYHO XtSrUTzNc31Ryrocq8wUSNUUm5vzNyYrX41qKVUPSn9jm9+G7f9Uk7COgMIq/ysM1fat AQ7PDj7M0naOOB5L7je+ZGYTo4yR7QiUp4cJ12b7s48OCS4LbkeiIPgVImaMJItTy8Xj jXwyvLvEdo4+0NmRWsSkAWbhTK50HCAzqwdslmNpuCvRhLlQsyP+ZAmLgzwNw7muI9ew YHlA== X-Gm-Message-State: AOJu0YwftbRZc+MeTOfV3o4Z53+rQIDkJW9kYI6ttUpuMQw2XSRT4MH/ gn+Bqn1Vw4PsNe39LycKTtSSPiyHipNRLV/VmSjnPSC156pH2LaLm/pIb1GI4esPAtU= X-Gm-Gg: AR+sD13/bju5X7gI+i6fEk2CfWc05F9WLaxxh5aYHUtRbv3b7dCP8roFdTDGpg3JI0t 0ieh4+cFK2jWuLMVwBDC4hqzDZqWWEw3JaiEqBk0+dGMWKpB+2GqOw61KqtX4kHvN7KSq3M/gEW Q0rM4SQj1dvBU7P+ZkcwMGGv9Bni5E4wWFF3KdrgJuH8qhbQJ2Peb/2VtgVS9TsaVUxg8Ftoy+q AG/p0T39Tk0WyM10AKAXe1Uf3Uff5ra0yjwGPWQSEhpRbv9SPSXOwWLfF2cWiorIIlPxNnVKa6K OdiuBiFZ6L/WhrzJjsdCM89vlMiu2NuwnXl7JOBehWb2iGkL09/edhSFBOU0CTrgLit+t8LB3dk K+34hngsFRsRTgwv4izFwG5xK1hkpkeHiZIuE5qOVLmK3EoDom+xMKHrBrI9BxsNhg99djC+Ev6 9Rd7QOTtLV6R/GuPGk+vgnTRY= X-Received: by 2002:a17:903:19eb:b0:2cf:477f:57cc with SMTP id d9443c01a7336-2cfa6a43f6fmr68567455ad.4.1784861521594; Thu, 23 Jul 2026 19:52:01 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3147df09ac0sm22172097eec.16.2026.07.23.19.52.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 19:52:01 -0700 (PDT) From: Thiago Jung Bauermann To: Matthieu Longo Cc: gdb-patches@sourceware.org, Luis Machado , Luis Machado , Andrew Burgess , Yury Khrustalev , Pedro Alves , Tom Tromey Subject: Re: [PATCH v1 07/10] gdb/linux-tdep: migrate linux_find_memory_regions_full to file_reader_t In-Reply-To: <6fc7a8ab-4644-4ac2-960e-49f6d7dfbbe2@arm.com> (Matthieu Longo's message of "Tue, 14 Jul 2026 09:40:55 +0100") References: <20260707154900.94542-1-matthieu.longo@arm.com> <20260707154900.94542-8-matthieu.longo@arm.com> <87zf00zn2t.fsf@linaro.org> <6fc7a8ab-4644-4ac2-960e-49f6d7dfbbe2@arm.com> User-Agent: mu4e 1.14.2; emacs 30.2 Date: Fri, 24 Jul 2026 02:51:58 +0000 Message-ID: <878q71f6b5.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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 Matthieu Longo writes: > On 09/07/2026 07:36, Thiago Jung Bauermann wrote: >> Matthieu Longo writes: >> >>> The previous implementation of linux_find_memory_regions_full could >>> still return success even when none of the /proc/PID/[s]maps files >>> existed, or all reads returned 0 bytes (this last case can happen on >>> Linux when the thread-group leader has exited). >>> As a result, the function could incorrectly succeed, allowing core >>> dump generation via the gcore command. >>> This logical defect was allowing, by chance, the function to return >>> success and hence, allowing fortuitously the codedump generation via >>> gcore command (see gcore-stale-thread test for more details). >> >> Did you run into this problem, or just noticed it by inspecting the >> code? If the former, do you think it's worth adding a testcase to make >> sure this problem doesn't appear again? >> > > The command stopped working after I migrated the function to file_reader_t. > As Christina Schimpe mentioned it, bool operator () now returns false if the buffer is > null, or if > the size returned is 0. This last is a change with the previous behavior. > When the thread-group leader exits, the /proc/pid/[s]maps files still exist, but become > empty. > In such a case, the function should return false instead of trying to parse an empty > string, which > results in no smaps data entry being processed, and so no callback called. This behavior is > erroneous in my opinion. > > I don't think that it is worth adding a testcase for this, because the root cause was the > wrong pid > being used. Ah, thanks for the explanation. I agree with you. -- Thiago (he/him)