From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id G7TZIzQVtGmEjicAWB0awg (envelope-from ) for ; Fri, 13 Mar 2026 09:46:28 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=qBDrcZPW; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 797521E08D; Fri, 13 Mar 2026 09:46:28 -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 5E9E31E08D for ; Fri, 13 Mar 2026 09:46:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id AF1504BC89A5 for ; Fri, 13 Mar 2026 13:46:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF1504BC89A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1773409586; bh=a0GWdhKzif4LW1jnPtcpU32Jp4v+qYqEKXas3uYe9Pg=; h=To:Cc:Subject:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=qBDrcZPWIA/WuQ/xuPDjw6gBgqPDqKfMIRKCwGTuQVF07rtg+RiVA/+WkqL69CbE7 gjXJfW3ZGK67In8dl+6kFSs5EMFTpgATJRYmWGu2SFDSgvJ7/hqkne6wfaLK5dCDM8 I8152ujarIBUVBaL2F6PAKGzujanX9SO/opLt9H8= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id BCC924BA2E11 for ; Fri, 13 Mar 2026 13:45:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCC924BA2E11 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BCC924BA2E11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773409550; cv=none; b=nDeIBfzjsuJRxhHRfTzSdu6YbaagFaJJNYXOst17isQHWwypV8u9YyDk9LhWqNZqksTD4pL7e3d14QqcvntCmUWb0GPNtlBu0ESgVJzbd/5yxzpaDtvUQsQmp7emZ0qmlbG3J7CL/O8ycQogjGIwaInm3BoerL682Yn8hajJdf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773409550; c=relaxed/simple; bh=xef46NNtA23BmU+COk73jPtwd8Q8KedOpfMjzBRb6uo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=riHj11hrDIUmyIZjnWGOqq+AeobzrKudKGxQyd0L81VaREEjuOyPkhtLONo4CFEI++BThei/y5BZu9dWJWlnIRz5K56zGXie5ZzYve0d2bmRGPWCY8/TwE6rgiE6N1SU3pyW56T5NIsaZlhp0Pfgdip/1d50B5ca4sAYxob00Zc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCC924BA2E11 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-EIHOq-8JP6-x3FDBVFMuow-1; Fri, 13 Mar 2026 09:45:49 -0400 X-MC-Unique: EIHOq-8JP6-x3FDBVFMuow-1 X-Mimecast-MFC-AGG-ID: EIHOq-8JP6-x3FDBVFMuow_1773409548 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-439af7ba802so2360141f8f.2 for ; Fri, 13 Mar 2026 06:45:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773409548; x=1774014348; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a0GWdhKzif4LW1jnPtcpU32Jp4v+qYqEKXas3uYe9Pg=; b=c9OFtIeNbO7Hoy4g24UYh1EF+UdghyQ+4Zf+tQly2bS8LexkBIPopiJ8/DRff8FFDC UF9evb/s/O8JOmRp7vdLmIoX5WtOQIjC1K1TPKXAPe1LvC+EfVXR2kXGvpeVHwr5/CbZ B68l4oll7vHrHj5cxtySCFkotVBqceNdVGgpXAbnrGruDmurkJAMw4JE9YRtBWooZpml e9t7M9S9Qz3sVragunoZF9tuvGgnCMZL42OvjO87DQYAc0bJVRGPGQGrQGcm3YixYJnn zduzQN2icsnn+r3qLLnqCbDsYGif/vyzeuaXP61t6DE1sjK3TPMWzSPD9O/DObx0MRfl Tyxg== X-Gm-Message-State: AOJu0YyCh0vgOew03LWZUVvXRjdcwbkuNYevcRwOu9Pne2K1IMnxw5EG SWmsXjdRCXQhnNikluJARR4dSNvwu3/lijhzNgxmfCjmmw3A/+qXnkCKtmfbKXW6ivGhv6/fvYR GxOUu0JSY1oYhO/M5D10Wo9r9FCdToCNVthSafBzUPb0Lt367d1HE X-Gm-Gg: ATEYQzzm3dvGLsNGknUj01gtCqgRk046Fjybb3CjAnJyJbWUBxvmk4tbv1891IUlogd 4IhfRD4M+A/fzKwAkcHc/LCaL8jZk8qhGxJxFyA8xGJZ4tl6w328ytDGxyWyVjHW47hptALTx7n ceyws/8D4tl9o0E0ZI3MEnUbdg/e9ThgWC2UHlZROsbVa5YR2eSrXGyygE+unMtK4d9ryzmSlBK HjM5V3KANbfT2n1m514HjDHyywG3Q5WitCsrUew7v3W6wmGyAUG9M+Eqeu84hOGbZMfTlkHFhgi xQr3b70iFHtf96rIvbWrbB0IUEsbOFG6NyNFTGfy/2gQByVA3OMk2kcZrDNAra+rFWRdMKU7QAr jKpl5OBmYmgePKczG X-Received: by 2002:a05:6000:430d:b0:439:b628:90e0 with SMTP id ffacd0b85a97d-43a04db4da0mr6530103f8f.28.1773409547799; Fri, 13 Mar 2026 06:45:47 -0700 (PDT) X-Received: by 2002:a05:6000:430d:b0:439:b628:90e0 with SMTP id ffacd0b85a97d-43a04db4da0mr6530053f8f.28.1773409547362; Fri, 13 Mar 2026 06:45:47 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe21b631sm20501417f8f.27.2026.03.13.06.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:45:46 -0700 (PDT) To: psmith@gnu.org Cc: gdb@sourceware.org Subject: Re: Does gdb debuginfod download libc etc.? In-Reply-To: <81c7757f1e140136fb40ffcaf7d605435a98a98d.camel@gnu.org> References: <86wlzmfyep.fsf@aarsen.me> <4844fe241f5524951dc68a6ce05e450897342034.camel@gnu.org> <8c514818-14bd-462d-8aed-0c323327acae@simark.ca> <7949b3d7727ab11f6bc3c833fae81f485c345c47.camel@gnu.org> <87ldg16ivz.fsf@redhat.com> <421fe2ad615c4af1443ddbd3955ee65cb7feb9ee.camel@gnu.org> <878qbz936m.fsf@redhat.com> <96dde02ef4f1d88779de1eebb5277a7258fadf46.camel@gnu.org> <87342690kz.fsf@redhat.com> <81c7757f1e140136fb40ffcaf7d605435a98a98d.camel@gnu.org> Date: Fri, 13 Mar 2026 13:45:45 +0000 Message-ID: <87zf4b7shi.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sHon1ri0iIVCah9NsdCOk1r8KxzYwUoUvIi8bwpIzL0_1773409548 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb Reply-To: Andrew Burgess Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" Paul Smith writes: > On Wed, 2026-03-11 at 09:28 +0000, Andrew Burgess wrote: >> I started working on cleaning up the patch ready for submission to >> master, but I'm pretty busy for the next few days, so it'll probably >> be next week now before I post anything. > > Hi Andrew; working more with this patch I think there might be an issue > with it: when I use it with my cores that don't have NT_FILE it works > well. But, when I use it with a core file that DOES have NT_FILE, it > has some odd behavior: basically some of the filenames found during the > map have invalid names (names with control characters etc.) > > Note, this is from GDB 17.1 with your patch applied, working with a > normal core file generated by the Linux kernel (via kill -6); I can see > from readelf -n that the NT_FILE section looks normal with no funky > characters in the filenames. > > GDB shows: > > [core-load] build_file_mappings: enter > [core-load] operator(): start = 0x0, end = 0x67dc, filename = NONE, build-id = NONE > [core-load] operator(): start = 0x200000, end = 0x521000, filename = , build-id = 38abc1e51499f5610bdd123e6336f7cb0f4146c2 > [core-load] operator(): start = 0x521000, end = 0x728000, filename = , build-id = NONE > [core-load] operator(): start = 0x728000, end = 0x735000, filename = ^F, build-id = NONE > > (here the ^F in the filename is the actual ASCII char 15). Then some > OK stuff then more problematic filenames: > > [core-load] operator(): start = 0x737000, end = 0x947000, filename = NONE, build-id = NONE > [core-load] operator(): start = 0x7fa8d9a00000, end = 0x7fa8e0400000, filename = NONE, build-id = NONE > [core-load] operator(): start = 0x7fa8e1600000, end = 0x7fa8e8c00000, filename = NONE, build-id = NONE > ... > [core-load] operator(): start = 0x7fa93a398000, end = 0x7fa93a3c0000, filename = ^A, build-id = 095c7ba148aeca81668091f718047078d57efddb > [core-load] operator(): start = 0x7fa93a3c0000, end = 0x7fa93a555000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a555000, end = 0x7fa93a5ad000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a5ad000, end = 0x7fa93a5ae000, filename = e, build-id = NONE > [core-load] operator(): start = 0x7fa93a5ae000, end = 0x7fa93a5b2000, filename = P^A, build-id = NONE > [core-load] operator(): start = 0x7fa93a5b2000, end = 0x7fa93a5b4000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a5b4000, end = 0x7fa93a5c3000, filename = NONE, build-id = NONE > [core-load] operator(): start = 0x7fa93a5c3000, end = 0x7fa93a5c4000, filename = E^A, build-id = 34f1f6beeaed8ab30ee4056ff1cc053f8d05c153 > [core-load] operator(): start = 0x7fa93a5c4000, end = 0x7fa93a5c5000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a5c5000, end = 0x7fa93a5c6000, filename = X, build-id = NONE > ... > [core-load] operator(): start = 0x7fa93a5cb000, end = 0x7fa93a5e2000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a5e2000, end = 0x7fa93a5e6000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a5e6000, end = 0x7fa93a5e7000, filename = ^?^K, build-id = NONE > [core-load] operator(): start = 0x7fa93a5e7000, end = 0x7fa93a5e8000, filename = <80>^K, build-id = NONE > [core-load] operator(): start = 0x7fa93a5e8000, end = 0x7fa93a5f6000, filename = /usr/l ^?^K, build-id = 2ac471af4796e5b69e0e2dde85c3d3dacdcc0b3d > [core-load] operator(): start = 0x7fa93a5f6000, end = 0x7fa93a672000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a672000, end = 0x7fa93a6cd000, filename = /usr/l^?^K, build-id = NONE > [core-load] operator(): start = 0x7fa93a6cd000, end = 0x7fa93a6ce000, filename = , build-id = NONE > [core-load] operator(): start = 0x7fa93a6ce000, end = 0x7fa93a6cf000, filename = /usr/l@^?^K, build-id = NONE > > I think something here might have messed up the parsing of the filename > section of the NT_FILE section? I'll try to look into this and see if > I can find it. I suspect this is a use-after-free bug. Try the patch below and let me know if this fixes things. Thanks, Andrew --- diff --git i/gdb/linux-tdep.c w/gdb/linux-tdep.c index 27443f7fb4b..148430d6d0a 100644 --- i/gdb/linux-tdep.c +++ w/gdb/linux-tdep.c @@ -1169,6 +1169,9 @@ linux_read_core_file_mappings /* The start address of each mapping. */ gdb::unordered_set mapping_start_addr_set; + /* ... */ + gdb::byte_vector contents; + /* It's not required that the NT_FILE note exists, so return silently if it's not found. Beyond this point though, we'll complain if problems are found. */ @@ -1185,7 +1188,7 @@ linux_read_core_file_mappings return; } - gdb::byte_vector contents (note_size); + contents.resize (note_size); if (!bfd_get_section_contents (cbfd, section, contents.data (), 0, note_size)) {