From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0cd0EZRVsGmm+SEAWB0awg (envelope-from ) for ; Tue, 10 Mar 2026 13:32:04 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=L78cKdsb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 428771E0DD; Tue, 10 Mar 2026 13:32:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 5C1E11E089 for ; Tue, 10 Mar 2026 13:32:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id EB7FF4BAD14E for ; Tue, 10 Mar 2026 17:32:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB7FF4BAD14E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=L78cKdsb Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A7FD04B9DB70 for ; Tue, 10 Mar 2026 17:31:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7FD04B9DB70 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7FD04B9DB70 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773163872; cv=none; b=qudU7bYhMJWASXDG2iyqcXTwuJSbNSg+74z05NARRKq8Kn+F6jLhtoAc2oIbEriGijNswvO7IjDv9U+O72mic8IHso9RRtKudoFz/z9E0KyrIlD1paIUVmR6mG/ECZ2uHXf1PUKm3SoLO7LAKFk4TRf+NOabTVMGAChYmkLtOgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773163872; c=relaxed/simple; bh=jKPNgd8uDtfDoBQ6VRWTzfaeN8ouJxRAXxWEYqdL9pE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LPEkTFGRVKCzXb6qtXIpnu/qGhNqyMqqxSlrupkNf+gvpFYKsmV0vEMssD9gKBu/Mcb+unXe6iOr4eMnw/jIXJzmMioN+bPs3xmnU+p9FaaNfUEMZqXmle8LBXHCqnGrdRhMWJ27yAGVMxFSr3NRAj/7WvjTUu3OXxr/33SG6IU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7FD04B9DB70 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 62AHV7GH140217 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2026 13:31:11 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 62AHV7GH140217 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1773163872; bh=diAaFC94osi+OwDemR464+LV6yvYNW14V6GxgeTvFXI=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=L78cKdsb2tCFX6RqSQ56QXFBU/KCoEzY+4lLssGLERdPsCA9fvJlVuDW8IrCS9n2L CNmXC0B2Crp61d4777suKQeKD/W8M+I8DkAs6Il0Cpzu3Er6tAqRf4wDPvSXoPM4DR vaDsgMoiIeDLTVpxerr//sGeDeaHXcW4s8cm7OcR71sTHFM2ECjquYdvV+bt+fffTj v2mT/X18Mv3GmY+1HTV1KWk0UQSC0yDQ2zYKgV4jkF5M8hfwRmRe0xAm2eUz98yXM8 M1KaCdb1cWxJemrtd/3ik2jgyLzz+fixCgEexktPWjRCtxgit7UkNCUmwZnlCsoRBA t28qBizedVjkQ== Received: by simark.ca (Postfix) id C05721E09A; Tue, 10 Mar 2026 13:31:06 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/5] gdb/gcore: check return values of some find_memory_region_ftype calls Date: Tue, 10 Mar 2026 13:30:33 -0400 Message-ID: <20260310173104.676640-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260310173104.676640-1-simon.marchi@polymtl.ca> References: <20260310173104.676640-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 10 Mar 2026 17:31:07 +0000 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 From: Simon Marchi This fixes some spots that didn't check the return value of a find_memory_region_ftype callback. Change-Id: Ic57933ce76709ca16c93bc66c21da97afb3163a2 --- gdb/gcore.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/gdb/gcore.c b/gdb/gcore.c index 7c6d5f8667f7..2bf300c0d29f 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -558,25 +558,27 @@ objfile_find_memory_regions (struct target_ops *self, } /* Make a stack segment. */ - if (derive_stack_segment (&temp_bottom, &temp_top)) - (*func) (temp_bottom, temp_top - temp_bottom, - true, /* Stack section will be readable. */ - true, /* Stack section will be writable. */ - false, /* Stack section will not be executable. */ - true, /* Stack section will be modified. */ - false, /* No memory tags in the object file. */ - obfd); + if (derive_stack_segment (&temp_bottom, &temp_top) + && !func (temp_bottom, temp_top - temp_bottom, + true, /* Stack section will be readable. */ + true, /* Stack section will be writable. */ + false, /* Stack section will not be executable. */ + true, /* Stack section will be modified. */ + false, /* No memory tags in the object file. */ + obfd)) + return false; /* Make a heap segment. */ if (derive_heap_segment (current_program_space->exec_bfd (), &temp_bottom, - &temp_top)) - (*func) (temp_bottom, temp_top - temp_bottom, - true, /* Heap section will be readable. */ - true, /* Heap section will be writable. */ - false, /* Heap section will not be executable. */ - true, /* Heap section will be modified. */ - false, /* No memory tags in the object file. */ - obfd); + &temp_top) + && !func (temp_bottom, temp_top - temp_bottom, + true, /* Heap section will be readable. */ + true, /* Heap section will be writable. */ + false, /* Heap section will not be executable. */ + true, /* Heap section will be modified. */ + false, /* No memory tags in the object file. */ + obfd)) + return false; return true; } -- 2.53.0