From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id C69523858D32 for ; Thu, 13 Apr 2023 10:59:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C69523858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62e.google.com with SMTP id 21so6360762plg.12 for ; Thu, 13 Apr 2023 03:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681383543; x=1683975543; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Z7ELAzCPSdL0gKhlZpIQTL9e3ZWaLCu5KEMslqEccGA=; b=SyUg8eG8ZwKi+WrNmGk6P7W3XsOcTA5SGKs5cIniR6ueye9YgngYHSLqWagiYKBsAy zQ+oLtCppZkZc3kURS6K2yE0k3qE7MjxO28/BlOIOeBdmArNT5t4mOA0cZ8yiAhQFw7/ TVOcsgWF1r1IWgdfJCkl6AvHx2aM3dF7Taq4/0HaZ1PHtE1iwGJvRrnsCbIcINveIgLM 5UkrRkI7p1EyhHhWY9mxy3TDVurq7u+M5gSXc81sDrl+DelNKT77/N6G2rpDzkA6R0fI pP/uAU34Y4MNRmr8TgQIuatTIUmUSel2nPhc8JoN/lraIM5JbEggST2HXZ0KRLUTQxIR KOQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681383543; x=1683975543; h=in-reply-to:content-transfer-encoding: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=Z7ELAzCPSdL0gKhlZpIQTL9e3ZWaLCu5KEMslqEccGA=; b=dVqQuEA+STpWmVzyLpC0FDDHF8tU+38ZRQ32Ecl2UGwYG5IfjbYUUtDNYBI4I9QxPf cQhbPvDqeTc2W/J0ajV3DaFY1a9kj2F+UMTra+I4ePheBL6/uyMQ4Fsu7kG+j69d6fRG CZ0D8Gv+UB5lKMMUHlNeIhF1XCzr66o82TXByb3bE+il0OXUkeQ7ccMTcOLK6dDD/kgf ovUJ9zCCRXp5xRvjC5ht42chs4HA3xgOTzPas/xLAN046hF+5sT6WCR5GmM8LnDftsbY mT+uXG8XSG0FN2Gvk6kH6kqx9ptLfSbEVQMGE4W1p6MA4uYxEjsfyR5TUCMykr5o2yB7 bu3w== X-Gm-Message-State: AAQBX9fJXwOlnwFCqTIv+y4M28pOjFEEJ+1cHSY9k2IxmuPZZGR/omK1 ci8eGK68pCJQ02N21E6LybdpLnsrArE= X-Google-Smtp-Source: AKy350ZzCHctY0On0ycWLHpejsYkxO/HKYcKiMK4k2RfTpZSXb643VIAzvJjI4zO5QrFMzkf7TTwNA== X-Received: by 2002:a17:902:efcb:b0:1a5:2760:74ef with SMTP id ja11-20020a170902efcb00b001a5276074efmr1804562plb.25.1681383543201; Thu, 13 Apr 2023 03:59:03 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:4d08:cebd:d73f:b794]) by smtp.gmail.com with ESMTPSA id jh10-20020a170903328a00b001a63ba28053sm1230070plb.68.2023.04.13.03.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:59:02 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id BB7351142C2A; Thu, 13 Apr 2023 20:28:59 +0930 (ACST) Date: Thu, 13 Apr 2023 20:28:59 +0930 From: Alan Modra To: Martin =?utf-8?B?TGnFoWth?= Cc: binutils@sourceware.org Subject: Re: pe_ILF_object_p and bfd_check_format_matches Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-3028.1 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: On Thu, Apr 13, 2023 at 11:55:10AM +0200, Martin Liška wrote: > On 4/13/23 04:58, Alan Modra via Binutils wrote: > > |The last patch wasn't quite correct.| > > Heh, I've just noticed that this change caused a crash when ar is called for ~150 files: > > ==27734== Invalid read of size 4 > ==27734== at 0x4D576DD: ftello (in /usr/lib64/libc.so.6) > ==27734== by 0x4958E18: close_one (in /usr/lib64/libbfd-2.40.50.20230412-797.so) Yes, that will be this part: > > It is also not correct to restore abfd->iostream unless the iovec > > changes. abfd->iostream is a FILE* when using cache_iovec, and if > > the file has been closed and reopened the iostream may have changed. I saw a similar invalid read in fseeko, and a double free in fclose due to the above. -- Alan Modra Australia Development Lab, IBM