From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 39BCF3858D1E for ; Sat, 6 Apr 2024 01:51:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39BCF3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 39BCF3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::533 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712368272; cv=none; b=cCN/g6CssF+N3J14x1ArDceDb/FDgCAofRlFjOahz6SeZpdlnt4bNipiF3iDFTl/FcORxLrRGoMXEXybclUHOmm6M6YKL9RAjTpdJYCe0KkRvd8kTm0x16Yk5Z8lx/anPxDdV3ZpG1dJSEoQMm0C5cFnvo7w+ZP4jeh9SB+YTNU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712368272; c=relaxed/simple; bh=O0uIw8qkhqv2s+Tuw2BJ+svv5cw9vKocNVp16d6TPvk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=vYE+o5JMKhxtO4GJ5bgpkn21Xt5T8z1ZmC6sJ2U+nn1Qk0Prfoy3SJOOvjo0gQ9BW6SOg6uZzsrLDHuOHJNKAdCem5jolUtdhe5nAeGxhO+Lcd/3QezI9ZmTrBJm4Q94Os6+HEQ7qw78WH9zomYoZjFCLM1N7RJc9vR4rAYd8Ps= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso2123150a12.3 for ; Fri, 05 Apr 2024 18:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712368268; x=1712973068; darn=sourceware.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kx+PXpW9qDahwGyJHom0O2cEHfxG3eiWX4swLtntfbQ=; b=C7WbJQwdd2BGGhPrXDhLWm0W4DH9x3dOkPUg4QmGza61/GyrSfextYtcXHbxT8B7X3 HeL5nVZCH259BrMso11XApJwKhsU4rG2qN/fC7W3FU/ONN+24ZvvTJICXuKk7Q0EVz9U 2gsnhQIO4qbaTyeGf67aGo0oQV5VwXK5mJz7/hHi1xrKwCZ6bLTGmYArkq5MNJwYamIR 3RkDV6E4dCSzgwwn63moCEyzDVn8G0f/71zNQsIDWPHDW2XT+dVZxeluJKOnxcKP/OQL QdZ7UXEKrjsYYdHpiQk1ZM+shKi1XkAIlLVnLZTAmsUlWCxlpvGpBhitd9FeedDyz0H+ bH6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712368268; x=1712973068; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kx+PXpW9qDahwGyJHom0O2cEHfxG3eiWX4swLtntfbQ=; b=AjdmNK2dyJwcoRQEfhdLXZ3D+54BM8rc/L7XzJJyEuMuKzumXKXAFnSQdKgOTqXC0E C2Uyk+p73qdo2K3avR6ls3pg/3p7/sAnpwQmqS6CIGtIRGNHvujh+vC40AvTsd/aLcSi 0x2egx8AKkCg1BkCvl0zZhbBxzVCnuqSHVa8Anf9NPitBEfrDORG1K/hXBe/r3VkEDJs mfjNGQrUQTpxElJbOnXIWlZaQxrhWsttziqEnqJYU5q70Qk6ZEEc6cbXl65rCtz2xBJp bOGycZLWhZh07JklfUxYoprqfIJBrG6PkFx3UzJr+PNE5QYsbClc9hu9PvWH+0CIoq2P D0Lg== X-Gm-Message-State: AOJu0YyRv8xyyw92Ff+krCK+d+h95Gi3rbjocxGuViSRmgFAtWsO1HYZ It0Uz3eynpl4D6Xt6zrjIVMIbVvrFS1Pjv4J7IlT/gWGT5QFn7AnmIbTyvdN X-Google-Smtp-Source: AGHT+IFc/H9XN6nGZ7dWyUvWjNEAEFbGZh7G0j5DuL8jif1lkQ4RmkE6fds+s5NQ4yrVbV4nE/17bg== X-Received: by 2002:a17:90a:f315:b0:29b:331e:ec47 with SMTP id ca21-20020a17090af31500b0029b331eec47mr2732995pjb.27.1712368268090; Fri, 05 Apr 2024 18:51:08 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:619:cdbb:6b8:965c]) by smtp.gmail.com with ESMTPSA id n5-20020a17090a394500b002a27132ac02sm2378831pjf.2.2024.04.05.18.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 18:51:07 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 1E289114031D; Sat, 6 Apr 2024 12:21:05 +1030 (ACDT) Date: Sat, 6 Apr 2024 12:21:05 +1030 From: Alan Modra To: "H.J. Lu" Cc: binutils@sourceware.org Subject: Re: [PATCH] elf: Use elf_link_first_hash_entry for first_hash Message-ID: References: <20240405233758.2040146-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240405233758.2040146-1-hjl.tools@gmail.com> X-Spam-Status: No, score=-3025.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Looks like we still have a problem with accesses to freed memory. This following is from link stage of LTO 1 test under valgrind. ==1443263== Invalid read of size 1 ==1443263== at 0x484CFE4: strcmp (vg_replace_strmem.c:939) ==1443263== by 0x56E16C: bfd_hash_lookup (hash.c:564) ==1443263== by 0x5A3C8F: elf_link_add_to_first_hash (elflink.c:4316) ==1443263== by 0x5AE60F: elf_link_add_object_symbols (elflink.c:5663) ==1443263== by 0x5B0672: bfd_elf_link_add_symbols (elflink.c:6333) ==1443263== by 0x41448F: load_symbols (ldlang.c:3129) ==1443263== by 0x4149D8: open_input_bfds (ldlang.c:3621) ==1443263== by 0x414968: open_input_bfds (ldlang.c:3569) ==1443263== by 0x4166A2: lang_process (ldlang.c:8162) ==1443263== by 0x4194D5: main (ldmain.c:504) ==1443263== Address 0x525e230 is 192 bytes inside a block of size 4,064 free'd ==1443263== at 0x484810F: free (vg_replace_malloc.c:974) ==1443263== by 0x8D4D87: objalloc_free_block (objalloc.c:248) ==1443263== by 0x5AEACC: elf_link_add_object_symbols (elflink.c:5790) ==1443263== by 0x5B0672: bfd_elf_link_add_symbols (elflink.c:6333) ==1443263== by 0x41448F: load_symbols (ldlang.c:3129) ==1443263== by 0x4149D8: open_input_bfds (ldlang.c:3621) ==1443263== by 0x414968: open_input_bfds (ldlang.c:3569) ==1443263== by 0x4166A2: lang_process (ldlang.c:8162) ==1443263== by 0x4194D5: main (ldmain.c:504) ==1443263== Block was alloc'd at ==1443263== at 0x4845828: malloc (vg_replace_malloc.c:431) ==1443263== by 0x8D4C10: _objalloc_alloc (objalloc.c:159) ==1443263== by 0x56E2EF: bfd_hash_allocate (hash.c:756) ==1443263== by 0x5833B8: _bfd_x86_elf_link_hash_newfunc (elfxx-x86.c:627) ==1443263== by 0x56DF72: bfd_hash_insert (hash.c:611) ==1443263== by 0x56E19E: bfd_hash_lookup (hash.c:586) ==1443263== by 0x56FE22: bfd_link_hash_lookup (linker.c:515) ==1443263== by 0x5A2D1B: elf_link_hash_lookup (elf-bfd.h:779) ==1443263== by 0x5AA12B: _bfd_elf_merge_symbol (elflink.c:1129) ==1443263== by 0x5AB3DB: _bfd_elf_add_default_symbol (elflink.c:2133) ==1443263== by 0x5AF282: elf_link_add_object_symbols (elflink.c:5413) ==1443263== by 0x5B0672: bfd_elf_link_add_symbols (elflink.c:6333) The objalloc_free_block is the one when restoring the linker hash table to as it was prior to adding symbols for an as-needed library that was found to not be needed. I'd rather not fix this by just copying the name when adding symbols to first_hash, if at all possible. -- Alan Modra Australia Development Lab, IBM