From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by sourceware.org (Postfix) with ESMTPS id 030CB384B13C for ; Wed, 17 Mar 2021 16:11:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 030CB384B13C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dodji@seketeli.org X-Originating-IP: 88.120.130.27 Received: from localhost (unknown [88.120.130.27]) (Authenticated sender: dodji@seketeli.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 307E460006; Wed, 17 Mar 2021 16:11:05 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 23A7758000E; Wed, 17 Mar 2021 17:11:05 +0100 (CET) From: Dodji Seketeli To: Matthias Maennich Cc: libabigail@sourceware.org, gprocida@google.com, kernel-team@android.com Subject: Re: [PATCH 19/20] abg-writer.cc: fix write_elf_symbol_reference loop Organization: Me, myself and I References: <20200619214305.562-1-maennich@google.com> <20210127125853.886677-1-maennich@google.com> <20210127125853.886677-20-maennich@google.com> X-Operating-System: Fedora 34 X-URL: http://www.seketeli.net/~dodji Date: Wed, 17 Mar 2021 17:11:05 +0100 In-Reply-To: <20210127125853.886677-20-maennich@google.com> (Matthias Maennich's message of "Wed, 27 Jan 2021 12:58:52 +0000") Message-ID: <87r1kdwyjq.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 16:11:09 -0000 Matthias Maennich a =C3=A9crit: > From: Giuliano Procida > > The function write_elf_symbol_reference iterates through aliases, > looking for an unsuppressed alias to use. The existing code went wrong > in the case when aliases are present. In the case of all symbols > suppressed, it would also have selected the last alias, rather than > the first, if the data structure invariants had matched the code's > expectations. > > The main symbol is always distinguished. When aliases are absent, the > sole symbol's next pointer is null, but when aliases are present, they > form a circular list. This makes traversal of aliases a bit tricky. > > The code now picks the first symbol from the following: > > - the given symbol, if unsuppressed > - the main symbol, if unsuppressed > - the unsuppressed aliases in the remainder of the alias chain > - the main symbol (suppressed) > > The given symbol, which need not be the same as the main symbol, will > be tested twice, if suppressed, but addressing this would make the > code even more elaborate and fragile. > > The last case may be unreachable if symbol suppression triggers when > all aliases are suppressed. > > I left this change stand-alone for easier review and to credit Giuliano f= or his > work on it, though it fixes a previous commit. > > * src/abg-writer.cc (write_elf_symbol_reference): Check main > symbol and aliases with more care. > > Fixes: commmit ("dwarf-reader/writer: consider aliases when dealing with = suppressions") > Signed-off-by: Giuliano Procida > Signed-off-by: Matthias Maennich OK to apply to master when the prerequisite patches are in. Thanks! [...] Cheers, --=20 Dodji