From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by sourceware.org (Postfix) with ESMTPS id 8697C3858D28 for ; Tue, 20 Sep 2022 08:47:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8697C3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id 5F9EE40014; Tue, 20 Sep 2022 08:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seketeli.org; s=gm1; t=1663663659; h=from:from:reply-to:subject:subject: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=i+gQ5VMgrM7MDJbMzWGD7pupe4I0K9PNtWZSEE95ZD0=; b=PWSlsGxuY/uRF0TVxFBeV16pHQ5BOCmc58FC5UvNb6VUfRXcKG5lRvIhoEY4+BaGcAcrJm xQD/LAm/13AbbBkXyL/Fz5Gt1grlg81SBSaGbKidEhD209sgjY58PvH4on5/aqP2veJF59 hqxp3E69iVpPPD7nrk0nuu97imBo00/NvFu40Yrqa75j0Pv9JynY/U4bw818MGMbYdivGa yRx0WgsV0A5mt24zZV9xpv0/soFFlAN4BeXDrJdo3s2RHPzsbg+j1VAxa1L73+7a2qTz7K 7tcZa2Um5HffNdgLcw1WO4fVFh5DAPtwHob+GH+hYhZ7LV2k2s3UqZTRMiR5jg== Received: by localhost (Postfix, from userid 1000) id 7CFEE5802BD; Tue, 20 Sep 2022 10:47:37 +0200 (CEST) From: Dodji Seketeli To: Mark Wielaard Cc: Ben Woodard , Ben Woodard via Libabigail Subject: Re: libabigail 2.1 trunk testing where are we? Organization: Me, myself and I References: <5BA0C098-9E22-4604-8C13-1D0624B2489F@redhat.com> X-Operating-System: Fedora 38 X-URL: http://www.seketeli.net/~dodji Date: Tue, 20 Sep 2022 10:47:37 +0200 In-Reply-To: (Mark Wielaard's message of "Fri, 29 Jul 2022 22:57:09 +0200") Message-ID: <87y1ue5t5i.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=-9.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,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: Hello fine fellows! Mark Wielaard a =C3=A9crit: > On Fri, Jul 29, 2022 at 11:28:18AM -0700, Ben Woodard via Libabigail wrot= e: >> 1 crash due to incorrect ELF in that shows up in a small number of >> packages https://sourceware.org/bugzilla/show_bug.cgi?id=3D29346 > > I have a patch that should work around that on: > https://code.wildebeest.org/git/user/mjw/libabigail/commit/?h=3Dpr29346 > Also attached. Maybe someone with commit access could push it to a > users try branch for testing? Man, thank you! [...] Ben Woodard via Libabigail a =C3=A9crit: > Thanks for the patch. > > I put it into my personal develop tree and it relatively immediately > fixed 4/6 of the packages that I had identified as having that > problem. The tests on the other two packages are still running and > have been running for over half an hour and so something is > working. We will see if they complete before they timeout. I may have > to move those two to the takes to long to compete group > https://sourceware.org/bugzilla/show_bug.cgi?id=3D29303 > > So this at least fixed: > guile22 > guile30 > gnucash > aisleriot Whoah! Thank you Ben! You guys rock. Okay, so I have just applied this to master. Mark, by the, way, just for my own education, would it have been ok to just use gelf_getshdr all the time, rather than using looking at the sh_entsize property of the section header that can be wrong sometimes? I am guessing the reason why you chose to keep looking at the later has to do with potential performance concerns? Anyway, either way, I am fine. Here is what got applied exactly: >From f3b889a2cb94f8bb8372db14520d235dda7fdc3b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 20 Jul 2022 01:01:14 +0200 Subject: [PATCH] Handle zero sh_entsize in get_soname_of_elf_file Apparently guile produced ELF files don't set sh_entsize for the dynamic section. Which would cause a divide by zero. Luckily we do know how big an dynamic entry should be. So use gelf_fsize for ELF_T_DYN if sh_entsize is zero. * src/abg-dwarf-reader.cc (get_soname_of_elf_file): Make sure entsize is non-zero before use. https://sourceware.org/bugzilla/show_bug.cgi?id=3D29346 Signed-off-by: Mark Wielaard Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 56909540..695683ed 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -16425,8 +16425,11 @@ get_soname_of_elf_file(const string& path, string = &soname) Elf_Scn* scn =3D gelf_offscn (elf, phdr->p_offset); GElf_Shdr shdr_mem; GElf_Shdr* shdr =3D gelf_getshdr (scn, &shdr_mem); + size_t entsize =3D (shdr !=3D NULL && shdr->sh_entsize !=3D 0 + ? shdr->sh_entsize + : gelf_fsize (elf, ELF_T_DYN, 1, EV_CURRENT)); int maxcnt =3D (shdr !=3D NULL - ? shdr->sh_size / shdr->sh_entsize : INT_MAX); + ? shdr->sh_size / entsize : INT_MAX); ABG_ASSERT (shdr =3D=3D NULL || shdr->sh_type =3D=3D SHT_DYNAMIC= ); Elf_Data* data =3D elf_getdata (scn, NULL); if (data =3D=3D NULL) --=20 2.37.2 [...] Cheers, --=20 Dodji