From patchwork Sat Jul 9 20:13:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fche at redhat dot com X-Patchwork-Id: 55903 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 29175385BAFF for ; Sat, 9 Jul 2022 20:14:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29175385BAFF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1657397642; bh=Vno87JUe8rNvOVcE4iszLxvUeDFfF+goD2srcOLKfww=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=RVN5x839RkQ1tKez0RhFOIa2KKvKQv1wMtfy4oT9dqalZ+ujsOs4okWMqW6ZXRrtx fBxG7uCHPwicQlvmu8qjlBPS562amHAd6vW+jQURpo4KiYehc5Tm7wEzRSFD9TC5Lv /nnGVcB0BTorc5BWiYIOb5R5EGnffESUrDexr8UM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: by sourceware.org (Postfix, from userid 48) id D2E653857023; Sat, 9 Jul 2022 20:13:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2E653857023 To: libabigail@sourceware.org Subject: [Bug default/29346] SIGFPE when doing abipkgdiff --self-check of aisleriot-debuginfo-3.22.21-1.fc36.aarch64.rpm Date: Sat, 09 Jul 2022 20:13:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: libabigail X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dodji at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 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-Patchwork-Original-From: mark at klomp dot org via Libabigail From: fche at redhat dot com Reply-To: mark at klomp dot org Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" https://sourceware.org/bugzilla/show_bug.cgi?id=29346 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at klomp dot org --- Comment #1 from Mark Wielaard --- > Thread 1 "abipkgdiff" received signal SIGFPE, Arithmetic exception. > 0x00007ffff7e37aa3 in abigail::dwarf_reader::get_soname_of_elf_file > (path="/home/ben/.cache/libabigail/abipkgdiff-tmp-dir-ipFB18/package1/usr/lib64/aisleriot/guile/3.0/yield.go", soname="") at ../../../libabigail/src/abg-dwarf-reader.cc:16638 > 16638 ? shdr->sh_size / shdr->sh_entsize : INT_MAX); The issue is that the yield.go file (a guile generated ELF file) has sh_entsize of zero for the .dynamic section. I think that is a bug in guile. And it is slightly questionable that abipkgdiff tries to diff the abi of a generated guile file. But something like the following should fix it (untested): ABG_ASSERT (shdr == NULL || shdr->sh_type == SHT_DYNAMIC); diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 32a2cead..f08f194b 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -16634,6 +16634,8 @@ get_soname_of_elf_file(const string& path, string &soname) Elf_Scn* scn = gelf_offscn (elf, phdr->p_offset); GElf_Shdr shdr_mem; GElf_Shdr* shdr = gelf_getshdr (scn, &shdr_mem); + size_t entsize = (shdr->sh_entsize + ?: gelf_fsize (elf, ELF_T_DYN, 1, EV_CURRENT)); int maxcnt = (shdr != NULL ? shdr->sh_size / shdr->sh_entsize : INT_MAX);