From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id C28AD3858C39 for ; Tue, 28 Dec 2021 08:19:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C28AD3858C39 Received: by mail-pl1-x630.google.com with SMTP id h1so9838770pls.11 for ; Tue, 28 Dec 2021 00:19:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ADP3+QI7w+BsFkGjA/4Xdf40KSHBCN3wR8vKR3Vy40Q=; b=jhH/wgr+lBSBhDgMdWEcqzKQg2BJjGipw/D0wzTo3hdvBgC50xNCc8tL56+p3M4NFT Aw2HmLZdDfbsnub4FRc5Wv7mm214yJASLv6z5vLnWGQLEi7ZubVd0zNminA8nYw3Y+LJ bhfJnkQXLbLHIknsu4xjzgS5CWDXiXJhoAlztgkTpWbh9kv5b2/IVzCUXWPJAcuCDAf0 gEKt63fzYOUV0/FxryH+aGqvl19vk46D/YW3NNQt6uZY12yMjfb8x8xX/iSoxNqGy1/B KRRFKs2cmfnI2NjxfhtdGQ6lM4VQx0i7+Xw88UM7yKmEw9035xBWlxZ+UW179IPKHP7g AJbg== X-Gm-Message-State: AOAM533bAxF+2sVTqNjtCh+b0Scja9JzPzLmufRQBk9RHGwhmcRZ/cQs U37Gidd6QFIX/BDC498mLEQ= X-Google-Smtp-Source: ABdhPJyRXPvzptIcqroKlodrJuS4XC/fDa3w8bHmLNks834mS9K06V5+dj1s/KQ3EP3JOZ7CgXiMVQ== X-Received: by 2002:a17:902:be0f:b0:149:5535:287b with SMTP id r15-20020a170902be0f00b001495535287bmr19975326pls.28.1640679565897; Tue, 28 Dec 2021 00:19:25 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:75d9:9d42:b2d1:4a8f]) by smtp.gmail.com with ESMTPSA id h17sm15153036pfv.217.2021.12.28.00.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 00:19:24 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 032CB114030D; Tue, 28 Dec 2021 18:49:22 +1030 (ACDT) Date: Tue, 28 Dec 2021 18:49:21 +1030 From: Alan Modra To: "H.J. Lu" Cc: Binutils Subject: Re: [PATCH] bfd: Don't check non-thin archive member file size Message-ID: References: <20211224234604.229521-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3029.9 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2021 08:19:28 -0000 On Mon, Dec 27, 2021 at 05:31:13AM -0800, H.J. Lu wrote: > On Sun, Dec 26, 2021 at 10:56 PM Alan Modra wrote: > > > > On Fri, Dec 24, 2021 at 03:46:04PM -0800, H.J. Lu via Binutils wrote: > > > There is no need to check member file size for thin archive member. > > > > Does it hurt to check against the file size recorded in the archive > > header? Did someone report a "bug", perhaps that a thin archive > > member file was updated without running ar, and then hit an error? > > > > While debugging a GCC bootstrap bug, I copied a .o file without running > ar on a thin archive. Other linkers didn't complain. There is no need to. No doubt what you did was reasonably safe, but if an object file that is part of a thin archive is replaced without running ar then it is possible for the archive symbol table to be wrong. That could lead to linker misbehaviour. So I'm inclined to say we should be checking the archive header size against file size. Such a check doesn't really belong in bfd_bread though, so please go ahead and apply your patch. -- Alan Modra Australia Development Lab, IBM