From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id F34073858D32 for ; Thu, 13 Apr 2023 12:53:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F34073858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 35F7B1FD63; Thu, 13 Apr 2023 12:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681390429; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=to9PnhYcUkOX9wrsfwn13Hw70QBPYBRLPrex22ls5es=; b=VIoaHBqYwNetydPXkhaRxace3q/iN+I9G/2dwrX89fjgBvBliXg/gnwfkBI3957sZSIA4T K9Bh4uHWmp00n9eDBQsvqtVsvOBPwF+c26xCtmNig8xjKeIzHVy4rX5GKHVoA0+hgs/0zL 6hJADyMOdJcQlLoDZjGAZcZk9qdRefk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681390429; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=to9PnhYcUkOX9wrsfwn13Hw70QBPYBRLPrex22ls5es=; b=9c7uGy2lnb1VSsqZQjtfjLKMOBpeR0VVspT4YWWV7G0Nq0yYoxybtnvYWDZau+ti1vEOTv 0mYWxVTCDYLPkQCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 260E61390E; Thu, 13 Apr 2023 12:53:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SepfCF37N2R1DwAAMHmgww (envelope-from ); Thu, 13 Apr 2023 12:53:49 +0000 Message-ID: Date: Thu, 13 Apr 2023 14:53:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: pe_ILF_object_p and bfd_check_format_matches Content-Language: en-US To: Alan Modra Cc: binutils@sourceware.org References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 4/13/23 12:58, Alan Modra wrote: > 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. > Good, I can confirm the problem is gone with your latest change. Thanks, Martin